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); } }
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); } } }