Skip to content
Permalink
bbf03575ab
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
33 lines (26 sloc) 710 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");
}
}
}