示例#1
0
        public override void Execute()
        {
            PanzerView view = GameObject.FindObjectOfType <PanzerView>();

            if (!view)
            {
                Debug.LogError("Panzer not found");
                return;
            }
            view.RBody.AddForce(view.transform.forward * Direction * view.Acceleration);
            if (view.RBody.velocity.magnitude >= view.MaxVelocity)
            {
                view.RBody.velocity = view.RBody.velocity.normalized * view.MaxVelocity;
            }
        }
示例#2
0
        public override void Execute()
        {
            PanzerView view = GameObject.FindObjectOfType <PanzerView>();

            if (!view)
            {
                Debug.LogError("panzer not found");
                return;
            }
            if (view.RBody.velocity.magnitude > VelError &&
                (-view.transform.forward - view.RBody.velocity).magnitude <
                (view.transform.forward - view.RBody.velocity).magnitude)
            {
                Direction *= -1f;
            }

            view.transform.Rotate(view.transform.up, Direction * view.RotationSpeed * Time.deltaTime);
        }