private void ApplyLogic(GameState s, float dt, DevCommandSpawn c) { // Multiple Spawn Events SpawnUnitEvent e = new SpawnUnitEvent(c.TeamIndex, c.UnitIndex, new Vector2(c.X, c.Z)); for(int i = 0; i < c.Count; i++) ApplyInput(s, dt, e); }
private void ApplyInput(GameState s, float dt, SpawnUnitEvent e) { RTSTeam team = s.teams[e.Team]; RTSUnit unit = team.AddUnit(e.Type, e.Position); // Check If A Unit Was Possible if(unit == null) { return; } s.EntityHashSet.Add(unit.UUID, unit); // Add Decision Tasks AddTask(s, unit); // Add A Single Unit Squad RTSSquad squad = team.AddSquad(); squad.Add(unit); squad.RecalculateGridPosition(); AddTask(s, squad); }