Ejemplo n.º 1
0
    /// <summary>
    /// Called at the start, used to setup / default values
    /// </summary>
    /// <returns></returns>
    public bool OnStartFunction()
    {
        m_CurrentJumps = 0;
        m_MovementToNode.RunStart();

        return(false);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Main update running the game
    ///
    /// Manages all animations
    /// </summary>
    public void Update()
    {
        //Quits Application
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        //If we have an animation in the list, call its update, if it returns true, it's finished and wants to be dequeued and remove from the currently updating list
        if (m_Animations.Count > 0)
        {
            if (m_Animations.Peek().RunUpdate() == true)
            {
                m_Animations.Dequeue();

                if (m_Animations.Count > 0)
                {
                    //If there's another animation, prep it to run
                    m_Animations.Peek().RunStart();
                }
            }
        }
        else         //If we dont have anymore animations, attempt to move to the next player
        {
            //Keep a reference of the next player
            Player m_CurrentPlayer = m_Players[NextPlayer()];

            //If he doesn't have any jail-time, load up the dice roll animation for him
            if (m_CurrentPlayer.m_DaysLeftInJail <= 0)
            {
                AddToAnimationQueue(new RollManager(m_CurrentPlayer));
                m_Animations.Peek().RunStart();
            }
            else             //If he does have jail time, post a message displaying the jail time and deincrement his jailtime by a day
            {
                CustomAnimation m_TempCustomAnimation = new StatusScreen("Spent the Day in Jail - Wait " + m_CurrentPlayer.m_DaysLeftInJail + " Days For Release", 2.0f);
                m_TempCustomAnimation.RunStart();

                AddToAnimationQueue(m_TempCustomAnimation);
                WriteToLog("Player: " + m_CurrentPlayer.name + " Spent the day in Jail");
                m_CurrentPlayer.m_DaysLeftInJail--;

                //If the player has moved out of jail, move him to visiting
                if (m_CurrentPlayer.m_DaysLeftInJail <= 0)
                {
                    m_TempCustomAnimation = new PlayerMovementToNode(m_CurrentPlayer, transform.FindChild("Just Visiting").GetComponent <Node>(), 1.0f);
                    m_TempCustomAnimation.RunStart();

                    AddToAnimationQueue(m_TempCustomAnimation);
                }
            }
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Update function used to check if the animation that's currently being run has finished, if it has, check if enough spots have moved, if so quit the animation.
    /// Otherwise, repeat
    /// </summary>
    /// <returns>Returns true if finished</returns>
    public bool OnUpdateFunction()
    {
        //Checks the sub-animation thats moving to the next node has finished
        if (m_MovementToNode.RunUpdate() == true)
        {
            //If it has finished, increase the jumps
            m_CurrentJumps++;

            //Check if the jumps is greater then the goal, if it is, break out of the animation
            if (m_CurrentJumps >= m_JumpGoal)
            {
                return(true);
            }

            //If we didn't break previous that means we need to do another lap, recreate the subanimation
            m_MovementToNode = new PlayerMovementToNode(m_Player, m_Player.m_CurrentNode.m_NextNode, c_ANIMATION_SPEED);
            m_MovementToNode.RunStart();
        }

        //Didn't finish, return false
        return(false);
    }