コード例 #1
0
        // Update is called once per frame
        private void FixedUpdate()
        {
            if (Manager.State != KS_Manager.GameState.Playing)
            {
                return;
            }


            MoveCamera(KS_Input.GetAxis("View Horizontal"), KS_Input.GetAxis("View Vertical"));
            MovePlayer(KS_Input.GetAxis("Move Horizontal"), KS_Input.GetAxis("Move Vertical"));

            currentVelocity = Vector3.Slerp(currentVelocity, targetVelocity, Time.deltaTime * movementSmooth);

            rb.AddRelativeForce(targetVelocity, ForceMode.Force);

            if (IsGrounded() || IsSwimming)
            {
                rb.drag = 2.5f;
            }
            else
            {
                rb.drag = 1;
            }

            if (KS_Input.GetInputDown("jump"))
            {
                if ((IsGrounded() || IsSwimming))
                {
                    Jump();
                }
            }

            if (KS_Input.GetInputDown("crouch"))
            {
                Crouch();
            }

            if (KS_Input.GetInputDown("run"))
            {
                print("Running");
                running = true;
            }

            if (KS_Input.GetInputUp("run"))
            {
                print("walking");
                running = false;
            }

            raycastInteractable();
        }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if ((Input.GetKeyDown(KeyCode.M) || KS_Input.GetInputDown("map")) && Manager.State == KS_Manager.GameState.Playing)
     {
         if (!mapActive)
         {
             map.DisableMinimap();
             playerCam.enabled = false;
             map.ShowMap();
             mapActive = true;
         }
         else
         {
             mapActive = false;
             map.HideMap();
             map.EnableMinimap();
             playerCam.enabled = true;
         }
     }
 }
コード例 #3
0
        // Update is called once per frame
        void Update()
        {
            if (loaded)
            {
                if (waitForInput)
                {
                    if (KS_Input.GetInputDown(waitInputID))
                    {
                        LoadScreenContainer.SetActive(false);
                        loaded = false;

                        KS_Manager.Instance.LevelLoaded();
                    }
                }
                else
                {
                    LoadScreenContainer.SetActive(false);
                    loaded = false;

                    KS_Manager.Instance.LevelLoaded();
                }
            }
        }
コード例 #4
0
        private void Update()
        {
            if (!running)
            {
                return;
            }

            // Inputs

            if (KS_Input.GetInputDown(skipInput))
            {
                Skip();
            }

            if (KS_Input.GetInputDown(waitForInputButton))
            {
                Continue();
            }

            // Timer

            if (fadeTimer > 0)
            {
                timer += Time.deltaTime;

                if (fadeIn)
                {
                    SetFadeAlpha(1f - timer / fadeTimer);

                    if (timer > fadeTimer)
                    {
                        StartTimer();
                    }
                }
                else
                {
                    SetFadeAlpha(timer / fadeTimer);

                    if (timer > fadeTimer)
                    {
                        NextScreen();
                    }
                }
            }

            if (screenIndex < splashScreens.Count && !splashScreens[screenIndex].waitForInput)
            {
                if (aliveTime > 0f)
                {
                    timer += Time.deltaTime;


                    if (timer > aliveTime)
                    {
                        if (splashScreens[screenIndex].fadeInOut)
                        {
                            Fade(splashScreens[screenIndex].fadeTime, true);
                        }
                        else
                        {
                            NextScreen();
                        }
                    }
                }
            }
        }