Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        var     targetX        = Input.GetAxisRaw("Horizontal");
        var     targetY        = Input.GetAxisRaw("Vertical");
        Vector3 targetVelocity = new Vector2(targetX, targetY);

        targetVelocity.Normalize();
        targetVelocity    *= movementSpeed;
        rigidBody.velocity = Vector3.SmoothDamp(rigidBody.velocity, targetVelocity, ref velocity, smoothing);

        if (Input.GetKeyDown(KeyCode.N))
        {
            DayNightManager.ChangeTime();
        }
        if (Input.GetKeyDown(KeyCode.M))
        {
            Debug.Log(DayNightManager.Time);
        }
    }