Example #1
0
        private float MapZoom(float target)
        {
            float inaxis  = KS_Input.GetAxis("mapMoveIn");
            float outaxis = KS_Input.GetAxis("mapMoveOut");

            if (inaxis > 0f)
            {
                target += ZoomSpeed;
            }

            if (outaxis > 0f)
            {
                target -= ZoomSpeed;
            }


            if (target < minCameraHeight)
            {
                target = minCameraHeight;
            }
            if (target > maxCameraHeight)
            {
                target = maxCameraHeight;
            }

            return(target);
        }
Example #2
0
        private Vector3 MapMovement(Vector3 target)
        {
            target += Vector3.left * (KS_Input.GetAxis("mapMoveX") * (mapMoveSpeed * MoveSpeed));
            target += Vector3.forward * (KS_Input.GetAxis("mapMoveY") * (mapMoveSpeed * MoveSpeed));

            return(target);
        }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Square)))
        {
            Spawn();
        }

        if (Input.GetKeyDown(KeyCode.E) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            clear();
        }
    }
Example #4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            ChangeLanguage();
        }

        if (Input.GetKeyDown(KeyCode.E) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Square)))
        {
            ShowSubtitle();
        }
    }
        // 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();
        }
Example #6
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
     {
         if (FindObjectOfType <KS_CharacterController>().enabled)
         {
             FindObjectOfType <KS_CharacterController>().enabled = false;
         }
         else
         {
             FindObjectOfType <KS_CharacterController>().enabled = true;
         }
     }
 }
Example #7
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.N) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            map.useMiniMap = !map.useMiniMap;

            if (map.MiniMapActive && !map.useMiniMap && !map.MapActive)
            {
                map.DisableMinimap();
                mapContainer.SetActive(false);
            }
            if (!map.MapActive && map.useMiniMap)
            {
                map.EnableMinimap();
                mapContainer.SetActive(true);
            }
        }
    }
Example #8
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;
         }
     }
 }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            ResetObjects();
        }

        if (Input.GetKeyDown(KeyCode.Q) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Square)))
        {
            Save();
        }

        if (Input.GetKeyDown(KeyCode.E) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.X)))
        {
            Load();
        }

        if (Input.GetMouseButtonDown(0) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.R2)))
        {
            FindObjectOfType <updateBulletPoint>().Fire();
        }
    }
Example #10
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();
                }
            }
        }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Square)))
        {
            Spawn();
        }

        if (Input.GetKeyDown(KeyCode.F) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            ClearPool();
        }

        string text = "";

        for (int i = 0; i < spawnObjects.Length; i++)
        {
            KS_IPoolObject o = spawnObjects[i].GetComponent <KS_IPoolObject>();

            text += o.PoolSettings().tag + ": Active in scene (" + GetAmountOfType(o.PoolSettings().tag)
                    + ") ---- In pool (" + pool.GetAmountOfType(o.PoolSettings().tag) + ")\n";
        }

        wallText.text = text;
    }
Example #12
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();
                        }
                    }
                }
            }
        }
Example #13
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.Share)))
        {
            shareB.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            shareB.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.TouchPad)))
        {
            touchpad.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            touchpad.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.Options)))
        {
            options.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            options.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            triangle.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            triangle.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.Circle)))
        {
            circle.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            circle.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.X)))
        {
            x.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            x.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.Square)))
        {
            square.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            square.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.Home)))
        {
            home.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            home.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.L1)))
        {
            leftButton.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            leftButton.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.L3)))
        {
            leftStick.item.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            leftStick.item.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.R1)))
        {
            rightButton.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            rightButton.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (Input.GetKey(KS_Input.DS4ButtonToKey(DS4KeyCode.R3)))
        {
            rightStick.item.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            rightStick.item.GetComponent <Renderer>().material.color = defaultCol;
        }

        // sticks


        Vector3 lsPos = leftStick.startPos;

        lsPos.x += leftStick.moveAmmount * -KS_Input.GetDS4Axis(DS4Axis.LeftStickX);
        lsPos.y += leftStick.moveAmmount * KS_Input.GetDS4Axis(DS4Axis.LeftStickY);

        leftStick.item.transform.position = lsPos;

        Vector3 rsPos = rightStick.startPos;

        rsPos.x += rightStick.moveAmmount * KS_Input.GetDS4Axis(DS4Axis.RightStickX);
        rsPos.y += rightStick.moveAmmount * -KS_Input.GetDS4Axis(DS4Axis.RightStickY);

        rightStick.item.transform.position = rsPos;

        Vector3 ltPos = leftTrigger.startPos;

        ltPos.y += leftTrigger.moveAmmount * KS_Input.GetDS4Axis(DS4Axis.L2);

        leftTrigger.item.transform.position = ltPos;

        Vector3 rtPos = rightTrigger.startPos;

        rtPos.y += rightTrigger.moveAmmount * KS_Input.GetDS4Axis(DS4Axis.R2);

        rightTrigger.item.transform.position = rtPos;

        // dpad

        if (KS_Input.GetDS4Axis(DS4Axis.DPadX) < -0.9)
        {
            dPadLeft.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            dPadLeft.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (KS_Input.GetDS4Axis(DS4Axis.DPadX) > 0.9)
        {
            dPadRight.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            dPadRight.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (KS_Input.GetDS4Axis(DS4Axis.DPadY) < -0.9)
        {
            dPadDown.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            dPadDown.GetComponent <Renderer>().material.color = defaultCol;
        }

        if (KS_Input.GetDS4Axis(DS4Axis.DPadY) > 0.9)
        {
            dpadUp.GetComponent <Renderer>().material.color = clickColour;
        }
        else
        {
            dpadUp.GetComponent <Renderer>().material.color = defaultCol;
        }
    }
Example #14
0
    // Update is called once per frame
    void Update()
    {
        if (KS_Input.GetDS4Axis(DS4Axis.DPadX) < 0 || Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (!dpadL)
            {
                dpadL = true;
                ResetTimeScale();
            }
        }
        else
        {
            dpadL = false;
        }

        if (KS_Input.GetDS4Axis(DS4Axis.DPadX) > 0 || Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (!dpadR)
            {
                dpadR = true;
                IncreaseTimeScale();
            }
        }
        else
        {
            dpadR = false;
        }

        if (KS_Input.GetDS4Axis(DS4Axis.DPadY) < 0 || Input.GetKeyDown(KeyCode.Alpha4))
        {
            if (!dpadD)
            {
                dpadD = true;
                AddHour();
            }
        }
        else
        {
            dpadD = false;
        }

        if (KS_Input.GetDS4Axis(DS4Axis.DPadY) > 0 || Input.GetKeyDown(KeyCode.Alpha3))
        {
            if (!dpadU)
            {
                dpadU = true;
                QuickCycle();
            }
        }
        else
        {
            dpadU = false;
        }

        if (Input.GetKeyDown(KeyCode.Alpha5) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.X)))
        {
            ResetLongLat();
        }

        if (Input.GetKeyDown(KeyCode.Alpha6) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Square)))
        {
            SetLongLatFinland();
        }

        if (Input.GetKeyDown(KeyCode.Alpha7) || KS_Input.GetKeyDown(KS_Input.DS4ButtonToKey(DS4KeyCode.Triangle)))
        {
            SetLongLatEquator();
        }
    }