Beispiel #1
0
    public IEnumerator ParentDiscardCardsToDeckObject(GameObject playerAreas, ActionMarker.ActionSprite action)
    {
        GameObject deckObject    = playerAreas.transform.Find("Deck").gameObject;
        GameObject discardObject = playerAreas.transform.Find("Discard").gameObject;

        ActionMarker actionMarker = playerAreas.GetComponentInChildren <ActionMarker> ();

        actionMarker.SetMarker(action);
        yield return(new WaitForSeconds(1));


        bool  showFace = false;
        float xOffset  = 0;
        float yOffset  = 0.5f;

        yield return(MoveCardsAnimation(discardObject, deckObject, showFace, xOffset, yOffset));

        yield return(new WaitUntil(() => discardObject.transform.childCount == 0));

        actionMarker.RemoveMarker();
    }
Beispiel #2
0
    // This function is an asynchronous coRoutine because all the animations need to finish before the code resumes
    public IEnumerator MoveBallAction(GameManager.Player movingPlayer, ActionMarker.ActionSprite action)
    {
        float ballAnimationTime = settingController.GetAnimationSpeed();
        float moveBy            = 2.1f;

        // Move only if the controlling team is the one moving
        if (movingPlayer == controllingTeam)
        {
            if (movingPlayer == GameManager.Player.A)
            {
                ActionMarker actionMarker = GameObject.Find("Player A Areas").GetComponentInChildren <ActionMarker> ();
                actionMarker.SetMarker(action);
                if (ballPosition == BallPosition.PlayerAField)
                {
                    iTween.MoveBy(gameObject, iTween.Hash("y", moveBy, "time", ballAnimationTime, "easeType", "easeInOutQuad"));
                    ballPosition = BallPosition.Middle;
                    yield return(new WaitForSeconds(ballAnimationTime));
                }
                else if (ballPosition == BallPosition.Middle)
                {
                    iTween.MoveBy(gameObject, iTween.Hash("y", moveBy, "time", ballAnimationTime, "easeType", "easeInOutQuad"));
                    ballPosition = BallPosition.PlayerBField;
                    yield return(new WaitForSeconds(ballAnimationTime));
                }
                else if (ballPosition == BallPosition.PlayerBField)
                {
                    iTween.MoveBy(gameObject, iTween.Hash("y", moveBy / 2, "time", ballAnimationTime, "easeType", "easeInOutQuad"));
                    ballPosition = BallPosition.PlayerBGoal;
                    yield return(new WaitForSeconds(ballAnimationTime));
                }
                actionMarker.RemoveMarker();
            }
            else               // movingPlayer == PlayerB
            {
                ActionMarker actionMarker = GameObject.Find("Player B Areas").GetComponentInChildren <ActionMarker> ();
                actionMarker.SetMarker(action);
                if (ballPosition == BallPosition.PlayerBField)
                {
                    iTween.MoveBy(gameObject, iTween.Hash("y", -moveBy, "time", ballAnimationTime, "easeType", "easeInOutQuad"));
                    ballPosition = BallPosition.Middle;
                    yield return(new WaitForSeconds(ballAnimationTime));
                }
                else if (ballPosition == BallPosition.Middle)
                {
                    iTween.MoveBy(gameObject, iTween.Hash("y", -moveBy, "time", ballAnimationTime, "easeType", "easeInOutQuad"));
                    ballPosition = BallPosition.PlayerAField;
                    yield return(new WaitForSeconds(ballAnimationTime));
                }
                else if (ballPosition == BallPosition.PlayerAField)
                {
                    iTween.MoveBy(gameObject, iTween.Hash("y", -(moveBy / 2), "time", ballAnimationTime, "easeType", "easeInOutQuad"));
                    ballPosition = BallPosition.PlayerAGoal;
                    yield return(new WaitForSeconds(ballAnimationTime));
                }
                actionMarker.RemoveMarker();
            }
        }
        else
        {
            yield return(SetControllingTeamAnimation(movingPlayer, action));
        }
    }