public IState DoState(PlantStateMachine stateMachine) { if (!stateMachine.GetIsDieAnim()) { DoDeathState(stateMachine); } return(this); }
private void DoIdle(PlantStateMachine stateMachine) { stateMachine.SetIdleAnim(true); stateMachine.SetInRangeToShootAnim(false); if (Vector3.Distance(stateMachine.transform.position, GameManager.Instance.player.transform.position) <= stateMachine.enemy.stats.ShootingRange) { stateMachine.enemy.conditions.isShootingRange = true; stateMachine.enemy.conditions.isIdle = false; } }
private void DoShooting(PlantStateMachine stateMachine) { stateMachine.ShootingMonobehaviour(); if (Vector3.Distance(stateMachine.transform.position, GameManager.Instance.player.transform.position) > stateMachine.enemy.stats.ShootingRange) { stateMachine.enemy.conditions.isShootingRange = false; stateMachine.enemy.conditions.isIdle = true; stateMachine.enemy.conditions.canShoot = false; stateMachine.StopCoroutine("CounterToIsShootOn"); } }
private void DoDeathState(PlantStateMachine stateMachine) { stateMachine.enemy.hpIndicator.UpdateHp(); stateMachine.navAgent.velocity = Vector3.zero; stateMachine.enemy.SetNewDamageIndicator(); stateMachine.enemy.ParticleDamaged(); stateMachine.SetTriggerDieAnim(); stateMachine.SetIsDieAnim(true); stateMachine.enemy.conditions.Reset(); }
public IState DoState(PlantStateMachine stateMachine) { DoGetHit(stateMachine); if (stateMachine.enemy.conditions.isIdle) { return(stateMachine.idleState); } else if (stateMachine.enemy.conditions.isDead) { return(stateMachine.deathState); } else //if (stateMachine.enemy.conditions.isShootingRange) { return(stateMachine.shootRangeState); } }
private void DoGetHit(PlantStateMachine stateMachine) { if (!GameManager.Instance.soundManager.isPlaying("PlantGetHit")) { GameManager.Instance.soundManager.Play("PlantGetHit"); } stateMachine.navAgent.velocity = Vector3.zero; stateMachine.SetTriggerGetHitAnim(); stateMachine.enemy.SetNewDamageIndicator(); stateMachine.enemy.ParticleDamaged(); stateMachine.enemy.stats.CurrentHp -= stateMachine.enemy.cuantity; stateMachine.enemy.hpIndicator.UpdateHp(); stateMachine.enemy.conditions.isHitten = false; }
public IState DoState(PlantStateMachine stateMachine) { DoIdle(stateMachine); if (stateMachine.enemy.conditions.isShootingRange) { return(stateMachine.shootRangeState); } else if (stateMachine.enemy.conditions.isHitten) { return(stateMachine.getHitState); } else if (stateMachine.enemy.conditions.isDead) { return(stateMachine.deathState); } else { return(this); } }