// Use this for initialization void Start() { move = GameObject.Find ("Butterfly").GetComponent<ButterflyMove> (); try{ if(NextPath == null) NextPath = null; } catch{ } }
void OnTriggerEnter2D(Collider2D other) { if (Active) { if (other.gameObject.name == "Player") { SpawnPoint.transform.position = new Vector3 (gameObject.transform.position.x, gameObject.transform.position.y + 1.5f, gameObject.transform.position.z); path = GameObject.Find ("Butterfly").GetComponent<ButterflyMove> (); path.FirstPath = ClosestPath; Active = false; } } }
// Update is called once per frame void Update() { if (lives == 0) { SpawnPoint.transform.position = InitialSpawn.transform.position; gameObject.transform.position = SpawnPoint.transform.position; lives = NumberOfLives; path = GameObject.Find ("Butterfly").GetComponent<ButterflyMove> (); path.FirstPath = ClosestPath; path.Reset(); CheckPointCollision[] c = GameObject.Find("Checkpoints").GetComponentsInChildren<CheckPointCollision>(); foreach (var item in c) { item.Reset(); } PlantCollision[] p = GameObject.Find("Plants").GetComponentsInChildren<PlantCollision>(); foreach (var item in p) { item.Reset(); } reset.Reset(); } }
void Start() { m = ButterFly.GetComponent<ButterflyMove> (); }