diff --git a/Assets/Scripts/Asteroid.cs b/Assets/Scripts/Asteroid.cs index 754c5c6..04ba30f 100644 --- a/Assets/Scripts/Asteroid.cs +++ b/Assets/Scripts/Asteroid.cs @@ -61,7 +61,7 @@ public class Asteroid : MonoBehaviour if (CrashFlamesEmitter) { - Instantiate(CrashFlamesEmitter, this.transform.position, this.transform.forward); + //Instantiate(CrashFlamesEmitter, this.transform.position, this.transform.forward); } diff --git a/Assets/Scripts/Asteroid.cs.orig b/Assets/Scripts/Asteroid.cs.orig new file mode 100644 index 0000000..754c5c6 --- /dev/null +++ b/Assets/Scripts/Asteroid.cs.orig @@ -0,0 +1,72 @@ +using UnityEngine; +using System.Collections; + +public class Asteroid : MonoBehaviour +{ + Vector3 center; + public float speed; + public float step; + public float rotationSpeed = 1.0f; + public float rotationDirection = 1.0f; + public bool RandomRotationSpeed = true; + + public GameObject CrashFlamesEmitter; //Emitter on impact + + public GameObject TrailFlamesEmitter; // trailing smoke + + // Use this for initialization + public void Start() + { + speed = Random.Range(1.8F, 3F); + center = new Vector3(0, 0); + + if (RandomRotationSpeed) + rotationSpeed = 10 * UnityEngine.Random.Range(0.25f, 5f); + + rotationDirection = (Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f)) * 2 - 1); + + } + + // Update is called once per frame + public void Update () { + MoveObject(center); + + } + + public void MoveObject(Vector3 center) + { + step = speed * Time.deltaTime; + this.transform.position = Vector3.MoveTowards(transform.position, center, step); + + + + this.transform.Rotate(new Vector3(0, 0, 1.0f), rotationDirection * rotationSpeed * Time.deltaTime); + + } + + //collider must be set as "isTrigger" in unity for this method to work + public void OnTriggerEnter(Collider otherCol) + { + + + if (otherCol.gameObject.tag == "Player") + { + ///Stun the player + otherCol.gameObject.GetComponent().Stun(); + } + if (otherCol.gameObject.tag == "Wedge") + { + var pmgr = FindObjectOfType(); + pmgr.PushWedge(otherCol.gameObject.transform.parent.eulerAngles.z); + + if (CrashFlamesEmitter) + { + Instantiate(CrashFlamesEmitter, this.transform.position, this.transform.forward); + } + + + Destroy(this.gameObject); + } + } + +} diff --git a/Assets/Scripts/Asteroid.cs.orig.meta b/Assets/Scripts/Asteroid.cs.orig.meta new file mode 100644 index 0000000..c83a42c --- /dev/null +++ b/Assets/Scripts/Asteroid.cs.orig.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 190ea851aec618c4797f7963dd7d386d +timeCreated: 1460169373 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_Scenes/Main.unity b/Assets/_Scenes/Main.unity index 7133947..499aa62 100644 --- a/Assets/_Scenes/Main.unity +++ b/Assets/_Scenes/Main.unity @@ -89,12 +89,6 @@ NavMeshSettings: GameObject: m_PrefabParentObject: {fileID: 170392, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} m_PrefabInternal: {fileID: 1660116367} ---- !u!114 &431637410 stripped -MonoBehaviour: - m_PrefabParentObject: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, - type: 2} - m_PrefabInternal: {fileID: 1660116367} - m_Script: {fileID: 11500000, guid: 8c32c40e0b8e5eb47bb7a91068af09ca, type: 3} --- !u!114 &431637411 MonoBehaviour: m_ObjectHideFlags: 0 @@ -106,10 +100,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 77462b2431858f84b9bc2d055c2f4d45, type: 3} m_Name: m_EditorClassIdentifier: - aspi: {fileID: 431637410} - WalkAnimSpeed: 3 - WalkAnimAngle: 20 - EjectSpinSpeed: 5 + aspi: {fileID: 0} + WalkAnimSpeed: 0 + WalkAnimAngle: 0 + EjectSpinSpeed: 0 --- !u!114 &1027139440 stripped MonoBehaviour: m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1,