Esempio n. 1
0
 // checks if two cards are in view and stores references to their associated character scripts
 // if there are two. If not two cards, reset certain booleans, etc.
 void CheckIfTwoCards()
 {
     if (cardsInPlay.Count == cardsNeededForGameToStart && ready == false) {
         character1 = cardsInPlay[0].transform.FindChild("Character");
         character2 = cardsInPlay[1].transform.FindChild("Character");
         char1behaviors = character1.GetComponent<CharacterBehaviors>();
         char2behaviors = character2.GetComponent<CharacterBehaviors>();
         char1behaviors.myPositionInControllerList = 0;
         char2behaviors.myPositionInControllerList = 1;
         ready = true;
         StartCoroutine(IntroStart());
     }
     if (cardsInPlay.Count != cardsNeededForGameToStart && ready == true) {
         ready = false;
         gameHasStarted = false;
         bell.GetComponent<Animation>().Stop();
         bell.SetActiveRecursively(false);
         crowdAudio.Stop();
     }
 }
Esempio n. 2
0
 // checks if two cards are in view and stores references to their associated character scripts
 // if there are two. If not two cards, reset certain booleans, etc.
 void CheckIfTwoCards()
 {
     if (cardsInPlay.Count == cardsNeededForGameToStart && ready == false)
     {
         character1     = cardsInPlay[0].transform;        //.transform.FindChild("Character");
         character2     = cardsInPlay[1].transform;        //.transform.FindChild("Character");
         char1behaviors = character1.GetComponent <CharacterBehaviors>();
         char2behaviors = character2.GetComponent <CharacterBehaviors>();
         char1behaviors.myPositionInControllerList = 0;
         char2behaviors.myPositionInControllerList = 1;
         ready = true;
         StartCoroutine(IntroStart());
     }
     if (cardsInPlay.Count != cardsNeededForGameToStart && ready == true)
     {
         ready          = false;
         gameHasStarted = false;
         bell.GetComponent <Animation>().Stop();
         bell.SetActive(false);
         crowdAudio.Stop();
     }
 }
    // uses individual character's attributes variables combined with random slight modification to
    // come up with damage per blow. Also does a random check for mega hit based on the particular
    // character's chances/attribute of that happening.
    public void CalculateDamageToOpponent()
    {
        if (null == FisticuffsController.Instance)
        {
            Debug.LogError("CharacterBehaviors::CalculateDamageToOpponent - FisticuffsController.Instance not set. Is there one in the scene?");
            return;
        }

        int myOpponentListNum = 0;

        if (myPositionInControllerList == 0)           // if I am position 0, opponent is position 1, otherwise it's vice versa and myOpponentListNum remains 0
        {
            myOpponentListNum = 1;
        }

        Transform          opponentCharacter = FisticuffsController.Instance.cardsInPlay[myOpponentListNum].transform;
        CharacterBehaviors opponentBehaviors = opponentCharacter.gameObject.GetComponent <CharacterBehaviors>();

        float randomDamageModifier  = Random.Range(-1.0f, 1.0f);
        float randomDefenseModifier = Random.Range(-.1f, .1f);

        float damageBeforeDefense = (damageGivenPerPunch + randomDamageModifier);
        float damageCalc          = damageBeforeDefense - (opponentBehaviors.defenseModifier * damageBeforeDefense);

        float damageFinal;
        int   rollForMassiveHit = Random.Range(0, 1001);

        if (rollForMassiveHit <= chanceOfMassiveHit)
        {
            damageFinal = FisticuffsController.Instance.megaDamageAmount;
        }
        else
        {
            damageFinal = damageCalc;
        }

        opponentBehaviors.ReceiveDamage(damageFinal);
    }
Esempio n. 4
0
 void Start()
 {
     characterBehvaiors = gameObject.GetComponentInParent <CharacterBehaviors>();
 }
Esempio n. 5
0
 void Start()
 {
     characterBehvaiors = gameObject.GetComponentInParent<CharacterBehaviors>();
 }