示例#1
0
 public override void DealOnFingerDown(FingerDownEvent e)
 {
     if (followWind != null)
     {
         Vector3 touchPosition = Camera.main.ScreenToWorldPoint(e.Position);
         float   angle         = Vector3.Dot(Vector3.forward, Vector3.Cross(transform.up, touchPosition - transform.position));
         followWind.AddImpuse(angle * Time.deltaTime * touchIntense, touchPosition);
     }
 }
示例#2
0
    public override void Blow(Vector2 velocity)
    {
        if (canBlow(velocity))
        {
            if (blowSound != null)
            {
                blowSound.Play();
                blowSound.volume = velocity.magnitude / 15f;
            }
            base.Blow(velocity);


            // make the flower react to the blow
            FollowWind stemFollowWind = stems[0].GetComponent <FollowWind>();
            if (stemFollowWind != null)
            {
                stemFollowWind.AddImpuse(velocity, petalRoot.position);
            }
        }
    }