Exemple #1
0
    private void FixedUpdate()
    {
        if (MotherShip != null && MotherShip.IsFunctional)
        {
            var     hor   = Input.GetAxis($"P{MotherShip.PlayerNumber}Horizontal");
            var     ver   = Input.GetAxis($"P{MotherShip.PlayerNumber}Vertical");
            Vector2 force = new Vector2(hor, ver);
            force = Vector2.ClampMagnitude(force, 1f);
            var dot = Mathf.Max(Vector2.Dot(Direction, force), 0);

            MotherShip.ApplyThrust(dot * ThrustForce, transform.position, transform.up);
            animation.TargetSize = dot;
        }
    }