Example #1
0
 public static void LerpToView(RaycastHit hit) //Called by CheckClick below. Changes UI pannels and lerps to the position of the clicked cube
 {
     GameBrain.ChangeAcceptInput(false);
     UIMaster.FadePhanel((int)UIPannels.Action);
     UIMaster.FadePhanel((int)UIPannels.View);
     TopDownCamera.Instance.StartCoroutine(TopDownCamera.LerpToPosition(hit.transform.position, hit.transform.rotation));
 }
Example #2
0
 public static void ExitView() //Returns to the camera to the position is=t was at before clicking on the cube and switches the UI back
 {
     TopDownCamera.Instance.StartCoroutine(TopDownCamera.LerpToPosition(PlayerMaster.CurrentPlayer.CameraPosistion, PlayerMaster.CurrentPlayer.CameraRotation));
     TopDownCamera.AllowMovement(true);
     UIMaster.FadePhanel((int)UIPannels.Action);
     UIMaster.FadePhanel((int)UIPannels.View);
     GameBrain.ChangeAcceptInput(true);
 }
Example #3
0
    private static IEnumerator MoveToCannon()
    {
        if (!currentCannon.C.Moved)
        {
            HighlightMaster.HighlightUnitToggle(false, currentCannon.C);
        }

        yield return(TopDownCamera.LerpToPosition(currentCannon.CameraPos[0].transform.position, currentCannon.CameraPos[0].transform.rotation));

        currentCannon.CannonCam.GetComponent <Camera>().enabled = true;
        TopDownCamera.Instance.GetComponent <Camera>().enabled  = false;

        UIMaster.FadePhanel((int)UIPannels.Cannon);
        // UIMaster.TogglePanelLock(false, (int)UIPannels.Action);
        UIMaster.FadePhanel((int)UIPannels.Action);
    }
Example #4
0
    static IEnumerator Fight() //Handles and manages the FightScene
    {
        gP = GamePhase.Attack;

        while (AttackMaster.CombatCount != 0)
        {
            float rotation;
            if (PlayerMaster.CurrentTurn == 0)
            {
                rotation = 180;
            }
            else
            {
                rotation = 0;
            }

            instance.StartCoroutine(TopDownCamera.LerpToPosition(AttackMaster.CenterOfCombat(), Quaternion.Euler(90, rotation, 0)));
            yield return(new WaitForSeconds(2.0f));               //Wait to give the player a chance to see stuff

            instance.StartCoroutine(UIMaster.MoveCurtains(true)); //lower curtains
            yield return(null);                                   //Wait at least one frame so that UIMaster.MovingCurtians can change value

            while (UIMaster.MovingCurtains)
            {
                yield return(null);
            }

            List <Unit> currentCombat = AttackMaster.CurrentCombatArea;
            List <Unit> toKill        = AttackMaster.FightResults();
            FightSceneMaster.SetUpFight(currentCombat, toKill);    //Prepare the fightscene

            yield return(new WaitForSeconds(1.0f));                //Pause for dramatic effect

            instance.StartCoroutine(UIMaster.MoveCurtains(false)); //Raise Curtains
            yield return(null);

            while (UIMaster.MovingCurtains)
            {
                yield return(null);
            }

            SoundMaster.AttackCharge();
            instance.StartCoroutine(FightSceneMaster.ToBattle()); //Begins FightScene
            yield return(null);                                   //Wait at least one frame so that FightSceneMaster.Fighting can change value

            while (FightSceneMaster.Fighting)
            {
                yield return(null);
            }

            //SoundMaster.AttackResolution();
            instance.StartCoroutine(UIMaster.MoveCurtains(true)); //Lower curtains again
            yield return(null);                                   //Wait at least one frame so that UIMaster.MovingCurtians can change value

            while (UIMaster.MovingCurtains)
            {
                yield return(null);
            }

            FightSceneMaster.CleanUp();                            //Resets FightScene

            yield return(new WaitForSeconds(0.25f));               //Pause

            instance.StartCoroutine(UIMaster.MoveCurtains(false)); //Raise curtains
            yield return(new WaitForFixedUpdate());                //Wait at least one frame so that UIMaster.MovingCurtians can change value

            while (UIMaster.MovingCurtains)
            {
                yield return(null);
            }

            yield return(new WaitForSeconds(1.0f));

            foreach (Unit u in toKill)
            {
                PlayerMaster.KillUnit(u);           //Kills dead units
            }
            yield return(new WaitForSeconds(1.0f)); //Pause to see aftermath
        }

        //return to player's position after the fight
        instance.StartCoroutine(TopDownCamera.LerpToPosition(PlayerMaster.CurrentPlayer.CameraPosistion, PlayerMaster.CurrentPlayer.CameraRotation));

        DeactivateCannonByMove(PlayerMaster.OtherPlayer);

        if (PlayerMaster.CurrentTurn == 0)
        {
            HighlightMaster.HighlightMovable(PlayerMaster.OtherPlayer);
        }

        UIMaster.DisplayScore();

        // WinByMove();

        UIMaster.SetActionPanel(true); //Turns action pannel back on
        UIMaster.FadePhanel((int)UIPannels.Action);

        CannonMaster.CheckCannonCapture();

        gP = GamePhase.Move;
        yield return(ChangeTurn());

        acceptInput = true;
    }