public void AddAgent(WorldAgent newAgent) { newAgent.transform.position = GetNewLocation(); // newAgent.transform.position = GetCenterLocation(); newAgent.transform.eulerAngles = GetNewAngle(); newAgent.GetComponent <SpriteRenderer>().color = GetNewColor(); int newX = (int)Math.Floor(newAgent.transform.position.x / SearchRadius); int newY = (int)Math.Floor(newAgent.transform.position.y / SearchRadius); _coordsOfAgent[newAgent.Id] = new Pair <int, int>(newX, newY); _agentGrid[newX, newY].Add(newAgent); }
public void AddAgent(WorldAgent newAgent) { // newAgent.transform.position = GetTestLocation(); newAgent.transform.position = GetNewLocation(); // newAgent.transform.position = GetCenterLocation(); newAgent.transform.eulerAngles = GetNewAngle(); // newAgent.transform.eulerAngles = GetTestAngle(); newAgent.BaseTurn = GetRandomTurnSpeed(); newAgent.BaseSpeed = GetRandomSpeed(); // newAgent.BaseSpeed = 0; float newScale = GetTurnScale(newAgent.BaseTurn); newAgent.transform.localScale = new Vector3(newScale, newScale, 0); newAgent.GetComponent <SpriteRenderer>().color = GetSpeedColor(newAgent.BaseSpeed); int newX = (int)Math.Floor(newAgent.transform.position.x / GetSettingFloat("ViewRange")); int newY = (int)Math.Floor(newAgent.transform.position.y / GetSettingFloat("ViewRange")); _coordsOfAgent[newAgent.Id] = new Pair <int, int>(newX, newY); _agentGrid[newX, newY].Add(newAgent); }