Exemple #1
0
        public Objective LoadObjective(ObjectiveData objectiveData)
        {
            ObjectiveDefinition objectiveDefinition = _objectiveDefinitions.FirstOrDefault(x => x.ObjectiveType == objectiveData.Type);

            if (objectiveDefinition != null)
            {
                return(objectiveDefinition.LoadObjective(objectiveData));
            }
            return(null);
        }
Exemple #2
0
        public Mission GenerateMission()
        {
            Mission mission        = new Mission();
            var     objectiveTypes = Enum.GetValues(typeof(EMissionObjectiveType));
            EMissionObjectiveType objectiveType       = (EMissionObjectiveType)objectiveTypes.GetValue(UnityEngine.Random.Range(0, objectiveTypes.Length));
            ObjectiveDefinition   objectiveDefinition = _objectiveDefinitions.FirstOrDefault(x => x.ObjectiveType == objectiveType);

            if (objectiveDefinition == null)
            {
                Log.Instance.WriteException(new InvalidSettingException());
                return(null);
            }
            Objective objective = objectiveDefinition.CreateObjective();

            if (objective != null)
            {
                mission.AddObjective(objective);
            }

            mission.Reward = Mathf.RoundToInt(0.8f * Mathf.Pow(200 + Random.Range(0.8f, 1.2f) * 500 * _playerMaxAchievedLayer.Value, 1 + (_playerMaxAchievedLayer.Value / 20f)) / 100f) * 100;

            return(mission);
        }