Пример #1
0
        void Update()
        {
            if (player == null)
            {
                player = transform.GetComponent <Player>();
                if (player == null)
                {
                    return;
                }
            }

            GetComponent <Rigidbody2D>().velocity = new Vector2(player.Actions.Move * maxSpeed, GetComponent <Rigidbody2D>().velocity.y);


            jump_timer -= Time.deltaTime;
            can_jump    = jump_timer < 0;

            if (player.Actions.AButton.WasPressed && can_jump)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(0f, jump_force);
                jump_timer = jump_cooldown;
                jumpCooldownDisplay.fillAmount = 1;
                mm.AddToMetric2(1);
            }
        }