public void Death() { EnemyManager.monsters.Remove(gameObject); //销毁 Destroy(gameObject, 3); //播放动画 GetComponent <EnemyMotor>().line.isUsable = true; spawn.GenerateEnemy(); }
public void EnemyDeath() { GetComponent <EnemyAI>().enabled = false; var anim = GetComponent <EnemyAnimation>(); anim.action.Play(anim.deathAnimName); Destroy(gameObject, DeathDelay); //播放死亡动画 //将路线还原 GetComponent <EnemyMotor>().line.isUsable = true; //产生下一个敌人 spawn.GenerateEnemy(); }
/// <summary> /// 死亡 /// </summary> public void Death() { //销毁当前游戏物体 Destroy(gameObject, deathDelay); //播放动画 var anim = GetComponent <EnemyAnimation>(); anim.Play(anim.deathName); //修改状态 GetComponent <EnemyAI>().state = EnemyAI.State.Death; //修改路线状态 GetComponent <EnemyMotor>().wayline.IsUsable = true; //需要再生成一个敌人 spawn.GenerateEnemy(); }