public void ReceptacleStuff() //Finds how many receptacle Blocks exist in the scene, then sets the number of required powered receptacles to the number of real (non-psuedo) receptacles in the scene { receptacles = GameObject.FindGameObjectsWithTag("receptacleBlock"); foreach (GameObject receptacle in receptacles) { if (receptacle.GetComponent <receptacleBlock>()) { receptacleBlock receptacleBlock = receptacle.GetComponent <receptacleBlock>(); receptacleBlocks.Add(receptacleBlock); } } receptacleNo = receptacles.Length; }
private void OnTriggerEnter(Collider col) { if (LayerMask.NameToLayer("deathBarrier") == col.gameObject.layer) { Die(); //"kills" the power orb } if (col.gameObject.tag == "orbVacuum") { receptacleBlock _rB = col.gameObject.transform.parent.gameObject.GetComponent <receptacleBlock>(); _rB.InsertOrb(this.gameObject.transform.parent.gameObject); this.gameObject.transform.parent.gameObject.SetActive(false); playerInteraction _pi = GameObject.Find("PlayerContainer").GetComponent <playerInteraction>(); if (_pi.touchedPowerOrb == this.transform.parent.gameObject) { _pi.touchedPowerOrb = null; } } }