public void ZombieModelDied(DamageInfo damageInfo) { // Debug.Log("ZombieController " + _instanceId.ToString() + " OnZombieModelDied 1"); _lifeState = ZombieLifeState.Dead; OnStateChanged(); _view.OnZombieDied(_model); _view.PlayDieFX(damageInfo.DieFX); _collection.OnZombieDied(this, _model); _animationQueue.Clear(); _onProfileAddGoldSignal.Fire(damageInfo.Damage); _deathAnimation = GetDeathAnimation(damageInfo.DamageType); _actionList.Clear(); if (_moveState == ZombieMoveState.Moving) { _actionList.Add(ZombieAction.DieOnGround); } else { _actionList.Add(ZombieAction.DieInFly); } PlayNextAction(damageInfo); }
// Start is called before the first frame update void Start() { movement = GetComponent <ZombieMovement>(); anim = GetComponent <ZombieAnimation>(); alive = true; if (GameplayController.instance.zombieGoal == ZombieGoal.PLAYER) { target = GameObject.FindGameObjectWithTag(TagManager.PLAYER_TAG).transform; } else if (GameplayController.instance.zombieGoal == ZombieGoal.FENCE) { GameObject[] fences = GameObject.FindGameObjectsWithTag(TagManager.FENCE_TAG); target = fences[Random.Range(0, fences.Length)].transform; } }
public void OnAnimationFinished(string data) { // Debug.Log(string.Format("{0} OnAnimationFinished {1}", _instanceId, data)); ZombieAnimation animation = Helper.ParseEnum <ZombieAnimation>(data, ZombieAnimation.Unknown); switch (animation) { case ZombieAnimation.RotateToTarget: case ZombieAnimation.Hit: if (_moveState == ZombieMoveState.Laying || _moveState == ZombieMoveState.Moving) { _actionList.Add(ZombieAction.MovingToBarricades); PlayNextAction(); } break; case ZombieAnimation.AcidDie: case ZombieAnimation.FireDie: case ZombieAnimation.ShotDie: case ZombieAnimation.Death: case ZombieAnimation.AshDie: case ZombieAnimation.ExplosionDie: case ZombieAnimation.FountainDie: if (_moveState != ZombieMoveState.Flying && _moveState != ZombieMoveState.Jumping) { _actionList.Clear(); _actionList.Add(ZombieAction.ReturnToPool); PlayNextAction(); } break; case ZombieAnimation.AfterHandExplosion: _actionList.Add(ZombieAction.Rotating); PlayNextAction(); break; default: break; } }