//Destroy any wires or connectors that are dragged into the trashcan. void OnTriggerStay2D(Collider2D other) { if (Input.GetButtonDown("Fire1")) { SpawnableObjectsList spawnList = PowerboxGameManager.instance.gameObject.GetComponent <SpawnableObjectsList>(); spawnList.canSpawn = true; Destroy(other.gameObject); } }
private Sounds soundEffect; //Script for the SoundManager's sounds. void Start() { wiresList = this.gameObject.GetComponent <WireConnectorList> (); setPicker = PowerboxGameManager.instance.GetComponent <SetPicker>(); spaceList = setPicker.currentSet.GetComponent <WireSpaceList>(); playerHealth = PowerboxGameManager.instance.GetComponent <PowerboxPlayerHealth>(); //GameObject.FindWithTag ("GameController").GetComponent<PowerboxPlayerHealth> (); audioPlayer = GameObject.Find("SoundManager").GetComponent <AudioSource> (); soundEffect = GameObject.Find("SoundManager").GetComponent <Sounds> (); /*SpawnList is called here to enable the creation of more wires.*/ spawnList = PowerboxGameManager.instance.GetComponent <SpawnableObjectsList>(); }
void Start() { //Directly assigns spawnList with the Spawn List script from the Game Manager spawnList = PowerboxGameManager.instance.gameObject.GetComponent <SpawnableObjectsList>();//GameObject.FindWithTag ("GameController").GetComponent<SpawnableObjectsList>(); }