예제 #1
0
파일: Sokoban.cs 프로젝트: MartyIX/SoTh
        public new bool ProcessEvent(Int64 time, Event ev)
        {
            bool returnValue = false;

            switch (ev.what)
            {
                case EventType.goRight:
                case EventType.goLeft:
                case EventType.goUp:
                case EventType.goDown:

                    if (!host.IsSimulationActive) return true;

                    base.SetOrientation(ev.what);

                    DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[Sokoban] ProcessEvent", ev.what.ToString() + "; Raised from EventID: " + ev.EventID.ToString());
                    DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "", "[Sokoban]" + ev.ToString());

                    IGamePlugin obstruction = base.ProcessGoEvent(time, ev);

                    if (obstruction != null && obstruction.Name == "Box")
                    {
                        this.host.GameVariant.CheckRound(time, "BoxMoved", null);
                    }

                    this.host.GameVariant.CheckRound(time, "SokobanMoved", null);

                    returnValue = true;

                    break;

                case EventType.wentRight:
                case EventType.wentLeft:
                case EventType.wentUp:
                case EventType.wentDown:

                    #region wentXXX

                    base.ProcessEvent(time, ev);

                    DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[Sokoban]", "Key buffer: " + movementEventsInBuffer.ToString() +
                        " / " + MAX_EVENTS_IN_KB.ToString());

                    if (heldKeyEvent != EventType.none && movementEventsInBuffer == 0 && timeWholeMovementEnds <= time)
                    {
                        EventType newEvent = heldKeyEvent;
                        DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[Sokoban]", "Raised from EventID = " + ev.EventID.ToString());
                        base.MakePlan("SokRepMvmt", ev.when, ev.who, newEvent);
                    }

                    returnValue = true;
                    break;

                    #endregion wentXXX

                case EventType.hitToTheWall:

                    return processHitToWall();

                default:
                    returnValue = base.ProcessEvent(time, ev);
                    break;
            }

            return returnValue;
        }
예제 #2
0
파일: Monster.cs 프로젝트: MartyIX/SoTh
        public new bool ProcessEvent(Int64 time, Event ev)
        {
            bool returnValue = false;

            switch (ev.what)
            {
                case EventType.goRight:
                case EventType.goLeft:
                case EventType.goUp:
                case EventType.goDown:

                    if (!host.IsSimulationActive) return true;

                    base.SetOrientation(ev.what);

                    DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "[Sokoban] ProcessEvent", ev.what.ToString() + "; Raised from EventID: " + ev.EventID.ToString());
                    DebuggerIX.WriteLine(DebuggerTag.SimulationNotableEvents, "", "[Sokoban]" + ev.ToString());

                    IGamePlugin obstruction = base.ProcessGoEvent(time, ev);

                    returnValue = true;

                    break;

                case EventType.pursuit:

                    if (!host.IsSimulationActive) return true;

                    ProcessPursuitEvent(time, ev);

                    return true;

                case EventType.wentRight:
                case EventType.wentLeft:
                case EventType.wentUp:
                case EventType.wentDown:

                    base.ProcessEvent(time, ev);
                    MakePlan("MonsterPursuit", time, this, EventType.pursuit);

                    return true;

                default:
                    returnValue = base.ProcessEvent(time, ev);
                    break;
            }

            return returnValue;
        }