示例#1
0
    void update_movement()
    {
        if (Physics2D.Raycast(new Vector2(coll.bounds.center.x, coll.bounds.min.y), Vector2.down, 0.1f, wall_layer).collider)
        {
            jump_count.to_origin();
        }
        float x_speed = body.velocity.x + GamePad.GetAxis(GamePad.Axis.LeftStick, gpIndex).x *move_velocity *Time.deltaTime;
        float y_speed = body.velocity.y;

        if (jump_count.current > 0 && GamePad.GetButtonDown(GamePad.Button.RightShoulder, gpIndex))
        {
            jump_count.current--;
            y_speed = jump_velocity;
        }
        body.velocity = new Vector2(x_speed, y_speed);
    }
示例#2
0
    void update_fire()
    {
        if (disabled)
        {
            return;
        }
        Vector2 fire_direction = GamePad.GetAxis(GamePad.Axis.RightStick, gpIndex);

        if (weapon_cooldown.current > 0)
        {
            weapon_cooldown.current -= Time.deltaTime;
        }
        else if (fire_direction.magnitude > 0.01)
        {
            weapon_script.use(gameObject, fire_direction.normalized);
            weapon_cooldown.to_origin();
        }
    }
示例#3
0
 public void disable()
 {
     disabled = true;
     health.to_origin();
     disable_time.to_origin();
 }