示例#1
0
        void Update()
        {
            var totalMovement = new Vector3(0f, Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"));

            if (totalMovement.magnitude > 0f)
            {
                MovingEntity.Move(totalMovement);
            }

            if (Input.GetButtonDown("Miner"))
            {
                Systems.SwitchMode();
            }

            if (Input.GetKeyDown(KeyCode.Tab))
            {
                if (mapExpanded)
                {
                    MapExpand.Shrink();
                    MapCamera.ZoomIn();
                }
                else
                {
                    MapExpand.Expand();
                    MapCamera.ZoomOut();
                }

                mapExpanded = !mapExpanded;
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                InGameMenu.SetActive(!InGameMenu.activeInHierarchy);
            }
        }
示例#2
0
    void Update()
    {
        if (CheckButtonCoolDown())
        {
            if (Input.anyKey)
            {
                SetButtonCoolDown();
                if (Input.GetKey(KeyCode.Space))
                {
                    if (trigger)
                    {
                        trigger.DOTrigger();
                    }
                }
                else if (isZoomedOut)
                {
                    mapCamera.ZoomIn();
                }
            }

            if (Input.GetKey(KeyCode.W))
            {
                thistransform.eulerAngles = directionFacing[0];
                if (CheckCollidion())
                {
                    Move(0);
                }
            }
            else if (Input.GetKey(KeyCode.S))
            {
                thistransform.eulerAngles = directionFacing[1];
                if (CheckCollidion())
                {
                    Move(1);
                }
            }
            else if (Input.GetKey(KeyCode.A))
            {
                thistransform.eulerAngles = directionFacing[2];
                if (CheckCollidion())
                {
                    Move(2);
                }
            }
            else if (Input.GetKey(KeyCode.D))
            {
                thistransform.eulerAngles = directionFacing[3];
                if (CheckCollidion())
                {
                    Move(3);
                }
            }
        }
    }