public void SetSupporter(Boss1_Supporter _NewSup) { Supporter = _NewSup; }
protected override void Attack() { //this is the boss executing its attack Debug.Log("The boss is attacking"); //StopAllCoroutines(); //StartCoroutine(DelayAction()); //So this is a temporary plug to wait for the AI Animation to play out //once the animateion ends there'll be an event that it calls it to the next step switch (BossPhase) { case 0: Phase1(); break; case 1: Phase2(); break; case 2: default: FinalPhase(); break; } //Anything after this is called via IEnumerator DelayAction() { InAction = true; yield return(new WaitForSeconds(2f)); State = AIStates.Idle; InAction = false; } void Phase1() { #region //Shove if too close //Arm Slam twice (four total slams on the other two platforms //Portal Arms (Opportunity to damage the boss) //Repeat //Things to consider, how vulnerable is the boss here? //So first We should check our distance to player or Just add a trigger to the boss Body //If the player is too close the boss will attempt to shove them AWAY //If On Edge it'll be towards the middle On the middle it'll push towards the sides //The bosses attacks will Include: //Arm Slam That Launches two projectiles that run along the ground //Arc Lighting Discharge in a straight line. //Green Lightning is a Short lasting shot .5 second Active time with a .75 second tell // //Portal Arm Launches that tracks the player's X or Y position befrore flying across //Ultimate attack is is Holy Lightning Like attack in a Cross //The #endregion if (CharacterTooClose) { ShovePlayer(); } else { //Alright so how attacks will work is we add a random amount to the attack number //Depending on where that attack number is is what attack will happen //The highest value as well as default will launch the attack that can damage the boss AttackNumber += Random.Range(0, 3); TrackSlam(); InAction = true; /* * switch (AttackNumber) * { * case 0: * case 1: * case 3: * Debug.Log("Boss Attack: ArmSlam | " + AttackNumber); * ArmSlam(); * break; * case 2: * case 4: * Debug.Log("Boss Attack: Lightning Volley | " + AttackNumber); * LightningVolley(); * break; * case 5: //This Thresh hold increases With each phase by 5 * default: * Debug.Log("Boss Attack: Ultimate Attack | " + AttackNumber); * //Ultimate Attack * //Fist Flurry * BlockOffArea(); * //Then Start Throwing Fists * //When the last swing is launched -> reset attack number to 0 * AttackNumber = 0; * break; * } */ } } void Phase2() { } void FinalPhase() { } void ShovePlayer() { Anim.Play(Boss1Actions.FA_Shove.ToString()); Anim.Play(Boss1Actions.BA_Shove.ToString()); } //So How does the boss figure out what attack to do //What needs to happen is that there are sub triggers //These Triggers will change the Targeting System of the boss //Lightning Volleys Shoot in a + Shape so I don't have to worry about the direction it flies void LightningVolley() { //Fire off Five Bolts of Lightning in two patterns //Low Mid High //L H M H L //M L L M H int VolleyType = Random.Range(0, 2); Debug.Log("Lightning Volley Type : " + VolleyType); /* * switch (Phase) * { * case 1: * break; * case 2: * break; * case 3: * break; * case 0: * default: * break; * } * if (VolleyType == 0) * { * * } * else * { * Anim.Play("Shoot2"); * } */ } //Slam the arms down and make shockwaves Perpendicularly to the shoot space //Instances void TrackSlam() { //Currently only two variations int Variation = Random.Range(0, 2); switch (Variation) { case 0: StartCoroutine(DelaySlam(.5f)); break; case 1: default: StartCoroutine(DelaySlam(1.5f)); break; } IEnumerator DelaySlam(float delay) { Direction FD = (Direction)Random.Range(0, Supporter.FiringLocation.Count); Debug.Log(FD.ToString()); Vector3 Dir = GetFD(); StartCoroutine(TrackPlayer(FrontArm, Dir, Boss1Actions.FA_Slam)); yield return(new WaitForSeconds(delay)); Dir = GetFD(); StartCoroutine(TrackPlayer(BackArm, Dir, Boss1Actions.BA_Slam)); Vector3 GetFD() { switch (FD) { case Direction.Down: return(Vector3.down); case Direction.Up: return(Vector3.up); case Direction.Left: return(Vector3.left); case Direction.Right: return(Vector3.right); default: return(Vector3.zero); } } } } //Activate the block off Routine // void BlockOffArea() { } //nothing fancy.... Just Creates a launcher at player's X or Y position //Then fires a fist at them. This should be maybe 3 void ShotFlurry() { } //Tracking object is the "ARM" or "PORTAL" that tracks the player; //FirePosition is Where it'll SHoot From IEnumerator TrackPlayer(GameObject TrackingObject, Vector3 Direction, Boss1Actions Action) { //Make a pointer to the supporter so it doesn't change mid attack.... Boss1_Supporter Supp = Supporter; Direction FD = SetFireDirection(); Transform LaunchPoint = SetLaunchPoint(); Transform Player = FindObjectOfType <CharacterController2D>().transform; float Tracktime = 3; //So what does this do, Well for 3 seconds It'll track the player.... //Then it'll play the Shoot Animation Vector3 PlayerPos = Vector3.zero; while (Tracktime > 0) { float dt = Time.deltaTime; Tracktime -= dt; yield return(new WaitForSeconds(dt)); switch (FD) { case global::Direction.Up: case global::Direction.Down: PlayerPos = new Vector3(Player.position.x, LaunchPoint.position.y, 0); if (TrackingObject.transform.position.y == LaunchPoint.position.y) { RotationHandler(Action); } break; case global::Direction.Left: case global::Direction.Right: PlayerPos = new Vector3(LaunchPoint.position.x, Player.position.y, 0); if (TrackingObject.transform.position.x == LaunchPoint.position.x) { RotationHandler(Action); } break; default: break; } TrackingObject.transform.position = Vector2.MoveTowards(TrackingObject.transform.position, PlayerPos, 0.1f); } Debug.Log("DragonFist"); //The Animation itself takes about half a second before firing yield return(new WaitForSeconds(.5f)); Anim.Play(Action.ToString()); FireRaycast(TrackingObject, Direction); //Functions Direction SetFireDirection() { if (Direction.y > 0) { return(global::Direction.Up); } //LaunchPoint = Supp.FiringLocation[0]; else if (Direction.y < 0) { return(global::Direction.Down); } //LaunchPoint = Supp.FiringLocation[1]; else if (Direction.x < 0) { return(global::Direction.Left); } //LaunchPoint = Supp.FiringLocation[2]; else if (Direction.x > 0) { return(global::Direction.Right); } //LaunchPoint = Supp.FiringLocation[3]; else { return(global::Direction.Down); } } Transform SetLaunchPoint() { switch (FD) { case global::Direction.Up: return(Supp.FiringLocation[0]); case global::Direction.Down: return(Supp.FiringLocation[1]); case global::Direction.Left: return(Supp.FiringLocation[2]); case global::Direction.Right: return(Supp.FiringLocation[3]); default: Debug.Log("There's no launch point...."); return(null); } } void RotationHandler(Boss1Actions _Action) { if (_Action == Boss1Actions.BA_Slam) { switch (FD) { case global::Direction.Up: TrackingObject.transform.localScale = new Vector3(1, 11, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, 0) * 90; break; case global::Direction.Down: TrackingObject.transform.localScale = new Vector3(1, 1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, 0) * 90; break; case global::Direction.Left: TrackingObject.transform.localScale = new Vector3(-1, 1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, 1) * 90; break; case global::Direction.Right: TrackingObject.transform.localScale = new Vector3(1, 1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, 1) * 90; break; default: break; } } else if (_Action == Boss1Actions.FA_Slam) { switch (FD) { case global::Direction.Up: TrackingObject.transform.localScale = new Vector3(1, -1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, 0) * 90; break; case global::Direction.Down: TrackingObject.transform.localScale = new Vector3(1, 1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, 0) * 90; break; case global::Direction.Left: TrackingObject.transform.localScale = new Vector3(1, 1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, -1) * 90; break; case global::Direction.Right: TrackingObject.transform.localScale = new Vector3(1, -1, 1); TrackingObject.transform.localEulerAngles = new Vector3(0, 0, -1) * 90; break; default: break; } } } } //END OF ENUM } //End of Function