예제 #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));
 }
예제 #2
0
    void Start()
    {
        GameBrain.ChangeAcceptInput(false);
        TopDownCamera.AllowMovement(false);
        instance    = this;
        tm          = new TutorialUIMaster();
        t_ai        = new TutorialAI();
        acceptInput = false;
        ai_turn     = false;
        image_on    = false;
        turn_button = GameObject.Find("PlayerPanel").GetComponent <Button>();
        d_markers   = GameObject.Find("DeployMarkers");
        d_markers.SetActive(false);

        UIMaster.SetActionPanel(false);

        phase       = T_Phases.Introduction;
        whichText   = 0;
        phaselength = TutorialUIMaster.TutorialText[(int)phase].Length;
        TutorialUIMaster.ChangeText((int)phase, whichText);

        GameObject.Find("Back Button").GetComponent <Button>().onClick.AddListener(BackText);
        GameObject.Find("Forward Button").GetComponent <Button>().onClick.AddListener(ForwardText);
        GameObject.Find("Continue Button").GetComponent <Button>().onClick.AddListener(PlayersTurn);
        GameObject.Find("Raise Button").GetComponent <Button>().onClick.AddListener(RaiseBox);
    }
예제 #3
0
    public static IEnumerator Move()
    {
        GameBrain.ChangeAcceptInput(false);
        yield return(new WaitForSeconds(1.0f));

        HexCell moveTo;

        for (int i = 0; i < ai_units.Count; ++i)
        {
            if (ai_units[i] != null)
            {
                HexCell unit_cell = ai_units[i].CurrentHex;
                MoveMaster.SetTarget(ai_units[i]);
                moveTo = MapMaster.Map[ai_units[i].CurrentHex.R - 2, ai_units[i].CurrentHex.Q];
                MoveMaster.EvaluateTile(moveTo); //Actually moves unit
            }
        }
        yield return(new WaitForSeconds(.75f));

        while (MoveMaster.movingUnits != 0)
        {
            yield return(null);
        }

        yield return(GameBrain.ChangeTurn());
        //GameBrain.ChangeAcceptInput(true);
    }
예제 #4
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);
 }
예제 #5
0
    public static IEnumerator IDontHaveCannons()
    {
        GameBrain.ChangeAcceptInput(false);
        yield return(new WaitForSeconds(2.0f));

        yield return(GameBrain.ChangeTurn());
        //GameBrain.ChangeAcceptInput(true);
    }
예제 #6
0
    public static IEnumerator DeployUnitsCoroutine()
    {
        GameBrain.ChangeAcceptInput(false);
        string  prefabpath = "Prefabs/";
        string  prefabName;
        HexCell h;

        foreach (UnitOrder uO in instance.uoList)
        {
            yield return(new WaitForSeconds(0.1f));

            h           = MapMaster.Map[uO.R, uO.Q];
            prefabName  = ((UnitTypes)uO.unitType).ToString();
            prefabName += prefabName == "Cannon" ? "" : PlayerMaster.CurrentTurn.ToString();

            Unit u = ((GameObject)GameObject.Instantiate(Resources.Load(prefabpath + prefabName), h.SpawnVector, Quaternion.identity)).GetComponent <Unit>();

            u.UDirection = (int)(PlayerMaster.CurrentTurn == 0 ? UnitRotations.half : UnitRotations.none);
            u.Player     = PlayerMaster.CurrentTurn;
            u.gameObject.transform.rotation = u.URotation();

            MapMaster.Map[uO.R, uO.Q].Unit            = u;
            MapMaster.Map[uO.R, uO.Q].Unit.CurrentHex = MapMaster.Map[uO.R, uO.Q];


            switch (uO.unitType)
            {
            case (0):
                PlayerMaster.CurrentPlayer.Inf.Add(u);
                break;

            case (1):
                PlayerMaster.CurrentPlayer.Cav.Add(u);
                break;

            case (2):
                Cannon c = (Cannon)u;
                c.shots = 0;
                PlayerMaster.CurrentPlayer.Can.Add(c);
                break;
            }

            GameObject.Destroy(uO.icon);

            ScoreMaster.GivePoints(ScoreMaster.PointValues[uO.unitType], u.Player);

            UIMaster.DisplayScore();
        }

        instance.uoList.Clear();
        RefreshUnitsUsed();
        GameBrain.ChangeAcceptInput(true);
    }
예제 #7
0
 public static IEnumerator Deploy()
 {
     GameBrain.ChangeAcceptInput(false);
     for (int i = 19; i < 29; ++i)
     {
         GameObject g = (GameObject)GameObject.Instantiate(Resources.Load("prefabs/Infantry1"), PlayerMaster.CurrentPlayer.backLine[i].SpawnVector, Quaternion.identity);
         ai_units.Add(g.GetComponent <Unit>());
         MapMaster.Map[PlayerMaster.CurrentPlayer.backLine[i].R, PlayerMaster.CurrentPlayer.backLine[i].Q].Unit            = g.GetComponent <Unit>();
         MapMaster.Map[PlayerMaster.CurrentPlayer.backLine[i].R, PlayerMaster.CurrentPlayer.backLine[i].Q].Unit.Player     = 1;
         MapMaster.Map[PlayerMaster.CurrentPlayer.backLine[i].R, PlayerMaster.CurrentPlayer.backLine[i].Q].Unit.CurrentHex = PlayerMaster.CurrentPlayer.backLine[i];
         PlayerMaster.CurrentPlayer.Inf.Add(g.GetComponent <Unit>());
         yield return(new WaitForSeconds(0.2f));
     }
     //GameObject cannon = (GameObject)GameObject.Instantiate(Resources.Load("prefabs/Cannon"), PlayerMaster.CurrentPlayer.backLine[30].SpawnVector, Quaternion.identity);
     yield return(GameBrain.ChangeTurn());
     //GameBrain.ChangeAcceptInput(true);
 }