Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class ExpandAndDie : MonoBehaviour {
- public float growTime = 0.15f;
- public float initialRadius = 1.0f;
- public float finalRadius = 4.0f;
- void Start ()
- {
- StartCoroutine(GrowAndDie());
- }
- IEnumerator GrowAndDie ()
- {
- float t = 0.0f;
- Vector3 initialSize = new Vector3(initialRadius, initialRadius, initialRadius);
- Vector3 finalSize = new Vector3(finalRadius, finalRadius, finalRadius);
- while (t < growTime)
- {
- transform.localScale = Vector3.Lerp(initialSize, finalSize, t/growTime);
- t += Time.deltaTime;
- yield return null;
- }
- Destroy(gameObject);
- }
- }
- ------------------------------------------------------
- using UnityEngine;
- using System.Collections;
- public class AddForceOnCollision : MonoBehaviour {
- public float force = 10.0f;
- public float collisionDelay = 1.0f;
- void OnCollisionEnter (Collision other)
- {
- if (other.gameObject.tag.Contains("Player"))
- {
- other.rigidbody.AddForce (other.contacts[0].normal * force * -1.0f, ForceMode.Impulse);
- other.gameObject.SendMessage("GrenadeMoveDelay");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement