public void AddGatherer(DraggableUnit unit) { if (!m_gatherers.Contains(unit)) { m_gatherers.Add(unit); } }
void OnCollisionExit2D(Collision2D other) { if (other.gameObject.layer == LayerMask.NameToLayer("Unit")) { DraggableUnit outgoing = other.gameObject.GetComponent <DraggableUnit>(); if (units.Contains(outgoing)) { units.Remove(outgoing); } } }
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); } } }
public void RemoveGatherer(DraggableUnit unit) { m_gatherers.Remove(unit); }
// 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); }