Beispiel #1
0
        /// <summary>
        ///     Called when the mission is finished.
        /// </summary>
        public void Finished()
        {
            LogicClientAvatar playerAvatar = this._level.GetPlayerAvatar();

            if (!playerAvatar.IsMissionCompleted(this._data))
            {
                Debugger.Print("Mission " + this._data.GetName() + " finished");

                playerAvatar.SetMissionCompleted(this._data, true);
                playerAvatar.GetChangeListener().CommodityCountChanged(0, this._data.GetRewardResourceData(), 1);

                this.AddRewardUnits();

                LogicResourceData rewardResourceData = this._data.GetRewardResourceData();

                if (rewardResourceData != null)
                {
                    playerAvatar.AddMisisonResourceReward(rewardResourceData, this._data.GetRewardResourceCount());
                }

                int rewardXp = this._data.GetRewardXp();

                if (rewardXp > 0)
                {
                    playerAvatar.XpGainHelper(rewardXp);
                }
            }
        }