virtual protected void FireFromHand( Vector3 offset, PlayerHandAnimationScript hand ) { // Create projectile and fire it GameObject projectile = (GameObject) Instantiate( Projectile, hand.transform.position, transform.rotation ); projectile.transform.LookAt( transform.position + ( transform.forward * 10 ) ); projectile.GetComponentInChildren<Rigidbody>().velocity = projectile.transform.forward * ProjectileSpeed; projectile.transform.SetParent( GameObject.Find( "GameObjectContainer" ).transform ); projectile.transform.GetChild( 0 ).GetChild( 0 ).GetComponent<AudioSource>().pitch = Random.Range( 0.9f, 1.1f ); // Play animation hand.PopAnimation(); hand.PopAnimation(); hand.PopAnimation(); hand.PushAnimation( 3, 0.1f, 0.05f ); hand.PushAnimation( 4, 0.3f, 0.05f ); hand.PushAnimation( 3, 0.1f, 0.05f ); }
override protected void StopFireFromHand( Vector3 offset, PlayerHandAnimationScript hand ) { hand.PopAnimation(); hand.PopAnimation(); hand.PopAnimation(); hand.PushAnimation( 3, 0.1f, 0.05f ); Destroy( ProjectileInstance ); if ( ImpactEffectInstance ) { ImpactEffectInstance.GetComponent<ParticleSystem>().loop = false; } }