Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        currentCharacter = this.GetComponent <CharacterFeatures>();
        rivalCharacter   = rivalCharacters.transform.GetChild(0).GetComponent <CharacterFeatures>();
        characterActions = this.GetComponent <CharacterActions>();
        characterAssist  = characters.GetComponent <CharacterAssist>();
        animator         = currentCharacter.GetAnimator();
        rigidBody        = this.GetComponent <Rigidbody2D>();
        boxCollider      = this.GetComponent <BoxCollider2D>();

        /*AddRulesRivalAttacks();
         * AddRulesRivalIsHit();
         * AddRulesRivalIsBlock();
         * AddRulesRivalBackwards();
         * AddRulesRivalJumpingBackwards();
         * AddRulesRivalForwards();
         * AddRulesRivalJumpingForwards();
         * AddRulesRivalIdle();
         * AddRulesSwapCharacter();*/
    }
Exemplo n.º 2
0
 public static void CheckCharacterSwap(CharacterAssist assist, CharacterFeatures currentCharacter, GameObject characters)
 {
     if (!assist.GetSwapped())
     {
         float lifePercentage        = (float)currentCharacter.GetHealthBar().getHP() / currentCharacter.GetHealthBar().getMaxHP();
         float pointCharacterHealth  = currentCharacter.GetHealthBar().getHP();
         float secondCharacterHealth = characters.transform.GetChild(1).GetComponent <CharacterFeatures>().GetHealthBar().getHP();
         float thirdCharacterHealth  = characters.transform.GetChild(2).GetComponent <CharacterFeatures>().GetHealthBar().getHP();
         if (lifePercentage < 0.4)
         {
             if (pointCharacterHealth > secondCharacterHealth)
             {
                 if (pointCharacterHealth > thirdCharacterHealth)
                 {
                     ////Leave point character
                     conditions &= ~AIConditions.changeSecondCharacter;
                     conditions &= ~AIConditions.changeThirdCharacter;
                     conditions |= AIConditions.leavePointCharacter;
                 }
                 else
                 {
                     ///Change to third character
                     conditions &= ~AIConditions.leavePointCharacter;
                     conditions &= ~AIConditions.changeSecondCharacter;
                     conditions |= AIConditions.changeThirdCharacter;
                 }
             }
             else
             {
                 if (secondCharacterHealth >= thirdCharacterHealth)
                 {
                     ///Change to second character
                     conditions &= ~AIConditions.leavePointCharacter;
                     conditions &= ~AIConditions.changeThirdCharacter;
                     conditions |= AIConditions.changeSecondCharacter;
                 }
                 else
                 {
                     /// Change to third character
                     conditions &= ~AIConditions.leavePointCharacter;
                     conditions &= ~AIConditions.changeSecondCharacter;
                     conditions |= AIConditions.changeThirdCharacter;
                 }
             }
         }
         else
         {
             /// leave point character
             conditions &= ~AIConditions.changeSecondCharacter;
             conditions &= ~AIConditions.changeThirdCharacter;
             conditions |= AIConditions.leavePointCharacter;
         }
     }
     else
     {
         //// Reset all conditions
         conditions &= ~AIConditions.leavePointCharacter;
         conditions &= ~AIConditions.changeSecondCharacter;
         conditions &= ~AIConditions.changeThirdCharacter;
     }
 }