public IState DoState(GolemStateMachine stateMachine) { if (!stateMachine.GetIsDieAnim()) { DoDeathState(stateMachine); } return(this); }
private void DoAttack(GolemStateMachine stateMachine) { stateMachine.navAgent.isStopped = true; stateMachine.navAgent.velocity = Vector3.zero; //set anim and dmg stuff if (stateMachine.enemy.conditions.canMegaAttack) { stateMachine.SetTriggerMegaAttackAnim(); stateMachine.LookPlayer(); stateMachine.MegaAttackCD(Random.Range(5f, 10f)); } }
private void DoDeathState(GolemStateMachine stateMachine) { stateMachine.enemy.hpIndicator.UpdateHp(); stateMachine.navAgent.isStopped = true; stateMachine.navAgent.velocity = Vector3.zero; stateMachine.enemy.SetNewDamageIndicator(); stateMachine.enemy.ParticleDamaged(); stateMachine.SetTriggerDieAnim(); stateMachine.SetIsDieAnim(true); stateMachine.enemy.conditions.Reset(); stateMachine.enemy.conditions.isDead = true; }
public IState DoState(GolemStateMachine stateMachine) { DoAttack(stateMachine); if (!stateMachine.enemy.conditions.canMegaAttack) { stateMachine.WaitToPatrol(); if (stateMachine.canPat) { return(stateMachine.patrolState); } } return(this); }
private void DoPatrol(GolemStateMachine stateMachine) { stateMachine.navAgent.isStopped = false; stateMachine.navAgent.SetDestination(stateMachine.patrolTarget.position); if (Vector3.Distance(GameManager.Instance.player.transform.position, stateMachine.transform.position) <= stateMachine.enemy.stats.ShootingRange) { stateMachine.enemy.conditions.isShootingRange = true; stateMachine.enemy.conditions.isPatrol = false; } else { stateMachine.enemy.conditions.isShootingRange = false; } stateMachine.enemy.conditions.isPatrol = true; }
public IState DoState(GolemStateMachine stateMachine) { DoGetHit(stateMachine); if (stateMachine.enemy.conditions.isAttackRange) { return(stateMachine.attackState); } else if (stateMachine.enemy.conditions.isDead) { return(stateMachine.deathState); } else { return(stateMachine.patrolState); } }
private void DoGetHit(GolemStateMachine stateMachine) { if (!GameManager.Instance.soundManager.isPlaying("GolemGetHit")) { GameManager.Instance.soundManager.Play("GolemGetHit"); } stateMachine.navAgent.isStopped = true; 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.isWait = true; stateMachine.enemy.conditions.isHitten = false; }
public IState DoState(GolemStateMachine stateMachine) { DoPatrol(stateMachine); if (stateMachine.enemy.conditions.isHitten) { return(stateMachine.getHitState); } else if (stateMachine.enemy.conditions.isDead) { return(stateMachine.deathState); } else if (stateMachine.enemy.conditions.isShootingRange && stateMachine.enemy.conditions.canMegaAttack) { return(stateMachine.attackState); } else { return(stateMachine.patrolState); } }