void DropPheromone(Pheromone.PheromoneType type, Vector3 target) { Pheromone pheromone = new Pheromone(type, target, this); m_WorldMatrix.DropPheromone(pheromone, gameObject.transform.position); ProcessPheromone(pheromone); }
private Vector3 GetAveragePheromonDirectionByType(Pheromone.PheromoneType pheromoneType) { Vector3 ans = new Vector3(0, 0, 0); int count = 0; foreach (GameObject pheromone in spottedPheromnes) { if (pheromone.GetComponent <Pheromone>().myPheromoneType == pheromoneType) { ans += new Vector3(pheromone.transform.forward.x, 0f, pheromone.transform.forward.z); count++; } } ans = ans.normalized; return(ans); }
private Vector3 GetAveragePheromonPointByType(Pheromone.PheromoneType pheromoneType) { Vector3 ans = new Vector3(0, 0, 0); int count = 0; foreach (GameObject pheromone in spottedPheromnes) { if (pheromone.GetComponent <Pheromone>().myPheromoneType == pheromoneType) { ans += new Vector3(pheromone.transform.position.x, 0f, pheromone.transform.position.z); count++; } } if (count > 0) { ans = new Vector3(ans.x / count, ans.y / count, ans.z / count); } return(ans); }