예제 #1
0
 void OnCharacterSimulationFinished(CharacterSimulator entity)
 {
     entity.OnSimulationFinished -= OnCharacterSimulationFinished;
     simulatedEntities.Remove(entity);
     if (simulatedEntities.Count == 0)
     {
         Destroy(this);
         OnSimulationFinished(this);
     }
 }
예제 #2
0
    public void LaunchSimulation()
    {
        Simulation             simulation = ScriptableObject.CreateInstance <Simulation>();
        List <SimulationOrder> orders     = new List <SimulationOrder>();

        foreach (Cell cell in paths.Keys)
        {
            CharacterSimulator character = GridManager.GetEntityAt <CharacterSimulator>(cell);
            SimulationOrder    order;
            order.Character = character;
            order.Path      = paths[cell];
            orders.Add(order);
        }
        simulation.OnSimulationFinished += OnSimulationFinished;
        simulation.LaunchSimulation(orders);
        ClearAllPaths();
        enabled = false;
    }