Esempio n. 1
0
 public override void DoState()
 {
     if (!Boss.isDriveBy)
     {
         SM.ChangeState(SM.DriveCombo);
     }
 }
Esempio n. 2
0
 private void PrepareDriveBy()
 {
     SM.PlayAnimation(Tank_StateManager.AnimationState.Tank_Double);
     if (Boss.isDriving) // is already in the drive by combo
     {
         canStartDrive = false;
         if (Boss.DriveComboCounter < Boss.DriveComboNumber)
         {
             Boss.SetSound(1);
             Boss.PlaySound();
             DetermineDriveBy();
             Boss.DriveComboCounter++;
             SM.ChangeState(SM.DriveBy);
         }
         else
         {
             Boss.SetSound(3);
             Boss.PlaySound();
             SM.ChangeState(SM.DriveIn);
         }
     }
     else // Start the drive by combo
     {
         Boss.DriveComboCounter = 0;
         Boss.SetSound(2);
         Boss.PlaySound();
         canStartDrive = true;
     }
 }
 public override void DoState()
 {
     if (tPrep < PrepDuration)
     {
         tPrep += Time.deltaTime;
         // Rev up - prep
     }
     else
     {
         if (prepPhase)
         {
             prepPhase = false;
             //Boss.sp.color = Color.blue;
         }
         else
         {
             if (t < Duration)
             {
                 t += Time.deltaTime;
                 r += Time.deltaTime / Duration;
                 Boss.transform.position = Vector3.Lerp(startPos, endPos, r);
             }
             else
             {
                 // Back to Idle
                 // snap to new location
                 Boss.transform.position  = endPos;
                 Boss.currentBossLocation = target;
                 SM.ChangeState(SM.Idle);
             }
         }
     }
 }
 public override void DoState()
 {
     if (t1 < PrepDuration) // Prep Phase
     {
         t1 += Time.deltaTime;
     }
     else
     {
         if (prepPhase) // Prep Phase ends
         {
             Boss.HitTargets();
             prepPhase = false;
             hitPhase  = true;
             //Boss.sp.color = Color.red;
         }
         else
         {
             if (t2 < HitDuration) // Hit Phase
             {
                 t2 += Time.deltaTime;
             }
             else
             {
                 if (hitPhase)
                 {
                     Boss.ClearTargets();
                     hitPhase = false;
                     retPhase = true;
                     //Boss.sp.color = Color.green;
                 }
                 else
                 {
                     if (t3 < ReturnDuration)
                     {
                         t3 += Time.deltaTime;
                     }
                     else
                     {
                         if (Boss.GunAttackCount < NumAttacks)
                         {
                             Boss.GunAttackCount++;
                             SM.ChangeState(SM.Prepare);
                         }
                         else
                         {
                             Boss.GunAttackCount = 1;
                             SM.ChangeState(SM.Idle);
                         }
                     }
                 }
             }
         }
     }
 }
 public override void DoState()
 {
     if (t < Duration)
     {
         t += Time.deltaTime;
     }
     else
     {
         SM.ChangeState(SM.Prepare);
     }
 }
 public override void DoState()
 {
     if (timer < 2.5f)
     {
         timer += Time.deltaTime;
     }
     else
     {
         SM.ChangeState(SM.Idle);
     }
 }
 public override void DoState()
 {
     if (timer < Duration)
     {
         timer += Time.deltaTime;
         //
     }
     else
     {
         SM.ChangeState(SM.Idle);
     }
 }
 public override void DoState()
 {
     if (t1 < PrepDuration) // prep timer - aim
     {
         t1 += Time.deltaTime;
     }
     else
     {
         if (prepPhase)
         {
             prepPhase  = false;
             shootPhase = true;
             //Boss.sp.color = Color.red;
             // SHOOT AT THE TARGETS
             Boss.ShootMortar(Boss.targets);
         }
         else
         {
             if (t2 < HitDuration) // shoot duration
             {
                 t2 += Time.deltaTime;
             }
             else
             {
                 if (shootPhase)
                 {
                     //Boss.sp.color = Color.green;
                     shootPhase  = false;
                     returnPhase = true;
                     SM.PlayAnimation(Tank_StateManager.AnimationState.Tank_ShootMortar_end);
                 }
                 else
                 {
                     if (t3 < ReturnDuration) // Return phase
                     {
                         t3 += Time.deltaTime;
                     }
                     else
                     {
                         SM.ChangeState(SM.Idle);
                     }
                 }
             }
         }
     }
 }
Esempio n. 9
0
    private void EndAttack()
    {
        if (t3 < ReturnDuration)
        {
            t3 += Time.deltaTime;
            // Returning
            r2 += Time.deltaTime / ReturnDuration;
            Boss.transform.position = Vector3.Lerp(targetPos, endPos, r2);
        }
        else
        {
            // Back to Idle
            Boss.transform.position = endPos;

            Boss.JumpAttacksCount = 1;
            SM.ChangeState(SM.Idle);
        }
    }
 public override void DoState()
 {
     if (t < Duration) // slight pause
     {
         t += Time.deltaTime;
     }
     else
     {
         if (SM.comboActive)
         {
             SM.ChangeState(SM.PrepareAttack);
         }
         else
         {
             //SM.ChangeState(SM.ComboState);
             SM.PerformCombo(MoveList[Random.Range(0, MoveList.Length)]);
         }
     }
 }
Esempio n. 11
0
    public override void DoState()
    {
        Boss.transform.position = Boss.currentBossLocation.transform.position;
        if (t < Duration)
        {
            t += Time.deltaTime;
        }
        else
        {
            SM.nextAttackState = MoveList[Random.Range(0, MoveList.Length)];
            SM.ChangeState(SM.Prepare);

            /*if (SM.comboActive)
             *  SM.ChangeState(SM.Prepare);
             * else
             * {
             *  SM.PerformCombo(MoveList[Random.Range(0, MoveList.Length)]);
             * }*/
        }
    }
Esempio n. 12
0
    /*private List<Location> DetermineTargets(Tank_State attack, Location playerLoc)
     * {
     *  List<Location> targets = new List<Location>();
     *
     *  switch (attack.GetName())
     *  {
     *      case "AttackJump":
     *          targets.Add(playerLoc);
     *          return targets;
     *
     *      default:
     *          return targets;
     *  }
     * }*/

    private void DetermineAction()
    {
        switch (AttackToPerform.GetName())
        {
        case "Reposition":
            SM.ChangeState(SM.Reposition);
            break;

        case "DriveBy":
            PrepareDriveBy();
            break;

        case "AttackJump_1":
            Boss.SetSound2(4);
            TargetPlayerLocation();
            Boss.TargetLocations();
            SM.ChangeState(SM.AttackJumpSingle);
            break;

        case "AttackJump_3":
            Boss.SetSound2(4);
            TargetPlayerLocation();
            Boss.TargetLocations();
            SM.ChangeState(SM.AttackJumpTriple);
            break;

        case "ShootGun_1":
            Boss.SetSound2(5);
            TargetPlayerLocation();
            Boss.TargetLocations();
            SM.ChangeState(SM.ShootGunSingle);
            break;

        case "ShootGun_3":
            Boss.SetSound2(5);
            TargetPlayerLocation();
            Boss.TargetLocations();
            SM.ChangeState(SM.ShootGunTriple);
            break;

        case "Mortar_1":
            Boss.SetSound2(5);
            if (Boss.CheckCanMortar())
            {
                TargetPlayerLocation();
                SM.ChangeState(SM.ShootMortar_1);
            }
            else
            {
                Debug.Log("CANNOT FIRE");
                SM.ChangeState(SM.Reposition);
            }
            break;

        case "Mortar_2":
            Boss.SetSound2(5);
            if (Boss.CheckCanMortar())
            {
                TargetMultipleLocations(SM.ShootMortar_2.GetNumAttacks());
                SM.ChangeState(SM.ShootMortar_2);
            }
            else
            {
                Debug.Log("CANNOT FIRE");
                SM.ChangeState(SM.Reposition);
            }
            break;

        case "Oil_1":
            Boss.SetSound2(5);
            TargetPlayerLocation();
            SM.ChangeState(SM.ShootOil_1);
            break;

        case "Oil_2":
            Boss.SetSound2(5);
            TargetMultipleLocations(SM.ShootOil_2.GetNumAttacks());
            SM.ChangeState(SM.ShootOil_2);
            break;

        default:
            SM.ChangeState(SM.Idle);
            break;
        }
    }
Esempio n. 13
0
 private void StartDriveCombo()
 {
     SM.ChangeState(SM.DriveOff);
 }
Esempio n. 14
0
 public override void DoState()
 {
     if (t0 < PrepDuration)
     {
         t0 += Time.deltaTime;
         // Prepping
         // Still yellow
     }
     else
     {
         if (prepPhase)
         {
             prepPhase = false;
             jumpPhase = true;
             //Boss.sp.color = Color.blue;
             Boss.currentBossLocation = Boss.Off_A;
             SM.PlayAnimation(Tank_StateManager.AnimationState.Tank_Jump_during);
         }
         else
         {
             if (t1 < Duration)
             {
                 t1 += Time.deltaTime;
                 // Jumping
                 float   lerpRatio      = t1 / Duration;
                 Vector2 positionOffset = Boss.JumpCurve.Evaluate(lerpRatio) * Boss.Jump_LerpOffset;
                 Boss.transform.position = Vector2.Lerp(startPos, targetPos, lerpRatio) + positionOffset;
             }
             else
             {
                 if (jumpPhase)
                 {
                     Boss.transform.position = targetPos;
                     Boss.HitTargets();
                     jumpPhase = false;
                     hitPhase  = true;
                     //Boss.sp.color = Color.red;
                     Boss.currentBossLocation = endLocation;
                     Boss.PlaySound_2();
                     SM.PlayAnimation(Tank_StateManager.AnimationState.Tank_Jump_end);
                 }
                 else
                 {
                     if (t2 < HitDuration)
                     {
                         t2 += Time.deltaTime;
                         // Hitting
                     }
                     else
                     {
                         if (hitPhase)
                         {
                             Boss.ClearTargets();
                             hitPhase = false;
                             retPhase = true;
                             //Boss.sp.color = Color.green;
                         }
                         else
                         {
                             // Jump 3 times
                             if (Boss.JumpAttacksCount < NumAttacks)
                             {
                                 Boss.JumpAttacksCount++;
                                 SM.ChangeState(SM.Prepare);
                             }
                             else
                             {
                                 EndAttack();
                             }
                         }
                     }
                 }
             }
         }
     }
 }