Ejemplo n.º 1
0
    /*
     * Loop
     *
     * called once per frame while active
     *
     * @param BaseAnimation.EdgeType edgeType - the type of animation to use
     * @returns void
     */
    public void Loop(BaseAnimation.EdgeType edgeType)
    {
        //determine what type of edge type to use in the loop function of the respective animations
        if (edgeType == BaseAnimation.EdgeType.ENTRY)
        {
            //turn on the game-object if it is off
            if (!gameObject.activeSelf)
            {
                gameObject.SetActive(true);
            }

            //get the size of the relevant animations list
            int animationCount = entries.Count;

            //iterate through all of the animations, looping each
            for (int i = 0; i < animationCount; i++)
            {
                entries[i].Loop();
            }
        }
        else if (edgeType == BaseAnimation.EdgeType.EXIT)
        {
            //get the size of the relevant animations list
            int animationCount = exits.Count;

            //iterate through all of the animations, looping each
            for (int i = 0; i < animationCount; i++)
            {
                exits[i].Loop();
            }

            //if the item has stopped and is still active
            if (gameObject.activeSelf && !IsAnimating())
            {
                gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 2
0
    /*
     * Loop
     *
     * called once per frame while active
     *
     * @returns void
     */
    public void Loop()
    {
        //determine the state of the menu
        if (state == BaseAnimation.EdgeType.NONE)
        {
            //do nothing?
        }
        else if (state == BaseAnimation.EdgeType.ENTRY)
        {
            //get the size of the items list
            int itemCount = items.Count;

            //iterate through the items, updating each with the correct input state
            for (int i = 0; i < itemCount; i++)
            {
                //store in a temp value
                Item item = items[i];

                item.Loop(BaseAnimation.EdgeType.ENTRY);
            }
        }
        else if (state == BaseAnimation.EdgeType.EXIT)
        {
            //get the size of the items list
            int itemCount = items.Count;

            //iterate through the items, updating each with the correct input state
            for (int i = 0; i < itemCount; i++)
            {
                //store in a temp value
                Item item = items[i];

                item.Loop(BaseAnimation.EdgeType.EXIT);
            }
        }


        //this block runs accross entry and exit states
        if (state == BaseAnimation.EdgeType.ENTRY || state == BaseAnimation.EdgeType.EXIT)
        {
            //flag identifying if animations are still running
            bool isRunning = false;

            //get the size of the items list
            int itemCount = items.Count;

            //iterate through the items, updating each with the correct input state
            for (int i = 0; i < itemCount; i++)
            {
                //store in a temp value
                Item item = items[i];

                if (item.IsAnimating())
                {
                    isRunning = true;
                }
            }

            //turn off the menu if it is no longer doing anything
            if (!isRunning)
            {
                //deactivate a menu on an exit animation
                if (state == BaseAnimation.EdgeType.EXIT)
                {
                    gameObject.SetActive(false);
                }

                state = BaseAnimation.EdgeType.NONE;
            }
        }
    }