Ejemplo n.º 1
0
 bool RewardPlayer(MichaelPlayerController player)
 {
     if (player == player1)
     {
         if (!player1RoundPoint1.Active && !player1RoundPoint2.Active)
         {
             player1RoundPoint1.Active = true;
             VictoryMark2.enabled      = true;
         }
         else if (player1RoundPoint1.Active && !player1RoundPoint2.Active)
         {
             player1RoundPoint2.Active = true;
             VictoryMark1.enabled      = true;
         }
         else if (player1RoundPoint1.Active && player1RoundPoint2.Active)
         {
             player1VictoryPoints.victoryPoints++;
             ResetMarks();
             return(true);
         }
     }
     else if (player == player2)
     {
         if (!player2RoundPoint1.Active && !player2RoundPoint2.Active)
         {
             player2RoundPoint1.Active = true;
             VictoryMark4.enabled      = true;
         }
         else if (player2RoundPoint1.Active && !player2RoundPoint2.Active)
         {
             player2RoundPoint2.Active = true;
             VictoryMark3.enabled      = true;
         }
         else if (player2RoundPoint1.Active && player2RoundPoint2.Active)
         {
             player2VictoryPoints.victoryPoints++;
             ResetMarks();
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
    public void getHitBy(int damage, float stunTime, string attack = "")
    {
        MichaelPlayerController michaelPlayerController = parentObject.GetComponent <MichaelPlayerController>();

        michaelPlayerController.TakeDamage(damage);
        michaelPlayerController.StunPlayer(stunTime);

        if (attack == "light")
        {
            michaelPlayerController.anim.SetTrigger("facehit");
        }
        else if (attack == "medium")
        {
            michaelPlayerController.anim.SetTrigger("bodyhit");
        }
        else if (attack == "heavy")
        {
            michaelPlayerController.anim.SetTrigger("knockdown");
            if (michaelPlayerController.CurrentHealth <= 0)
            {
                michaelPlayerController.anim.SetBool("dead", true);
            }
        }
        else if (attack == "throw")
        {
            michaelPlayerController.anim.SetTrigger("pushed");
        }
        else if (attack == "parry")
        {
            if (transform.parent.localScale.x > 0)
            {
                Instantiate(spark, new Vector2(transform.position.x + 2.5f, transform.position.y), Quaternion.identity);
            }
            else
            {
                Instantiate(spark, new Vector2(transform.position.x - 2.5f, transform.position.y), Quaternion.identity);
            }
            michaelPlayerController.PlaySound("Parry");
        }

        Debug.Log("I got hit");
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (!RoundIsFinished())
        {
            return;
        }
        if (RoundIsFinished())
        {
            if (timerStarted)
            {
                if (!TimerFinished())
                {
                    return;
                }
                else
                {
                    timerStarted = false;
                    victoryTimer = 0f;

                    MichaelPlayerController winner = DetermineWinner();

                    winner.anim.SetBool("victory", false);
                    winner.enemyScript.anim.SetBool("dead", false);
                    ActivatePlayers();

                    if (winner == null)
                    {
                        ResetRound();
                        return;
                    }

                    if (RewardPlayer(winner))
                    {
                        ResetGame();
                        return;
                    }
                    else
                    {
                        ResetRound();
                        return;
                    }
                }
            }
            else
            {
                timerStarted = true;
                MichaelPlayerController winner = DetermineWinner();

                winner.anim.SetBool("victory", true);
                winner.PlaySound("Victory1");

                winner.enemyScript.anim.SetTrigger("death");
                winner.enemyScript.anim.SetBool("dead", true);

                DisablePlayers();
            }
        }



        /*if (CheckTimer())
         * {
         *  return;
         * }
         * if(RoundIsFinished() && hasNotDisabled)
         * {
         *  timerStarted = true;
         *  hasNotDisabled = false;
         *  player1.anim.SetBool("victory", true);
         *  player2.anim.SetBool("dead", true);
         * }
         * else if(RoundIsFinished() && !hasNotDisabled)
         * {
         *
         * }
         * if(RoundIsFinished())
         * {
         *  Debug.Log("Round finished");
         *  DisablePlayers();
         *
         *  MichaelPlayerController winner = DetermineWinner();
         *
         *  if(winner == null)
         *  {
         *      DisablePlayers();
         *      if (CheckTimer())
         *      {
         *
         *          ResetRound();
         *          ActivatePlayers();
         *      }
         *      return;
         *  }
         *
         *  if (RewardPlayer(winner))
         *  {
         *      ResetGame();
         *  }
         *  else
         *  {
         *      DisablePlayers();
         *
         *      if (CheckTimer())
         *      {
         *          ResetRound();
         *          ActivatePlayers();
         *
         *      }
         *      return;
         *  }
         * }*/
    }