コード例 #1
0
        public void RewindMakeInvisible(Game g, GameEventState oldstate)
        {
#if (DEBUG_EVENTS)
            Console.WriteLine("RewindMakeInvisible");
#endif
            g.EntityManager.Add(this);
        }
コード例 #2
0
        public void Create(Game g, GameEventState oldstate)
        {
#if (DEBUG_EVENTS)
            Console.WriteLine("Create: {0}", pos.CurrentPosition);
#endif
            g.EntityManager.Add(this);
        }
コード例 #3
0
        public void MakeInvisible(Game g, GameEventState oldstate)
        {
#if (DEBUG_EVENTS)
            Console.WriteLine("MakeInvisible: {0}", pos.CurrentPosition);
#endif
            g.EntityManager.Remove(this);
        }
コード例 #4
0
        public void RewindDestroy(Game g, GameEventState oldstate)
        {
#if (DEBUG_EVENTS)
            Console.WriteLine("RewindDestroy");
#endif
            g.EntityManager.Add(this);
        }
コード例 #5
0
        public void RewindCreate(Game g, GameEventState oldstate)
        {
#if (DEBUG_EVENTS)
            Console.WriteLine("RewindCreate");
#endif
            g.EntityManager.Remove(this);
        }
コード例 #6
0
ファイル: GameEvent.cs プロジェクト: SAProgClub/BulletHell
 public GameEvent(double time, GameEventRunner doer, GameEventRunner rwnd, GameEventRunner undo)
 {
     Time        = time;
     this.doer   = doer;
     this.rewind = rwnd;
     this.undo   = undo;
     state       = GameEventState.Unprocessed;
 }
コード例 #7
0
        public bool Unpack(BinaryReader reader)
        {
            Name = Util.ReadString(reader, true);

            StartTime = reader.ReadInt32();
            EndTime   = reader.ReadInt32();

            GameEventState = (GameEventState)reader.ReadInt32();

            return(true);
        }
コード例 #8
0
ファイル: GameEvent.cs プロジェクト: SAProgClub/BulletHell
 public void Do(Game g)
 {
     if (state == GameEventState.Undone)
     {
         throw new InvalidOperationException();
     }
     if (state == GameEventState.Processed)
     {
         return;
     }
     doer(g, state);
     state = GameEventState.Processed;
 }
コード例 #9
0
ファイル: GameEvent.cs プロジェクト: SAProgClub/BulletHell
        public void Undo(Game g)
        {
            switch (state)
            {
            case GameEventState.Undone:
                return;

            case GameEventState.Unprocessed:
                return;

            default:
                undo(g, state);
                break;
            }
            state = GameEventState.Undone;
        }
コード例 #10
0
ファイル: GameEvent.cs プロジェクト: SAProgClub/BulletHell
        public void Rewind(Game g)
        {
            switch (state)
            {
            case GameEventState.Undone:
                throw new InvalidOperationException();

            case GameEventState.Unprocessed:
                return;

            case GameEventState.Rewound:
                return;

            case GameEventState.Processed:
                rewind(g, state);
                break;
            }
            state = GameEventState.Rewound;
        }
コード例 #11
0
ファイル: GameEventHub.cs プロジェクト: darthdeus/HexMage.NET
        public async Task <int> SlowMainLoop(Func <bool> turnEndFunc, Action gameFinishedFunc)
        {
            // Wait for GUI initialization
            await Task.Delay(TimeSpan.FromSeconds(1));

            State = GameEventState.SettingUpTurn;

            var state = _gameInstance.State;

            _gameInstance.Reset();

            int totalTurns = 0;

            state.SlowUpdateIsFinished(_gameInstance.MobManager);

            while (!_gameInstance.IsFinished)
            {
                while (IsPaused)
                {
                    await Task.Delay(TimeSpan.FromMilliseconds(100));
                }

                totalTurns++;

                await _gameInstance.CurrentController.SlowPlayTurn(this);

                ActionEvaluator.FNoCopy(_gameInstance, UctAction.EndTurnAction());

                turnEndFunc();
                await Task.Delay(200);
            }

            ReplayRecorder.Instance.SaveAndClear(_gameInstance);
            Console.WriteLine(Constants.GetLogBuffer());

            gameFinishedFunc();

            return(totalTurns);
        }
コード例 #12
0
 public void UndoMakeInvisible(Game g, GameEventState oldstate)
 {
     g.EntityManager.Add(this);
     iTime        = -1;
     invisibility = null;
 }
コード例 #13
0
 public void UndoDestroy(Game g, GameEventState oldstate)
 {
     g.EntityManager.Add(this);
     dTime       = -1;
     destruction = null;
 }
コード例 #14
0
 public void UndoCreate(Game g, GameEventState oldstate)
 {
     g.EntityManager.RemovePermanently(this);
 }
コード例 #15
0
ファイル: GameMain.cs プロジェクト: HEIENTAI/SoulOfSword
    /// <summary>
    /// 用來作初始化
    /// </summary>
    void Start()
    {
        _gameGUIPanel = GameGUIPanel.Instance;

        _gameState = GameNone.Instance;
        _dataTableManager = new DataTableManager();
        _sceneManager = new SceneManager();
        _playerInput = PlayerInput.Instance;
        _cameraManager = new CameraManager();
        _gameEventManager = new GameEventManager();
        _gameEventState = new GameEventState();

        _npcUnitManager = NPCUnitManager.Instance;

        // 進入遊戲前需處理好的class,加載位置可能要換
        _startDependencies.Add(_dataTableManager);
    }
コード例 #16
0
ファイル: GameMain.cs プロジェクト: HEIENTAI/SoulOfSword
 void OnDestroy()
 {
     _gameGUIPanel = null;
     _gameState = null;
     _dataTableManager = null;
     _sceneManager = null;
     if (_playerInput != null)
     {
         Destroy(_playerInput);
         _playerInput = null;
     }
     _cameraManager = null;
     _gameEventManager = null;
     _gameEventState = null;
     if (_npcUnitManager != null)
     {
         Destroy(_npcUnitManager);
         _npcUnitManager = null;
     }
     _instance = null;
 }