// Constructor - Assume that Boss and Player are at Starting Positions. public BlackBoard() { // Transforms BossTransform = null; PlyrTransform = null; // Health PlyrHP = 1.0f; BossHP = 1.0f; //Current Active Specialist ActSpec = ActionSpecialists.AttackSpec; PasSpec = PassiveSpecialists.DistanceSpec; //Boss Variables BossBhvr = BossBehavior.Agressive; // Distance Variables CurBossLoc = BossLocation.RightSide; PlyrLoc = PlayerLocation.LeftFromBoss; DestBossLoc = BossLocation.RightSide; PlyrDist = PlayerDistance.Far; isMovingToOtherSide = false; isAtSafeDistance = false; isPlyrLinedUp = false; // Projectile Variables AreBulletsNear = false; NumberBulletsNear = 0; }
void ReadWallData() { float DistToRightWall; float DistToLeftWall; // Read Right Wall Data. DistToRightWall = Mathf.Abs((RightWallTransform.position.x - BossTransform.position.x)); // Read Left Wall Data. DistToLeftWall = Mathf.Abs((LeftWallTransform.position.x - BossTransform.position.x)); if (Mathf.Abs(DistToRightWall - DistToLeftWall) < 18.0f) CurrentBossLoc = BossLocation.Center; // Boss is on the right side of screen else if(DistToRightWall < DistToLeftWall) CurrentBossLoc = BossLocation.RightSide; // Boss is on the Leftside of screen else CurrentBossLoc = BossLocation.LeftSide; }
// Moves Boss from one side of the Screen to the other by jumping. Part of this function is executed on Update to ensure it ends. void MoveToOtherSide(BossLocation Origin) { // Set Up Moving to other side status. if (MovingToOtherSide == false) { // Set Up Destination MovingToOtherSide = true; // If on the left side or on center and player to the left, go right! if (Origin == BossLocation.LeftSide || (Origin == BossLocation.Center && ReadBlackBoard.PlyrLoc == PlayerLocation.LeftFromBoss)) BossScreenSideDest = BossLocation.RightSide; // If on the right side or on center and player to the right, go right! else if (Origin == BossLocation.RightSide || (Origin == BossLocation.Center && ReadBlackBoard.PlyrLoc == PlayerLocation.RightFromBoss)) BossScreenSideDest = BossLocation.LeftSide; // Updates Destination to BlackBoard. BlkBrdMngr.WriteBlckBrd.DestBossLoc = BossScreenSideDest; return; } // Already moving to other side so continue moving. else { // Are we there yet? if (Origin != BossScreenSideDest) { // If going right, keep going. if (BossScreenSideDest == BossLocation.RightSide) AICtrl.MoveRight(); // If going left, keep going. else if (BossScreenSideDest == BossLocation.LeftSide) AICtrl.MoveLeft(); // Jump in either option AICtrl.Jump(); } // Boss movement has finished. else MovingToOtherSide = false; } }