void SideSwitch()
    {
        if (!isAI)
        {
            //determine which side
            //the reason for repeated code is so that AI doesn't just switch sides when its attacking willy nilly
            if (distance < 0 && character.side == Character.Side.P1)
            {
                character.side = Character.Side.P2;
                sharedProperties.CharacterNeutralState();
                comboSystem.ResetAllSequences();
            }
            else if (distance >= 0 && character.side == Character.Side.P2)
            {
                character.side = Character.Side.P1;
                sharedProperties.CharacterNeutralState();
                comboSystem.ResetAllSequences();
            }
            //only after character is not in these states will the sprite actually switch sides
            //only distinction here is extra booleans of both walks being false if AI is true so animation would play properly
            if (animator.GetBool("isAirborne") == false && animator.GetBool("isThrown") == false && animator.GetBool("isLanding") == false &&
                animator.GetBool("throwTargetAcquired") == false && animator.GetBool("isLiftingOff") == false && animator.GetBool("isAttacking") == false &&
                animator.GetBool("isInHitStun") == false && animator.GetBool("isInBlockStun") == false && animator.GetBool("isKnockedDown") == false)
            {
                character.SideSwitch();
            }
        }
        else
        {
//			if (animator.GetBool("isAttacking") == false){
            if (distance < 0 && character.side == Character.Side.P1)
            {
                character.side = Character.Side.P2;
                sharedProperties.CharacterNeutralState();
            }
            else if (distance >= 0 && character.side == Character.Side.P2)
            {
                character.side = Character.Side.P1;
                sharedProperties.CharacterNeutralState();
            }
//			}
            if (animator.GetBool("isAirborne") == false && animator.GetBool("isThrown") == false && animator.GetBool("isWalkingForward") == false && animator.GetBool("isAttacking") == false &&
                animator.GetBool("throwTargetAcquired") == false && animator.GetBool("isLiftingOff") == false && animator.GetBool("isWalkingBackward") == false &&
                animator.GetBool("isInHitStun") == false && animator.GetBool("isInBlockStun") == false && animator.GetBool("isKnockedDown") == false && animator.GetBool("isLanding") == false)
            {
                character.SideSwitch();
            }
        }
    }
    void SideSwitch()
    {
        //determine which side
//		if (animator.GetBool("isAttacking") == false){
        if (distance < 0 && character.side == Character.Side.P1)
        {
            character.side = Character.Side.P2;
            sharedProperties.CharacterNeutralState();
        }
        else if (distance >= 0 && character.side == Character.Side.P2)
        {
            character.side = Character.Side.P1;
            sharedProperties.CharacterNeutralState();
        }
//		}
        //only after character is not in these states will the sprite actually switch sides
        if (animator.GetBool("isAirborne") == false && animator.GetBool("isThrown") == false && animator.GetBool("isWalkingForward") == false && animator.GetBool("isLanding") == false &&
            animator.GetBool("throwTargetAcquired") == false && animator.GetBool("isLiftingOff") == false && animator.GetBool("isWalkingBackward") == false && animator.GetBool("isAttacking") == false &&
            animator.GetBool("isInHitStun") == false && animator.GetBool("isInBlockStun") == false && animator.GetBool("isKnockedDown") == false)
        {
            character.SideSwitch();
        }
    }
Exemple #3
0
 void RegularCloseRangeDecisions()
 {
     DecisionMade(5, 4);
     if (decision <= 20)
     {
         AIcontrols.AICrouch();
         sharedProperties.CharacterNeutralState();
         character.SetBackPressed(true);
     }
     else if (decision <= 27)
     {
         AIcontrols.AILowForward();
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 30)
     {
         AIcontrols.AISweep();
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 33)
     {
         AIcontrols.AIShort(15);
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 43)
     {
         AIcontrols.AIStrong(50);
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 53)
     {
         AIcontrols.AIJab(2);
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 59)
     {
         if (character.GetSuper >= 100f)
         {
             AIShunGokuSatsus();
         }
         else
         {
             AIcontrols.AIThrow();
         }
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 64)
     {
         AIHadoukenLimitsWithAttack(AIcontrols.AILowForward);
         decisionTimer = 0f;
     }
     else if (decision <= 69)
     {
         AIcontrols.AIPressedForward();
         character.SetBackPressed(false);
     }
     else if (decision <= 73)
     {
         AIcontrols.AIPressedForward();
         AIcontrols.AIJump();
         character.SetBackPressed(false);
         decisionTimer = 0f;
     }
     else if (decision <= 79)
     {
         sharedProperties.CharacterNeutralState();
         AIcontrols.AIJump();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else if (decision <= 82)
     {
         AIcontrols.AIPressedBackward();
         character.SetBackPressed(true);
     }
     else if (decision <= 87 && !animator.GetBool("isAttacking"))
     {
         AIJabShoryuken();
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
     else
     {
         AIHyakkishus(0, 2);
         sharedProperties.CharacterNeutralState();
         AIcontrols.DoesAIBlock();
         decisionTimer = 0f;
     }
 }
Exemple #4
0
 void RegularDecisionTree(List <string> decisionBox, int minDiv, int maxDiv)
 {
     DecisionMade(minDiv, maxDiv);
     if (decisionBox[decision] == "WalkForward" && !animator.GetBool("isAttacking"))
     {
         AIcontrols.AIStand();
         AIcontrols.AIPressedForward();
         character.SetBackPressed(false);
     }
     else if (decisionBox[decision] == "WalkBackward")
     {
         AIcontrols.AIStand();
         AIcontrols.AIPressedBackward();
         character.SetBackPressed(true);
     }
     else if (decisionBox[decision] == "Crouch")
     {
         AIcontrols.AICrouch();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
     else if (decisionBox[decision] == "NeutralJump" && !animator.GetBool("isAttacking"))
     {
         sharedProperties.CharacterNeutralState();
         AIcontrols.AIJump();
         character.SetBackPressed(false);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "ForwardJump" && !animator.GetBool("isAttacking"))
     {
         AIcontrols.AIPressedForward();
         AIcontrols.AIJump();
         character.SetBackPressed(false);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Roundhouse")
     {
         AIcontrols.AIRoundhouse(2, 0);
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Fierce")
     {
         AIcontrols.AIFierce(2, 0);
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Forward")
     {
         AIcontrols.AIForward(2);
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Strong")
     {
         AIcontrols.AIStrong(10);
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Short")
     {
         AIcontrols.AIShort(40);
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Jab")
     {
         AIcontrols.AIJab(50);
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "LowForward")
     {
         AIcontrols.AILowForward();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Sweep")
     {
         AIcontrols.AISweep();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "ScissorKick")
     {
         if (chargeSystem.GetBackCharged() && !animator.GetBool("isAttacking"))
         {
             AIScissorKicks();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIForward(2);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "PsychoCrusher")
     {
         if (chargeSystem.GetDownCharged() && !animator.GetBool("isAttacking"))
         {
             AIPsychoCrushers();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AILightAttacks(50, 1);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "HeadStomp")
     {
         if (chargeSystem.GetDownCharged() && !animator.GetBool("isAttacking"))
         {
             AIHeadStomps();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AILightAttacks(50, 1);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "DevilsReverse")
     {
         if (chargeSystem.GetDownCharged() && !animator.GetBool("isAttacking"))
         {
             AIDevilsReverses();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AILightAttacks(50, 0);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "SpecialCancelScissorKick")
     {
         if (chargeSystem.GetBackCharged())
         {
             AIScissorKicks();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIForward(2);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "SpecialCancelPsychoCrusher")
     {
         if (chargeSystem.GetBackCharged())
         {
             AIPsychoCrushers();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AILightAttacks(50, 1);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "SpecialCancelHeadStomp")
     {
         if (chargeSystem.GetDownCharged())
         {
             AIHeadStomps();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AILightAttacks(50, 1);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "SpecialCancelDevilsReverse")
     {
         if (chargeSystem.GetDownCharged())
         {
             AIDevilsReverses();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AILightAttacks(50, 0);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         decisionTimer = 0f;
     }
     else if (decisionBox[decision] == "Super")
     {
         if (character.GetSuper >= 100f)
         {
             AIKneePressNightmares();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AICrouch();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
     }
     else if (decisionBox[decision] == "SuperOnBlock")
     {
         if (character.GetSuper >= 100f)
         {
             AIKneePressNightmares();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIForward(3);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
     }
     else if (decisionBox[decision] == "SuperOnHit")
     {
         if (character.GetSuper >= 100f)
         {
             AIKneePressNightmares();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIForward(10);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
     }
     else if (decisionBox[decision] == "Throw")
     {
         AIcontrols.AIThrow();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
     else if (decisionBox[decision] == "AirStrong")
     {
         AIcontrols.AIJumpStrong();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
     else if (decisionBox[decision] == "AirForward")
     {
         AIcontrols.AIJumpForwardAttack();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
     else if (decisionBox[decision] == "AirFierce")
     {
         AIcontrols.AIJumpFierce();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
     else if (decisionBox[decision] == "AirRoundhouse")
     {
         AIcontrols.AIJumpRoundhouse();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
 }
 public void Behaviors()
 {
     decisionTimer--;
     antiAirTimer--;
     if (AIcontrols.FreeToMakeDecisions() && !TimeControl.inSuperStartup[0] && !TimeControl.inSuperStartup[1])
     {
         if (animator.GetBool("isAirborne") == true && animator.GetBool("isLiftingOff") == false)
         {
             decision = Random.Range(0, 100);
             if (decision <= 3)
             {
                 AIcontrols.AIJumpFierce();
                 sharedProperties.CharacterNeutralState();
             }
             else if (decision <= 6 && decision > 3)
             {
                 AIcontrols.AIJumpRoundhouse();
                 sharedProperties.CharacterNeutralState();
             }
         }
         else if (sharedProperties.GetAbDistanceFromOtherFighter() >= 2f)
         {
             RegularFarRangeDecisions();
         }
         else if (sharedProperties.GetAbDistanceFromOtherFighter() < 2f && sharedProperties.GetAbDistanceFromOtherFighter() >= 1f)
         {
             if (player != null)
             {
                 if (playerCharacter.GetBlockStunned() == true)
                 {
                     MidRangeOtherFighterBlockedDecisions();
                 }
                 else if (playerCharacter.GetKnockDown() == true && playerCharacter.GetAirborne() == false)
                 {
                     KnockDownMidRangeDecisions();
                 }
                 else
                 {
                     RegularMidRangeDecisions();
                 }
             }
             else if (opponent != null)
             {
                 if (opponentCharacter.GetBlockStunned() == true)
                 {
                     MidRangeOtherFighterBlockedDecisions();
                 }
                 else if (opponentCharacter.GetKnockDown() == true && opponentCharacter.GetAirborne() == false)
                 {
                     KnockDownMidRangeDecisions();
                 }
                 else
                 {
                     RegularMidRangeDecisions();
                 }
             }
         }
         else
         {
             if (player != null)
             {
                 //anti air
                 if (playerCharacter.GetAirborne() == true && playerCharacter.GetKnockDown() == false && playerCharacter.GetThrown() == false)
                 {
                     if (antiAirTimer <= 0f)
                     {
                         sharedProperties.AIAntiAirDecision(67, RegularCloseRangeDecisions, PreparationForAntiAir);
                         antiAirTimer = antiAirTimerInput;
                     }
                     else
                     {
                         RegularCloseRangeDecisions();
                     }
                 }
                 //other guy got hit
                 else if (playerCharacter.GetHitStunned() == true)
                 {
                     OtherFighterGotHitDecisions();
                 }
                 //other guy got knocked down
                 else if (playerCharacter.GetKnockDown() == true && playerCharacter.GetAirborne() == false)
                 {
                     KnockDownCloseRangeDecisions();
                 }
                 //other guy blocked
                 else if (playerCharacter.GetBlockStunned() == true)
                 {
                     CloseRangeOtherFighterBlockedDecisions();
                 }
                 else
                 {
                     RegularCloseRangeDecisions();
                 }
             }
             else if (opponent != null)
             {
                 //anti air
                 if (opponentCharacter.GetAirborne() == true && opponentCharacter.GetKnockDown() == false && opponentCharacter.GetThrown() == false)
                 {
                     if (antiAirTimer <= 0f)
                     {
                         sharedProperties.AIAntiAirDecision(67, RegularCloseRangeDecisions, PreparationForAntiAir);
                         antiAirTimer = antiAirTimerInput;
                     }
                     else
                     {
                         RegularCloseRangeDecisions();
                     }
                 }
                 //other guy got hit
                 else if (opponentCharacter.GetHitStunned() == true)
                 {
                     OtherFighterGotHitDecisions();
                 }
                 //other guy got knocked down
                 else if (opponentCharacter.GetKnockDown() == true && opponentCharacter.GetAirborne() == false)
                 {
                     KnockDownCloseRangeDecisions();
                 }
                 //other guy blocked
                 else if (opponentCharacter.GetBlockStunned() == true)
                 {
                     CloseRangeOtherFighterBlockedDecisions();
                 }
                 else
                 {
                     RegularCloseRangeDecisions();
                 }
             }
         }
         AIcontrols.AIWalks();
     }
 }
Exemple #6
0
 void RegularFarRangeDecisions()
 {
     DecisionMade(5, 1);
     if (decision <= 15)
     {
         AIcontrols.AIStand();
         AIcontrols.AIPressedForward();
         character.SetBackPressed(false);
     }
     else if (decision <= 17 && decision > 15)
     {
         AIcontrols.AIPressedForward();
         AIcontrols.AIJump();
         character.SetBackPressed(false);
     }
     else if (decision <= 19 && decision > 17)
     {
         sharedProperties.CharacterNeutralState();
         AIcontrols.AIJump();
         character.SetBackPressed(false);
     }
     else if (decision <= 71 && decision > 19)
     {
         AIcontrols.AICrouch();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
     }
     else if (decision <= 78 && decision > 71)
     {
         if (chargeSystem.GetBackCharged() && !animator.GetBool("isAttacking"))
         {
             AIKickRushesShortOrForward();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIShort(2);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
             decisionTimer = 0f;
         }
     }
     else if (decision <= 85 && decision > 78)
     {
         if (chargeSystem.GetBackCharged() && !animator.GetBool("isAttacking"))
         {
             AIDashLowJabOrStrong();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIJab(4);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
             decisionTimer = 0f;
         }
     }
     else if (decision <= 88 && decision > 85)
     {
         if (chargeSystem.GetBackCharged() && !animator.GetBool("isAttacking"))
         {
             AIDashStraightJabOrStrong();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIStrong(5);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
             decisionTimer = 0f;
         }
     }
     else if (decision <= 91 && decision > 88)
     {
         if (chargeSystem.GetDownCharged() && !animator.GetBool("isAttacking"))
         {
             AIHeadButt();
             AIcontrols.AICharges();
             character.SetBackPressed(true);
         }
         else
         {
             AIcontrols.AIFierce(1, 1);
             AIcontrols.AICharges();
             character.SetBackPressed(true);
             decisionTimer = 0f;
         }
     }
     else
     {
         AITurnPunches();
         AIcontrols.AICharges();
         character.SetBackPressed(true);
         decisionTimer = 0f;
     }
 }