示例#1
0
 // 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);
     }
 }
示例#3
0
 // 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>();
 }
示例#4
0
 public void AddResourceCollector(CollectorScript collector)
 {
     collector.AddBaseReference(this);
     ResourceCollectors.Add(collector);
 }