Exemplo n.º 1
0
        public override void RegisterEvents()
        {
            CampaignEvents.OnSessionLaunchedEvent.AddNonSerializedListener(this, OnSessionLaunched);
            CampaignEvents.DailyTickEvent.AddNonSerializedListener(this, OnDailyTick);
            CampaignEvents.TickEvent.AddNonSerializedListener(this, OnTick);

            CampaignEvents.KingdomCreatedEvent.AddNonSerializedListener(this, kingdom =>
            {
                GameObjects.Add(new GameObject
                {
                    GameObjectType = GameObjectType.Kingdom,
                    StringId       = kingdom.StringId
                });
            });

            CampaignEvents.KingdomDestroyedEvent.AddNonSerializedListener(this, kingdom =>
            {
                GameObjects.RemoveAll(g => g.GameObjectType == GameObjectType.Kingdom && g.StringId == kingdom.StringId);
                KingdomHelper.RemoveKingdom(kingdom);
            });

            CampaignEvents.OnClanDestroyedEvent.AddNonSerializedListener(this, clan =>
            {
                GameObjects.RemoveAll(g => g.GameObjectType == GameObjectType.Clan && g.StringId == clan.StringId);
            });
        }