我在Unity中创建的游戏存在问题.玩家控制一个被一大群僵尸攻击的角色.我已经为所有的僵尸创造了一个产卵器并且效果很好,唯一的问题是,一旦玩家杀死一个僵尸,所有的僵尸都会从游戏世界中消失.我发布了附在下面每个僵尸上的敌人脚本.我无法弄清楚为什么每个僵尸都被摧毁而不仅仅是被攻击的僵尸.任何帮助都会很棒!
using UnityEngine;
using System.Collections;
public class Enemy : MonoBehaviour {
public static float Damage = 10.0f;
public static float Health = 10.0f;
public Transform target;
public float Speed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//Destroy the enemy if it's health reaches 0
if(Health <= 0){
Destroy(this.gameObject);
Debug.Log ("Enemy Destroyed!");
}
//Constantly move the enemy towards the centre of the gamespace (where the base is) …Run Code Online (Sandbox Code Playgroud) 我编写了一个简单的网站来测试我的技能,到目前为止一切都很好,但现在我添加的任何div都没有显示,但我放入div中的任何内容都有!(例如,如果我在div中写'hello'然后我可以在网页上看到它,但如果我在CSS中更改背景颜色,高度和宽度,那么这些更改都不会显示出来).下面是代码:
<!DOCTYPE html>
<html>
<head>
<title>Learning JavaScript</title>
<meta charset="utf-8"></meta>
<meta content="text/html; charset=utf-8" http-equiv="Content-type"></meta>
<meta content="width=device-width, initial-scale=1" name="viewport"></meta>
<style type="text/css">
body{
margin: 0;
background-color: black;
}
#menubar{
height: 60px;
width: 100%;
background-color: #FF8000;
}
#menubar img{
float: left;
}
#menubar ul{
float: left;
list-style: none;
}
#menubar li{
float: left;
padding:2px 60px 0 50px;
color: #2B2A29;
font-weight: bold;
border-right: 1px solid black;
}
#break{
clear: both;
}
#flagImage{
position: relative;
top: -123px;
z-index: -1;
}
#flagImage img{
width: 100%;
height: 400px; …Run Code Online (Sandbox Code Playgroud)