예제 #1
0
        public static void LetPlayerEnterTownGate(Player p1, Player p2, Location destination)
        {
            GameEngine.SayToLocation(p1.Location, $"{p2.Name} stoically looks you up and down then signals the gatekeeper.");
            LocationConnector portcullis = p1.Location.GetConnector(destination);

            portcullis.Unlock();
            GameEngine.SayToLocation(p1.Location, $"The massive portcullis rattles as it raises up.");
            portcullis.SetTickEvent(new ConnectorSelfEvent(ConnectorEventTemplates.ClosePortcullisOnCountdown, countdown: 2));
        }
예제 #2
0
        public static void ClosePortcullisOnCountdown(LocationConnector connector)
        {
            int timeLeft = connector.OnTickEvent.CountdownTick();

            if (connector.OnTickEvent.TimesUp)
            {
                connector.Lock();
                GameEngine.SayToLocation(connector.Parent, "The portcullis into the town comes crashing down!");
                GameEngine.SayToLocation(connector.Destination, "The portcullis into the town comes crashing down!");
                connector.ClearTickEvent();
            }
        }
예제 #3
0
        public static void TravelFromPointToPoint(Player player, Location startingPoint, Location destination, string exitText = "", string enterText = "")
        {
            if (player == null)
            {
                throw new ArgumentNullException($"{MethodBase.GetCurrentMethod().ReflectedType.Name}, null player");
            }
            if (destination == null)
            {
                throw new ArgumentNullException($"{MethodBase.GetCurrentMethod().ReflectedType.Name}, null starting location");
            }
            if (destination == null)
            {
                throw new ArgumentNullException($"{MethodBase.GetCurrentMethod().ReflectedType.Name}, null ending location");
            }
            if (exitText == "")
            {
                exitText = $"{player.Name} leaves {startingPoint} and heads for {destination}.";
            }
            if (enterText == "")
            {
                enterText = $"{player.Name} enters {destination} from {startingPoint}.";
            }

            if (player.IsAlive && player.Location == startingPoint)
            {
                LocationConnector exitConnector = startingPoint.GetConnector(destination);
                if (exitConnector == null || (exitConnector.IsUnlocked))
                {
                    exitConnector.OnPlayerExit.PerformAction(player);
                    GameEngine.SayToLocation(player.Location, exitText);
                    player.Relocate(destination);
                    GameEngine.SayToLocation(player.Location, enterText);
                    LocationConnector enterConnector = destination.GetConnector(startingPoint);
                    enterConnector.OnPlayerEnter.PerformAction(player);
                }
                else
                {
                    GameEngine.SayToLocation(player.Location, $"{player.Name} tries to go to {destination.Name} but the way is locked.");
                }
            }
            else
            {
                GameEngine.SayToLocation(player.Location, $"{player.Name} was travelling but got interrupted.");
            }
        }
예제 #4
0
 public static void DoNothing(LocationConnector connector)
 {
 }
예제 #5
0
 public void PerformAction(LocationConnector connector)
 {
     this.PerformedAction(connector);
 }