Skip to content
Permalink
13bc366381
Go to file
 
 
Cannot retrieve contributors at this time
32 lines (26 sloc) 709 Bytes
using UnityEngine;
using System.Collections;
public class Pickups : MonoBehaviour {
public int charge = 0;
public GameObject exit;
void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "EscapeCharge")
{
Destroy(col.gameObject);
Debug.Log("Charge Pickup");
charge = charge + 1;
}
}
void Update()
{
//Batteries activating exit
if (charge == 4)
{
GameObject spawn = Instantiate(exit, new Vector2(7, 7), Quaternion.Euler(0, 0, 0)) as GameObject;
charge = 6;
// exit.SetActive(true);
Debug.Log("ExitOpened");
}
}
}
You can’t perform that action at this time.