Example #1
0
 public AttackModeChange(float totalTime, UIMaster shape, Type type)
 {
     this.totalTime = totalTime;
     this.timeLeft  = totalTime;
     this.shape     = shape;
     this.type      = type;
 }
Example #2
0
    // Changes the phase and updates the UI as needed
    public static IEnumerator ChangeTurn()
    {
        UIMaster.SetActionPanel(false);

        yield return(AlterState()); // pauses before executing the rest of the code based on phase.

        if (PlayerMaster.PriorTurn == 0)
        {
            yield return(EndofRound());
        }

        if (gP != GamePhase.Attack)
        {
            PlayerMaster.SwitchPlayer();
            TopDownCamera.ChangePlayerCamera();
        }

        UIMaster.ChangeDisplayedPlayer();
        UIMaster.ChangePlayerDeploy(gP);
        UIMaster.DisplayState(gP, PlayerMaster.CurrentTurn);

        turnNum++;

        yield return(null);
    }
    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);
    }
Example #4
0
    private UIMaster getShape(Direction code)
    {
        UIMaster ret = null;

        switch (code)
        {
        case Direction.Up:
            ret = top;
            break;

        case Direction.Right:
            ret = right;
            break;

        case Direction.Down:
            ret = bottom;
            break;

        case Direction.Left:
            ret = left;
            break;
        }

        return(ret);
    }
Example #5
0
    private void HandleFly()
    {
        //  Show/hide cursor
        if (Input.GetMouseButton(1))
        {
            Cursor.lockState = CursorLockMode.Locked;
        }
        else
        {
            Cursor.visible = true; Cursor.lockState = CursorLockMode.None;
        }

        // Rotation
        if (Input.GetMouseButton(1))
        {
            Vector2 mouseMovement = Vector3.zero;

            if (UIMaster.GetState() != UIState.FOCUSED)
            {
                mouseMovement = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1));

                //  Show/hide cursor
                if (Input.GetMouseButton(1))
                {
                    Cursor.lockState = CursorLockMode.Locked;
                }
                else
                {
                    Cursor.visible = true; Cursor.lockState = CursorLockMode.None;
                }
            }

            float mouseSensitivityFactor = mouseSensitivityCurve.Evaluate(mouseMovement.magnitude);
            m_TargetCameraState.yaw   += mouseMovement.x * mouseSensitivityFactor;
            m_TargetCameraState.pitch += mouseMovement.y * mouseSensitivityFactor;
        }

        // Translation
        Vector3 translation = GetInputTranslationDirection() * Time.deltaTime;

        // Speed up movement when shift key held
        if (Input.GetButton("Sprint"))
        {
            translation *= 10.0f;
        }

        // Modify movement by a boost factor (defined in Inspector and modified in play mode through the mouse scroll wheel)
        boost       += Input.mouseScrollDelta.y * 0.2f;
        translation *= Mathf.Pow(2.0f, boost);

        m_TargetCameraState.Translate(translation);

        // Framerate-independent interpolation
        float positionLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / positionLerpTime) * Time.deltaTime);
        float rotationLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / rotationLerpTime) * Time.deltaTime);

        m_InterpolatingCameraState.LerpTowards(m_TargetCameraState, positionLerpPct, rotationLerpPct);

        m_InterpolatingCameraState.UpdateTransform(transform);
    }
Example #6
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 #7
0
        private static void GenerateDataBridge(UIMaster master)
        {
            var templateFile     = Path.Combine(PanelTemplatePath, "Generated", "#PanelName#DataBridge.lua");
            var templateContents = File.ReadAllText(templateFile);
            var outputFile       = templateFile.Replace("@PanelTemplate", master.name).Replace("#PanelName#", master.name);

            if (File.Exists(outputFile))
            {
                File.SetAttributes(outputFile, FileAttributes.Normal);
                File.Delete(outputFile);
            }
            var outputContents = templateContents.Replace("#PanelName#", master.name);

            WriteAllText(outputFile, outputContents);
            File.SetAttributes(outputFile, FileAttributes.ReadOnly);

            var privateFile       = Path.Combine(PanelTemplatePath, "Private", "#PanelName#DataBridge.lua");
            var privateContents   = File.ReadAllText(privateFile);
            var outputPrivateFile = privateFile.Replace("@PanelTemplate", master.name).Replace("#PanelName#", master.name);

            if (File.Exists(outputPrivateFile) == false)
            {
                var outputPrivateContents = privateContents.Replace("#PanelName#", master.name);
                WriteAllText(outputPrivateFile, outputPrivateContents);
            }
        }
Example #8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PageName")] UIMaster uIMaster)
        {
            if (id != uIMaster.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(uIMaster);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UIMasterExists(uIMaster.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(uIMaster));
        }
    public static void CleanUp() //Resets the FightScene for next time
    {
        GameObject smokeCloud = GameObject.Find("SmokeCloud");

        smokeCloud.transform.localScale = new Vector3(0.1f, 0.1f, 1); //Resets size of the smoke cloud
        GameObject p1Side = GameObject.Find("Player1Units");
        GameObject p2Side = GameObject.Find("Player2Units");
        GameObject winner = GameObject.Find("Winner");

        p1Side.GetComponent <RectTransform>().anchoredPosition = p1Start; //Resets the position of P1's units
        p2Side.GetComponent <RectTransform>().anchoredPosition = p2Start; //Similiar comment

        for (int i = p1Side.transform.childCount - 1; i >= 0; --i)        //Removes pictures
        {
            GameObject.Destroy(p1Side.transform.GetChild(i).gameObject);
        }
        for (int i = p2Side.transform.childCount - 1; i >= 0; --i)
        {
            GameObject.Destroy(p2Side.transform.GetChild(i).gameObject);
        }
        for (int i = winner.transform.childCount - 1; i >= 0; --i)
        {
            GameObject.Destroy(winner.transform.GetChild(i).gameObject);
        }

        UnitDict.Clear();                   //Clears dictionary]
        UIMaster.SetFightScenePanel(false); //Turns off the canvas for the FightScene
        UIMaster.SetPanelAlpha(false, (int)UIPannels.Fight);
    }
Example #10
0
    public static void SetTutorialTiles()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0) /*&& Events.GetComponent<Pause>().paused == false*/)
        {
            Ray        ray;
            RaycastHit hit;
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {
                string[] index;
                if ((hit.transform.tag == "I" && instance.toSpawnUnit == 0) ||
                    (hit.transform.tag == "CV" && instance.toSpawnUnit == 1) ||
                    (hit.transform.tag == "CN" && instance.toSpawnUnit == 2)) //toSpawnUnit is the same unit as the required unit of the hexcell they clicked on
                {
                    index = hit.transform.gameObject.name.Split('_');
                    HexCell h   = MapMaster.Map[int.Parse(index[0]), int.Parse(index[1])];
                    int     tSU = instance.toSpawnUnit;
                    instance.unitsUsed[tSU]--;
                    instance.uoList.Add(new UnitOrder(h.r, h.q, tSU, (GameObject)GameObject.Instantiate(Resources.Load("prefabs/UnitImagePlane"), MapMaster.Map[h.R, h.Q].spawnPoint.transform.position + new Vector3(0.0f, 0.05f, 0.0f), Quaternion.Euler(0.0f, 180.0f * PlayerMaster.CurrentTurn, 0.0f))));

                    SoundMaster.Deploy();

                    MapMaster.Map[h.R, h.Q].Passable = false;

                    instance.uoList[instance.uoList.Count - 1].icon.GetComponent <ImagePlaneTest>().SetUnitPicture(((UnitTypes)tSU).ToString(), PlayerMaster.CurrentTurn);

                    UIMaster.UpdateDeployAmount();
                    GameObject.Destroy(hit.transform.parent.gameObject);
                }
            }
        }
    }
Example #11
0
    static void NextPhase()
    {
        whichText = 0;
        ++phase;
        switch (phase)
        {
        case T_Phases.Deploy:
            UIMaster.DisplayState(GamePhase.Deploy, PlayerMaster.CurrentTurn);
            UIMaster.SetActionPanel(true);
            UIMaster.FadePhanel(0);
            break;

        case T_Phases.Cannon:
            for (int i = 0; i < PlayerMaster.CurrentPlayer.Can.Count; ++i)
            {
                PlayerMaster.CurrentPlayer.Can[i].Moved = false;
            }
            HighlightMaster.HighlightActiveCannons(PlayerMaster.CurrentPlayer);
            break;

        default:
            break;
        }

        turn_button.interactable = false;
        phaselength = TutorialUIMaster.TutorialText[(int)phase].Length;
        TutorialUIMaster.ChangeText((int)phase, whichText);
    }
Example #12
0
        private static void Save(UIMaster origin)
        {
            UIMaster master = null;

            try
            {
                master = GameObject.Instantiate((origin as UIMaster).gameObject).GetComponent <UIMaster>();
                master.gameObject.SetActive(true);
                master.gameObject.name = origin.name;
                SplitDelayLoadViews(master);
                PrefabUtility.SaveAsPrefabAsset(master.gameObject, "Assets/Resources/Output/" + master.name + ".prefab");
                var go = (origin as UINode).gameObject;
                if (PrefabUtility.IsPartOfAnyPrefab(go))
                {
                    PrefabUtility.ApplyPrefabInstance(go, InteractionMode.AutomatedAction);
                }
                else
                {
                    PrefabUtility.SaveAsPrefabAssetAndConnect(go, "Assets/Resources/" + go.name + ".prefab", InteractionMode.AutomatedAction);
                }
                GameObject.DestroyImmediate(master.gameObject);
            }
            finally
            {
                if (master != null)
                {
                    GameObject.DestroyImmediate(master.gameObject);
                }
            }
            Debug.Log("Save " + origin.name);
        }
Example #13
0
 public AttackModeChange(UIMaster shape, Type type)
 {
     this.totalTime = transitionTime;
     this.timeLeft  = totalTime;
     this.shape     = shape;
     this.type      = type;
 }
Example #14
0
 /// <summary> Called when object/script activates </summary>
 void Awake()
 {
     if (instance != null)
     {
         throw new UnityException("Singleton instance already exists");
     }
     instance = this;
 }
Example #15
0
 // Use this for initialization
 private void Awake()
 {
     UIMaster.current = this;
     for (int i = 0; i < projectileiconnames.Length; i++)
     {
         projectileicondict.Add(projectileiconnames[i], projectileicons[i]);
     }
 }
Example #16
0
 private void findShapes()
 {
     top    = GameObject.Find("Top").gameObject.GetComponent <UIMaster>();
     right  = GameObject.Find("Right").gameObject.GetComponent <UIMaster>();
     bottom = GameObject.Find("Bottom").gameObject.GetComponent <UIMaster>();
     left   = GameObject.Find("Left").gameObject.GetComponent <UIMaster>();
     middle = GameObject.Find("Middle").gameObject.GetComponent <UIMaster>();
 }
Example #17
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);
 }
    private void Awake()
    {
        manager = this;
        DontDestroyOnLoad(gameObject);

        musics = GetComponentsInChildren <AudioSource> ().ToList();
        PlayMusic(Musics.Menu);
    }
Example #19
0
 private static void GenerateViews(UIMaster master)
 {
     GenerateView(master, null);
     foreach (var view in master.GetComponentsInChildren <UIView>(true))
     {
         GenerateView(master, view);
     }
 }
Example #20
0
    public static UIMaster instance;          // Just adding this bc idk how things are intended to be set up

    // Start is called before the first frame update
    void Start()
    {
        instance = this;

        BindKeys();
        keyboard.Listening = true;
        //Master needs to register to the GameMaster for NextTurnEvent!
        GM.NextTurn += new NextTurnHandler(Space_Key);
    }
Example #21
0
 public Change(UIMaster shape, float msTime, ChangeMode mode, Change next = null)
 {
     //this.maxSize = shape.maxSize;
     this.totalTime = msTime;
     this.timeLeft  = msTime;
     this.shape     = shape;
     this.mode      = mode;
     this.next      = next;
 }
Example #22
0
    public static void SwapPoints(UnitTypes uT, int from)
    {
        int amt = pointValues[(int)uT];

        PlayerMaster.UnitsPlayer(from).Score -= amt;
        PlayerMaster.UnitsPlayer(from == 0 ? 1 : 0).Score += amt;
        instance.score1 = PlayerMaster.UnitsPlayer(0).Score;
        instance.score2 = PlayerMaster.UnitsPlayer(1).Score;
        UIMaster.DisplayScore();
    }
    private void Awake()
    {
        if (instance && instance != this)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;
    }
Example #24
0
    // Token: 0x06000383 RID: 899 RVA: 0x000145A8 File Offset: 0x000129A8
    public void BackFunc_Picture()
    {
        UIMaster componentInParent = base.GetComponentInParent <UIMaster>();

        componentInParent.BackFunc_Reset();
        componentInParent.BackFunc_Set(delegate
        {
            this.CheckExit_PictureResult();
        });
    }
Example #25
0
    // Token: 0x06000349 RID: 841 RVA: 0x00011FB8 File Offset: 0x000103B8
    public void BackFunc_child(GameObject obj)
    {
        UIMaster componentInParent = base.GetComponentInParent <UIMaster>();

        componentInParent.BackFunc_Reset();
        componentInParent.BackFunc_Set(delegate
        {
            this.CloseView(obj);
        });
    }
Example #26
0
    // Token: 0x060003BF RID: 959 RVA: 0x00016930 File Offset: 0x00014D30
    public void BackFunc()
    {
        UIMaster componentInParent = base.transform.parent.GetComponentInParent <UIMaster>();

        componentInParent.BackFunc_Reset();
        componentInParent.BackFunc_Set(delegate
        {
            this.CloseScrollView();
        });
    }
Example #27
0
    // Token: 0x060002A3 RID: 675 RVA: 0x0000A710 File Offset: 0x00008B10
    public void BackFunc_2()
    {
        UIMaster componentInParent = base.GetComponentInParent <UIMaster>();

        componentInParent.BackFunc_Reset();
        componentInParent.BackFunc_Set(delegate
        {
            this.Result_No();
        });
    }
Example #28
0
 // Start is called before the first frame update
 void Start()
 {
     if (instance != null)
     {
         Destroy(this);
         return;
     }
     instance = this;
     GameObject.DontDestroyOnLoad(this.gameObject);
 }
    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(this);
        }

        Instance  = this;
        _uiMaster = GetComponent <UIMaster>();
    }
Example #30
0
    // Token: 0x06000285 RID: 645 RVA: 0x00009984 File Offset: 0x00007D84
    public void BackFunc()
    {
        UIMaster componentInParent = base.GetComponentInParent <UIMaster>();

        componentInParent.BackFunc_Reset();
        componentInParent.BackFunc_Set(delegate
        {
            this.CloseCheck();
        });
    }
Example #31
0
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();
        actionpointsLeft = maxActionPoints;
        player = GameObject.FindGameObjectWithTag("Player");
        ui = GameObject.FindObjectOfType<UIMaster>();

        myAnim = GetComponent<Animator>();

        startingPos = transform.position;
        startingRot = transform.rotation;

        fovs = GetComponentsInChildren<FOV>();

        foreach(FOV fov in fovs)
        {
            fov.init(fieldOfViewRange, visionRange, spotRange);
        }
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        formManager = GetComponent<FormsManager>();

        gameUI = GameObject.FindGameObjectWithTag("gameUI").transform;
        txtCurTurn = gameUI.FindChild("txtTurn").GetComponent<Text>();
        btnEndTurn = gameUI.FindChild("btnEndTurn").GetComponent<Button>();
        btnEndTurn.onClick.AddListener(() => endTurnBtnClicked());

        ui = GameObject.FindObjectOfType<UIMaster>();

        //grab all enemies from map
        enemiesOnMap = GameObject.FindObjectsOfType<Enemy>();

        camFocus = Object.FindObjectOfType<CameraFocuser>();

        //check for checkpoints
        CheckPointManager.init();
        if (CheckPointManager.GetLevel() == Application.loadedLevel)
        {
            Debug.Log("Using checkpoint");
            CheckPointManager.init();
            GameObject.FindGameObjectWithTag("Player").transform.position = CheckPointManager.GetPosition();
            Debug.Log("Send player to checkpoint at " + CheckPointManager.GetPosition().ToString());
            camFocus.GoTo("PhysicalForm");

        }
    }