Exemplo n.º 1
0
    void OnClickPlayReplay()
    {
        Simulation sim   = new Simulation(Const.CLIENT_SIMULATION_ID);
        var        bytes = File.ReadAllBytes(Application.dataPath + "/replay_client_-695972864.rep");
        var        info  = ReplayInfo.Read(bytes);

        sim.AddBehaviour(new ReplayLogicFrameBehaviour());
        sim.AddBehaviour(new EntityBehaviour());
        sim.AddBehaviour(new ReplayInputBehaviour());
        EntityMoveSystem      moveSystem     = new EntityMoveSystem();
        FrameClockSystem      frameClock     = new FrameClockSystem();
        EntityCollisionSystem colliderSystem = new EntityCollisionSystem();
        RemoveEntitySystem    removeSystem   = new RemoveEntitySystem();

        sim.GetBehaviour <EntityBehaviour>().
        AddSystem(moveSystem).
        AddSystem(frameClock).
        AddSystem(colliderSystem).
        AddSystem(removeSystem);
        sim.GetBehaviour <ReplayLogicFrameBehaviour>().SetFrameIdxInfos(info.Frames);

        SimulationManager.Instance.AddSimulation(sim);
        SimulationManager.Instance.Start();
        IsReplayMode = true;
    }
Exemplo n.º 2
0
        void OnAddClient()
        {
            Debugger.UF_Log("OnAddClient----------------------->>>");
            //add a client simulation
            Simulation sim = new Simulation(Const.CLIENT_SIMULATION_ID);

            sim.AddBehaviour(new LogicFrameBehaviour());
            sim.AddBehaviour(new RollbackBehaviour());
            sim.AddBehaviour(new EntityBehaviour());
            sim.AddBehaviour(new InputBehaviour());
            //sim.AddBehaviour(new TestRandomInputBehaviour());
            sim.AddBehaviour(new ComponentsBackupBehaviour());
            EntityMoveSystem      moveSystem     = new EntityMoveSystem();
            FrameClockSystem      frameClock     = new FrameClockSystem();
            EntityCollisionSystem colliderSystem = new EntityCollisionSystem();
            RemoveEntitySystem    removeSystem   = new RemoveEntitySystem();

            sim.GetBehaviour <EntityBehaviour>().
            AddSystem(moveSystem).
            AddSystem(frameClock).
            AddSystem(colliderSystem).
            AddSystem(removeSystem);
            sim.GetBehaviour <RollbackBehaviour>().
            AddSystem(moveSystem).
            AddSystem(frameClock);
            //AddSystem(colliderSystem).
            //AddSystem(removeSystem);
            SimulationManager.Instance.AddSimulation(sim);

            //SimulationManager.Instance.Start();
        }
Exemplo n.º 3
0
        public GameSystemLoader(EntityWorld world,
                                // Single
                                LoadButtonConfigurationSystem loadButtonConfigurationSystem,
                                // Update
                                GravitySystem gravitySystem,
                                PhysicsSystem physicsSystem,
                                PlayerStateSystem playerStateSystem,
                                EntityCollisionSystem entityCollisionSystem,
                                LevelCollisionSystem levelCollisionSystem,
                                CameraSystem cameraSystem,
                                SpriteSystem spriteSystem,
                                HeartbeatSystem heartbeatSystem,
                                DebugSystem debugSystem,
                                DebugTextSystem debugTextSystem,
                                // Draw
                                RenderSystem renderSystem,
                                RenderLevelSystem renderLevelSystem,
                                RenderCollisionBoxSystem renderCollisionBoxSystem,
                                RenderTextSystem renderTextSystem,
                                RenderStaticGraphicSystem renderStaticGraphicSystem,
                                RenderLifeBarSystem renderLifeBarSystem)
            : base(world)
        {
            // Single
            _loadButtonConfigurationSystem = loadButtonConfigurationSystem;

            // Update
            _gravitySystem         = gravitySystem;
            _physicsSystem         = physicsSystem;
            _playerStateSystem     = playerStateSystem;
            _entityCollisionSystem = entityCollisionSystem;
            _levelCollisionSystem  = levelCollisionSystem;
            _cameraSystem          = cameraSystem;
            _spriteSystem          = spriteSystem;
            _heartbeatSystem       = heartbeatSystem;
            _debugSystem           = debugSystem;
            _debugTextSystem       = debugTextSystem;

            // Draw
            _renderSystem              = renderSystem;
            _renderLevelSystem         = renderLevelSystem;
            _renderCollisionBoxSystem  = renderCollisionBoxSystem;
            _renderTextSystem          = renderTextSystem;
            _renderStaticGraphicSystem = renderStaticGraphicSystem;
            _renderLifeBarSystem       = renderLifeBarSystem;
        }