コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (PAUSED && hidden)
        {
            return;
        }

        if (GameOverScreen.IsGameOver())
        {
            Hide();
            return;
        }

        if (btnPause.Check() == InputStates.InputState.JustPressed || btnPause2.Check() == InputStates.InputState.JustPressed)
        {
            if (!PAUSED)
            {
                Show();
                PAUSED = true;
            }
            else
            {
                Hide();
                PAUSED = false;
            }
        }
    }
コード例 #2
0
ファイル: TutorialPopup.cs プロジェクト: hakrrr/Chaos-to-Go
 // Update is called once per frame
 void Update()
 {
     if (!hidden && PauseMenu.PAUSED && btnEsc.Check() == InputStates.InputState.JustPressed)
     {
         Hide();
     }
 }
コード例 #3
0
    private void OnMouseOver()
    {
        if (dragging || PauseMenu.PAUSED)
        {
            return;
        }

        if (btnMouseL.Check() == InputStates.InputState.JustPressed)
        {
            if (transform.parent.transform.parent.name == "GameBoard")
            {
                return;
            }
            dragging = dragged = true;
            behavior.OnPickup();
        }
    }
コード例 #4
0
    private void HandleInputs()
    {
        if (btnConsole.Check() == InputStates.InputState.JustPressed)
        {
            if (visible)
            {
                Hide();
            }
            else
            {
                Show();
            }
        }

        if (btnEnter.Check() == InputStates.InputState.JustPressed)
        {
            string   command = inputText.text;
            string[] tokens  = command.Split(' ', '\t', '\n');
            string   output  = "";
            if (command.Length > 0)
            {
                ConsoleCommands.Execute(tokens.Length, tokens, ref output, this);
                if (!storedCommands.Contains(command))
                {
                    storedCommands.Add(command);
                }
                if (storedCommands.Count > 16)
                {
                    storedCommands.RemoveAt(0);
                }
            }
            outputText.text += ">>> " + output + "\n";
        }

        if (btnDown.Check() == InputStates.InputState.JustPressed)
        {
            if (storedCommands.Count > 0)
            {
                instrIdx -= 1;
                if (instrIdx < 0)
                {
                    instrIdx = storedCommands.Count - 1;
                }
                string command = storedCommands[instrIdx];
                inputText.text = command;
            }
        }

        if (btnUp.Check() == InputStates.InputState.JustPressed)
        {
            if (storedCommands.Count > 0)
            {
                instrIdx = (instrIdx + 1) % storedCommands.Count;
                string command = storedCommands[instrIdx];
                inputText.text = command;
            }
        }
    }
コード例 #5
0
    void OnMouseOver()
    {
        if (PauseMenu.PAUSED)
        {
            return;
        }
        if (!Game.BOARD.Contains(tile))
        {
            return;
        }
        if (DraggableObject.IsPlayerDraggingObject())
        {
            return;
        }
        if (IsTileOccupated(tile))
        {
            return;
        }

        if (btnSelect.Check() == InputStates.InputState.JustPressed)
        {
            if (selected == null)
            {
                OnSelect();
                selected = this;
            }
            else if (selected != this)
            {
                if ((Math.Abs((int)selected.x - (int)x) == 1 && selected.y == y) || (Math.Abs((int)selected.y - (int)y) == 1 && selected.x == x))
                {
                    if (!IsTileOccupated(selected.tile))
                    {
                        //Debug.Log("§§-§§");
                        //Debug.Log("> T1: " + new Vector2(x, y));
                        //Debug.Log("> T2: " + new Vector2(selected.x, selected.y));
                        GameBoard.GAME_BOARD.AddTile(selected.tile, x, y);
                        GameBoard.GAME_BOARD.AddTile(tile, selected.x, selected.y);
                        GameBoard.GAME_BOARD.Build();
                        selected.OnRelease();
                        OnRelease();
                        selected = null;
                    }
                }
                else
                {
                    selected.OnRelease();
                    OnSelect();
                    selected = this;
                }
            }
            else
            {
                OnRelease();
                selected = null;
            }
        }
    }
コード例 #6
0
 private void CheckDraggingInput()
 {
     if (btnMouseL.Check() == InputStates.InputState.JustPressed)
     {
         if (behavior.OnRelease())
         {
             dragged = dragging = false;
         }
     }
     else if (btnMouseR.Check() == InputStates.InputState.JustPressed)
     {
         behavior.OnAbort();
         transform.position = initialPosition;
         dragged            = dragging = false;
     }
 }
コード例 #7
0
ファイル: SR_RenderCamera.cs プロジェクト: hakrrr/Chaos-to-Go
    private void LateUpdate()
    {
        if (btnAction.Check() == InputStates.InputState.JustPressed)
        {
            CamCapture();
        }

        if (btnRight.Check() == InputStates.InputState.JustPressed)
        {
            transformRoot.position += new Vector3(offset, 0.0f, 0.0f);
        }
        else if (btnLeft.Check() == InputStates.InputState.JustPressed)
        {
            transformRoot.position -= new Vector3(offset, 0.0f, 0.0f);
        }
    }
コード例 #8
0
ファイル: Dispenser.cs プロジェクト: hakrrr/Chaos-to-Go
    void OnMouseOver()
    {
        if (PauseMenu.PAUSED)
        {
            return;
        }
        if (!GameBoard.GAME_BOARD.Contains(this))
        {
            return;
        }

        if (btnBlock.Check() == InputStates.InputState.JustPressed)
        {
            if (!(movePattern as DispenserMovePattern).IsDispensing())
            {
                Block();
            }
        }
        else if (btnSelect.Check() == InputStates.InputState.JustPressed)
        {
            Vector3 mouseScrPos = Input.mousePosition;
            Vector3 screenPos   = Camera.main.WorldToScreenPoint(transform.position);
            Vector2 v           = new Vector2(mouseScrPos.x - screenPos.x, mouseScrPos.y - screenPos.y);
            if (Math.Abs(v.x) > Math.Abs(v.y))
            {
                if (v.x > 0.0f)
                {
                    OpenDirection(eDirection.right);
                }
                else
                {
                    OpenDirection(eDirection.left);
                }
            }
            else
            {
                OpenDirection(eDirection.down);
            }
        }

        UpdateConveyorBelts();
    }