Inheritance: IInitializeSystem, IExecuteSystem, ICleanupSystem, ITearDownSystem
    public void SetUp()
    {
        _context = new Contexts();
        _context.game.SetDeltaTime(0f);

        _deltaTimeUpdateSystem = new DeltaTimeUpdateSystem(10, _context.game);
        _systems = new Feature("Game").Add(_deltaTimeUpdateSystem);
    }
        void Awake()
        {
            _systems = CreateSystems(Pools.pool);
            _systems.Initialize();

            CreateGame();
            
           
        }
        public override Systems CreateUpdateSystems(IContexts contexts)
        {
            Contexts _contexts = (Contexts)contexts;

            var systems = new Entitas.Systems();

            systems.Add(new RequestSnapshotSystem(_contexts, this));

            return(systems);
        }
        public override Systems CreateUpdateSystems(IContexts contexts)
        {
            Contexts _contexts = (Contexts)contexts;

            var systems = new Entitas.Systems();

            systems.Add(new RequestSceneInfoSystem(_contexts, this));
            /*MakeWeaponLogicManager(_contexts);*/
            return(systems);
        }
Example #5
0
    private void Start()
    {
        _contexts = Contexts.sharedInstance;
        _systems  = CreateSystems(_contexts);
        _systems.Initialize();
        GameEntity mover = _contexts.game.CreateEntity();

        mover.isMover = true;
        mover.AddPosition(Vector2.zero);
        mover.AddDirection(Random.Range(0, 360));
        mover.AddSprite("Bee");
        mover.AddColour(0);
    }
Example #6
0
    // Use this for initialization
    void Start()
    {
        //first init system (important, because I want systems to exist before any entities are created):
        _systems = new RootSystem(Contexts.sharedInstance);
        _systems.Initialize();

        HexGridBehaviour grid   = GameObject.FindObjectOfType <HexGridBehaviour>();
        GameContext      game   = Contexts.sharedInstance.game;
        Presets          preset = new Presets(game, grid);

        TurnGridToEntities(game, grid);
        FindEntitiesInUnity(game, preset);
        SetupPlayers(game, preset, grid);
    }
        //-------------------------------------------------
        //	UNITY FUNCTIONS
        //-------------------------------------------------
        void Awake()
        {
            PhotonNetwork.autoJoinLobby          = false;
            PhotonNetwork.automaticallySyncScene = true;

            _contexts      = Contexts.sharedInstance;
            _systems       = new Feature("Launcher Systems");
            _serverSystems = new Feature("Server Systems");

            _systems.Add(new ModifyPseudoSystem(_contexts, PseudoField));
            _systems.Add(new ValidateButtonSystem(_contexts, ValidateButton));
            _systems.Add(new ConnectionSystem(_contexts, this, Settings));
            _systems.Add(new ConnectionUiSystem(_contexts, LoadingScreen));

            _serverSystems.Add(new LoadingLobbySystem(_contexts, Settings));
        }
Example #8
0
        public override Systems CreateUpdateSystems(IContexts contexts)
        {
            Contexts _contexts = (Contexts)contexts;

            //SingletonManager.Get<MapConfigManager>().SetCurrentMap(_contexts.session.clientSessionObjects.MapId);

            _gameModule = CreateCompositeGameModule(_contexts);
            var systems = new Entitas.Systems();

            systems.Add(new ClientPreLoginFeature(
                            "PreLoginState",
                            _gameModule,
                            _contexts.session.commonSession
                            ));
            return(systems);
        }
        public override Systems CreateUpdateSystems(IContexts contexts)
        {
            Contexts _contexts = (Contexts)contexts;

            //SingletonManager.Get<MapConfigManager>().SetCurrentMap(_contexts.session.clientSessionObjects.MapId);

            var gameModule = new SubResourceConfigurationInitModule(this);
            var systems    = new Entitas.Systems();

            systems.Add(new ClientPreLoginFeature(
                            "SubResourceLoad",
                            gameModule,
                            _contexts.session.commonSession
                            ));
            return(systems);
        }
        internal void Begin()
        {
            //
            // mmGame calls Begin() before a new scene window is created
            //
            SceneColliderDatabase.Initialize();

            //
            // Allow Entitas to init systems, auto collect matched systems, no manual Systems.Add(ISystem) required
            //
            EntitySystems = new Entitas.Feature(null);                           //game entities
            EntitySystems.Initialize();

            //SceneSystems = new Entitas.Feature(null);               //scene UI entities
            //SceneSystems.Initialize();
            OnStart();
        }
        public override Systems CreateUpdateSystems(IContexts contexts)
        {
            Contexts _contexts = (Contexts)contexts;

            //SingletonManager.Get<MapConfigManager>().SetCurrentMap(_contexts.session.clientSessionObjects.MapId);

            _gameModule = CreateCompositeGameModule(_contexts);
            var systems = new Entitas.Systems();

            systems.Add(new LocalizeSessionSystem(this, _contexts.session.commonSession.AssetManager));
            systems.Add(new BaseConfigurationInitModule(this, _contexts.session.commonSession.AssetManager));
            systems.Add(new ClientPreLoginFeature(
                            "BasePreparing",
                            _gameModule,
                            _contexts.session.commonSession
                            ));
            return(systems);
        }
Example #12
0
        private void SetupSystems()
        {
            //a feature is a group of systems
            _pausableUpdateSystems = new Feature();

            _pausableUpdateSystems.Add(_pool.CreateSystem <StartNextRoundSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <VelocitySystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <AcceptInputSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <AISystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <GoalSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <DestroySystem> ());

            //	'Collision' as NOT physics based - as an example
            _pausableUpdateSystems.Add(_pool.CreateSystem <BoundsBounceSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <BoundsConstrainSystem> ());
            _pausableUpdateSystems.Initialize();
            _pausableUpdateSystems.ActivateReactiveSystems();


            _pausableFixedUpdateSystems = new Feature();
            //  'Collision as Physics based - as an example.
            _pausableFixedUpdateSystems.Add(_pool.CreateSystem <CollisionSystem> ());
            _pausableFixedUpdateSystems.Initialize();
            _pausableFixedUpdateSystems.ActivateReactiveSystems();


            //for demo only, an example of an unpausable system
            _unpausableUpdateSystems = new Feature();
            _unpausableUpdateSystems.Add(_pool.CreateSystem <TimeSystem> ());
            _unpausableUpdateSystems.Initialize();
            _unpausableUpdateSystems.ActivateReactiveSystems();

            // This is custom and optional. I use it to store the systems in case I need them again.
            // This is the only place I put a component directly on a _pool. It is supported.
            // I'm not sure this is useful, but I saw something similar in Entitas presentation slides - srivello
            _pool.SetEntitas
            (
                _pausableUpdateSystems,
                _unpausableUpdateSystems,
                _pausableUpdateSystems
            );
            //Debug.Log("pausableUpdateSystems: " + Pools.pool.entitas.pausableUpdateSystems);
        }
Example #13
0
        private void SetupSystems()
        {
            //a feature is a group of systems
            _unpausableUpdateSystems = new Feature();
            _unpausableUpdateSystems.Add(_pool.CreateSystem <VelocitySystem> ());
            _unpausableUpdateSystems.Add(_pool.CreateSystem <AcceptInputSystem> ());
            _unpausableUpdateSystems.Add(_pool.CreateSystem <DestroySystem> ());

            _unpausableUpdateSystems.Initialize();
            _unpausableUpdateSystems.ActivateReactiveSystems();

            // I'm not sure this is useful, but I saw something similar in Entitas presentation slides - srivello
            _pool.SetEntitas
            (
                null,
                _unpausableUpdateSystems,
                null
            );
            //Debug.Log("pausableUpdateSystems: " + Pools.pool.entitas.unpausableUpdateSystems);
        }
Example #14
0
    private void Awake()
    {
        services = new Services.Services
        {
            Time = new UnityTimeService(),
            CollidingViewRegister = new UnityCollidingViewRegister(),
            InputService          = new StandaloneInputService(),
        };

        systems = new MazeFeature
                  (
            Contexts.sharedInstance.game,
            Contexts.sharedInstance.meta,
            Contexts.sharedInstance.input,
            services,
            Prefabs
                  );

        systems.Initialize();
    }
Example #15
0
        public GameController(Context ctx) : base(ctx)
        {
            _systems        = new Entitas.Systems();
            _indexsystem    = new IndexSystem(Contexts.sharedInstance.game);
            _mapsystem      = new MapSystem(Contexts.sharedInstance.game);
            _joinsystem     = new JoinSystem(Contexts.sharedInstance.game);
            _myplayersystem = new MyPlayerSystem(Contexts.sharedInstance.game);
            _systems.Add(_indexsystem)
            .Add(_mapsystem)
            .Add(_joinsystem)
            .Add(_myplayersystem);


            // 4, protocol
            _syncmsg1 = new byte[4];
            NetPack.Packli(_syncmsg1, 0, 1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_MAP, SetupMap);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);

            //EventListenerCmd listener3 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_VIEW, SetupCamera);
            //_ctx.EventDispatcher.AddCmdEventListener(listener3);
        }
 private void Start()
 {
     Random.seed = 42;
     systems = ActiveSystems.GetSystems(Pools.pool);
     systems.Initialize();
 }