示例#1
0
 public void OnHit(HitInfo info)
 {
     if (killable.GetHealth() <= 1)
     {
         Destroy(this.GetComponent <EnemyChaseController>());
         Destroy(head);
         EnemyFleeController newController = this.gameObject.AddComponent <EnemyFleeController>();
         newController.direction = info.direction;
     }
 }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     currentState = BasicRangeState.Idle;
     player = GameObject.FindGameObjectWithTag("Player");
     playerGridPosition = player.GetComponent<GridPosition>();
     playerHealth = player.GetComponent<PlayerHealth>();
     gridPosition = GetComponent<GridPosition>();
     aStar = GetComponent<AIPath>();
     attackCooldownCounter = 0;
     attackTimeCounter = 0;
     canAttack = false;
     fleeController = GetComponent<EnemyFleeController>();
     animator = GetComponentInChildren<Animator>();
     monsterHealth = GetComponent<MonsterHealth>();
     stateCounter = 0;
 }