public static void EventHandler(string script) { var e = new PartyEvent(script); switch (script) { case BEFORE_JOIN: BeforeJoinParty(e); break; case AFTER_JOIN: AfterJoinParty(e); break; case BEFORE_LEAVE: BeforeLeaveParty(e); break; case AFTER_LEAVE: AfterLeaveParty(e); break; case BEFORE_KICK: BeforeKickPartyMember(e); break; case AFTER_KICK: AfterKickPartyMember(e); break; case BEFORE_NEW_LEADER: BeforeTransferLeadership(e); break; case AFTER_NEW_LEADER: AfterTransferLeadership(e); break; default: break; } }
public void tryToBuyFood(Food food) { if (Started == true) { return; } if (food is Pizza) { Pizza pizza = food as Pizza; if (pizza.Price <= Budget) { PartyEvent?.Invoke("Successfully buying"); pizza.AddMessageToEvent("Successfully buying"); if (PartyStatus == TypeParty.PizzaParty) { PartyMood += 10; } else { PartyMood -= 5; } Budget -= pizza.Price; } else { pizza.AddMessageToEvent("Unsuccesfully buying:("); PartyEvent?.Invoke("Unsuccesfully buying:("); } } else { if (((Burger)food).Price <= Budget) { PartyEvent?.Invoke("Successfully buying burger"); if (PartyStatus == TypeParty.BurgerParty) { PartyMood += 10; } else { PartyMood -= 5; } Budget -= ((Burger)food).Price; } else { PartyEvent?.Invoke("Unsuccesfully buying burger:("); } } }
public PartyGameEvent(PartyEvent e) : base(e.Event) { PartyID = e.PartyID; }