// Use this for initialization void Start() { instances = new List <GameObject>(); followerCountLabel = GameObject.FindGameObjectWithTag("Score").GetComponent <Text>(); cntrllr = GameObject.FindGameObjectWithTag("Controller").GetComponent <ControllerScript>(); cs = GameObject.FindGameObjectWithTag("Collector").GetComponent <CollectorScript>(); UpdateUILabel(); }
private void OnCollisionEnter2D(Collision2D collision) { if (((1 << collision.collider.gameObject.layer) & PlayerLayer.value) > 0) { CollectorScript cs = collision.collider.GetComponent <CollectorScript>(); cs.Collect(CollectibleType); GameObject.Destroy(gameObject); } }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody>(); cnt = GameObject.FindGameObjectWithTag("Counter").GetComponent <CounterScript>(); target = GameObject.FindGameObjectWithTag("Player"); goal = GameObject.FindGameObjectWithTag("Collector"); cs = GameObject.FindGameObjectWithTag("Collector").GetComponent <CollectorScript>(); rendSpawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent <Renderer>(); }
public void AddResourceCollector(CollectorScript collector) { collector.AddBaseReference(this); ResourceCollectors.Add(collector); }