Пример #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;
    }
Пример #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();
        }
Пример #3
0
    private void AddServerSim()
    {
        Simulation sim = new Simulation(Const.SERVER_SIMULATION_ID);

        sim.AddBehaviour(new ServerLogicFrameBehaviour());
        SimulationManager.Instance.AddSimulation(sim);
    }