示例#1
0
 public void AddGatherer(DraggableUnit unit)
 {
     if (!m_gatherers.Contains(unit))
     {
         m_gatherers.Add(unit);
     }
 }
示例#2
0
 void OnCollisionExit2D(Collision2D other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("Unit"))
     {
         DraggableUnit outgoing = other.gameObject.GetComponent <DraggableUnit>();
         if (units.Contains(outgoing))
         {
             units.Remove(outgoing);
         }
     }
 }
示例#3
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("Unit"))
     {
         DraggableUnit incoming = other.gameObject.GetComponent <DraggableUnit>();
         if (transform.position.y < other.transform.position.y && !incoming.isDragged())
         {
             units.Add(incoming);
             //incoming.gameObject.SetActive(false);
         }
     }
 }
示例#4
0
 public void RemoveGatherer(DraggableUnit unit)
 {
     m_gatherers.Remove(unit);
 }
示例#5
0
    // Start is called before the first frame update
    void Start()
    {
        DraggableUnit a = Instantiate(spawnList[(int)(Random.value * spawnList.Count)]);

        a.transform.position = new Vector3(transform.position.x, transform.position.y, a.transform.position.z);
    }