Пример #1
0
        //called to enable a mission
        public TimeCondition Enable (GameManager gameMgr)
        {
            this.gameMgr = gameMgr;

            switch (type) //start listening to different RTS Engine events depending on the type of the mission
            {
                case Type.collectResource:

                    CustomEvents.FactionResourceUpdated += OnFactionResourceUpdated;
                    break;

                case Type.produce:

                    CustomEvents.UnitCreated += OnFactionEntityEvent;
                    CustomEvents.BuildingBuilt += OnFactionEntityEvent;
                    break;
            }

            CustomEvents.FactionEntityDead += OnFactionEntityEvent; //required for all mission types

            CurrAmount = 0; //default value for the current amount

            CustomEvents.OnMissionStart(this); //trigger custom event
            startEvent.Invoke();

            return timeCondition; //return the time condition to the manager component
        }