// Update is called once per frame void Update() { //LookAtTarget (_targetPosition.position); //if( _state == ZombieState.Walk ){ float distance = Vector3.Distance(this.transform.position, _targetPosition.position); //Debug.Log (distance); if (_state != ZombieState.Die) { if (distance > 5.0f) { _state = ZombieState.Walk; _controller.SimpleMove(this.gameObject.transform.forward * _speed); } else { _state = ZombieState.Act; } if (_state == ZombieState.Act) { TargetUIHP.GetInstance()._currentHp -= 0.03f; } } //SetMask (); }
//Start()より早く一度だけ実行される関数 private void Awake() { if (_instance == null) { _instance = this; } else if (_instance != null) { Destroy(this.gameObject); } }