Ejemplo n.º 1
0
 public override void Fling(IPlayer player)
 {
     if (OnFling != null)
     {
         OnFling.Invoke();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Fling the player.
        /// </summary>
        /// <param name="player">The player character to be flung.</param>
        public override void Fling(IPlayer player)
        {
            float angle    = flingDirection.transform.localEulerAngles.z;
            float angleRad = angle * Mathf.Deg2Rad;

            Vector2 direction = new Vector2(Mathf.Cos(angleRad), Mathf.Sin(angleRad));
            float   magnitude = player.PowersSettings.FlingFlowerDirectedVelocity;

            player.Physics.Velocity = direction * magnitude;

            if (OnFling != null)
            {
                OnFling.Invoke();
            }
        }