public void IncreaseFlockSize() { for (int i = 0; i < increaseFlockByCount; ++i) { FlockingAgent agent = Instantiate(prey); agent.transform.position = GameManager.RandomInRectWorldPosition(); agent.RandomizeWeights(); agent.GetComponent <CircleCollider2D>().enabled = false; FlockManager.Instance.AddAgent(agent); } FlockSize += increaseFlockByCount; }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag.Equals(Tag.Player)) { int amountToBeSpawned = Random.Range(50, 100); for (int i = 0; i < amountToBeSpawned; ++i) { FlockingAgent agent = GameManager.Instance.CreateNewPrey(); agent.RandomizeWeights(); } Destroy(gameObject); } }