示例#1
0
 public EntitiesSynchronizer(BloodAndBileEngine.WorldState.WorldState worldState)
 {
     LocalWorldState = worldState;
     EntityFactory   = new BloodAndBileEngine.WorldState.WorldStateData.WorldEntityFactory(LocalWorldState);
     LocalWorldState.AddData(EntityFactory);
     BloodAndBileEngine.InputManager.AddHandler("CreateEntity", OnCreateEntityCommand);
     BloodAndBileEngine.InputManager.AddHandler("DestroyEntity", OnDestroyEntityCommand);
 }
示例#2
0
        public override void Initialise(WorldState.WorldState worldState)
        {
            if (!CommandsInitialised)
            {
                InitialiseCommands();
            }

            CurrentSpell  = null;
            SpellKeyCodes = new Dictionary <uint, UnityEngine.KeyCode>();
            if (SpellsManager.SpellsCount < 1)
            {
                SpellsManager.GetSpellByID(0); // Pour initialiser le tableau de Spells s'il ne l'était pas déjà
            }
            for (uint i = 0; i < SpellsManager.SpellsCount && i < 9; i++)
            {
                AddSpellKeyCode(i, UnityEngine.KeyCode.Alpha1 + (int)i);
                Debugger.Log("Sort d'ID " + i + " associé à la touche " + (UnityEngine.KeyCode.Alpha1 + (int)i).ToString(), UnityEngine.Color.magenta);
            }
            SelectedSpellId = 0;
        }
示例#3
0
    public static Match CreateMatch(int[] players)
    {
        Match m = new Match();

        m.SetPlayerConnectionIDs(players);
        m.AddModule <MapStateModule>(new MapStateModule(m));       // Création du World State lié au match
        m.AddModule <EntitiesManagerModule>(new EntitiesManagerModule(m));
        m.AddModule <StateUpdateModule>(new StateUpdateModule(m)); // Création du module StateUpdate
        m.AddModule <MatchOutcomeManagerModule>(new MatchOutcomeManagerModule(m));

        // Création du WorldState initial.

        BloodAndBileEngine.WorldState.WorldState startWorldState = m.GetModule <MapStateModule>().GetWorldState();
        // Objectif : initialise le startWorldState en fonction des informations dont on dispose.

        // INITIALISER TOUS LES WorldStateData ici !


        // Ajout du EntityFactory
        BloodAndBileEngine.WorldState.WorldStateData.WorldEntityFactory factory = new BloodAndBileEngine.WorldState.WorldStateData.WorldEntityFactory(startWorldState);
        startWorldState.AddData(factory);

        // Initialisation des cellules.

        if (BloodAndBileEngine.WorldState.Map.Maps == null)
        {
            BloodAndBileEngine.WorldState.Map.LoadMaps();
        }
        BloodAndBileEngine.WorldState.Map map = BloodAndBileEngine.WorldState.Map.Maps[UnityEngine.Random.Range(0, BloodAndBileEngine.WorldState.Map.Maps.Count)];

        // Création du CellSystem.

        BloodAndBileEngine.WorldState.CellSystem cellSystem;
        cellSystem = new BloodAndBileEngine.WorldState.CellSystem(map);
        startWorldState.AddData <BloodAndBileEngine.WorldState.CellSystem>(cellSystem);
        startWorldState.AddData <BloodAndBileEngine.WorldState.Map>(map);


        return(m);
    }
示例#4
0
 public MapStateModule(Match m) : base(m)
 {
     CurrentWorldState = new BloodAndBileEngine.WorldState.WorldState();
 }
示例#5
0
 public PlayingState()
 {
     BloodAndBileEngine.Debugger.Log("Initialisation du WorldState local...");
     LocalWorldState = new BloodAndBileEngine.WorldState.WorldState();
 }
示例#6
0
 public override void Initialise(WorldState.WorldState worldState)
 {
 }