public override BossState Update(WhiteBossController boss) { Debug.Log("attack"); Vector3 vectorToPlayer = boss.VectorToAttackTarget(); Vector3 dirToPlayer = vectorToPlayer.normalized; boss.transform.position += dirToPlayer * boss.speed * Time.deltaTime * 2; /*timeUntilNextShot -= Time.deltaTime; * if(timeUntilNextShot <=0) * { * boss.ShootProjectile(); * timeUntilNextShot = timeBetweenShots; * } * * boss.ShootProjectile();*/ //if (!boss.CanSeeAttackTarget()) return new BossStateIdle(); // if the player gets too far away from the enemy return the enemy to idle // switch to retreat state // once the boss has finished its attack, it retreats a short distance away from the player // switch to dead state return(null); }
public override BossState Update(WhiteBossController boss) { // switch to idle // switch to pursue // switch to dead return(null); }
/// <summary> /// This function updates the boss every frame. /// </summary> /// <param name="boss"> The boss that this state applies to. </param> /// <returns> A new state. </returns> public override BossState Update(WhiteBossController boss) { // switch to idle // switch to move around level // switch to dead return null; } // ends the Update() function
public override BossState Update(WhiteBossController boss) { // switch to idle // switch to move around level // switch to dead return(null); }
public override BossState Update(WhiteBossController boss) { // do stuff to the boss... Debug.Log("idle"); // transitions to other states: if (boss.CanSeeAttackTarget()) { // transition to persue state... return(new BossStatePersue()); } // switch to move around level state // switch to dead state return(null); // stay in current state }
public override BossState Update(WhiteBossController boss) { // move towards player: Vector3 vectorToPlayer = boss.VectorToAttackTarget(); Vector3 dirToPlayer = vectorToPlayer.normalized; boss.transform.position += dirToPlayer * boss.speed * Time.deltaTime; /////////////////////////// TRANSITIONS: if (vectorToPlayer.sqrMagnitude < boss.pursueDistanceThreshold * boss.pursueDistanceThreshold) { return(new BossStateAttack()); // if dis < threshold transition to attack } //if (!boss.CanSeeAttackTarget()) return new BossStateIdle(); // if we can't see the player transition to idle // switch to attack state // switch to dead state return(null); }
/// <summary> /// This function updates the boss each frame. /// </summary> /// <param name="boss"> The boss that this state applies to. </param> /// <returns> A new state. </returns> public override BossState Update(WhiteBossController boss) { Debug.Log("attack"); Vector3 vectorToPlayer = boss.VectorToAttackTarget(); timeUntilNextShot -= Time.deltaTime; if(timeUntilNextShot <=0) { boss.ShootProjectile(); timeUntilNextShot = timeBetweenShots; } // ends the if statement boss.ShootProjectile(); if (!boss.CanSeeAttackTarget()) return new BossStateIdle(); // if the player gets too far away from the enemy return the enemy to idle // switch to retreat state // once the boss has finished its attack, it retreats a short distance away from the player // switch to dead state return null; } // ends the Update() function
public override void OnStart(WhiteBossController boss) { }
public abstract BossState Update(WhiteBossController boss);
public virtual void OnEnd(WhiteBossController boss) { }
public virtual void OnStart(WhiteBossController boss) { }
/// <summary> /// This function updates the boss on every frame. /// </summary> /// <param name="boss"> The boss that this state applies to. </param> /// <returns> This state. </returns> public override BossState Update(WhiteBossController boss) { // destroy the boss return null; } // ends the Update() function
} // ends the Update() function /// <summary> /// This function determines what the boss does upon entering the idle state. /// </summary> /// <param name="boss"> The boss that this state applies to. </param> public override void OnStart(WhiteBossController boss) { } // ends the OnStart() function
} // ends the OnStart() function /// <summary> /// This function defines what happens upon the state's end. /// </summary> /// <param name="boss"> The boss that the state applies to. </param> public virtual void OnEnd(WhiteBossController boss) { } // ends the OnEnd() function
public override BossState Update(WhiteBossController boss) { // destroy the boss return(null); }