erreur compile

This commit is contained in:
Jean-Sébastien Gervais 2016-04-08 22:38:24 -04:00
parent 72d816a7cc
commit 26bd529a1a
4 changed files with 85 additions and 11 deletions

View File

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

View File

@ -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<Astronaut>().Stun();
}
if (otherCol.gameObject.tag == "Wedge")
{
var pmgr = FindObjectOfType<PlanetManager>();
pmgr.PushWedge(otherCol.gameObject.transform.parent.eulerAngles.z);
if (CrashFlamesEmitter)
{
Instantiate(CrashFlamesEmitter, this.transform.position, this.transform.forward);
}
Destroy(this.gameObject);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 190ea851aec618c4797f7963dd7d386d
timeCreated: 1460169373
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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,