public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            yield return(new Command_Toggle
            {
                isActive = (() => (trainingType & TrainingTypes.Melee) != 0),
                toggleAction = delegate
                {
                    trainingType ^= TrainingTypes.Melee;
                    determineDesignation();
                },
                defaultDesc = "CommandTrainCombatMeleeOnlyDesc".Translate(),
                icon = TexCommand.AttackMelee,
                defaultLabel = "CommandTrainCombatMeleeOnlyLabel".Translate()
            });

            yield return(new Command_Toggle
            {
                isActive = (() => (trainingType & TrainingTypes.Ranged) != 0),
                toggleAction = delegate
                {
                    trainingType ^= TrainingTypes.Ranged;
                    determineDesignation();
                },
                defaultDesc = "CommandTrainCombatRangedOnlyDesc".Translate(),
                icon = TexCommand.Attack,
                defaultLabel = "CommandTrainCombatRangedOnlyLabel".Translate()
            });
        }
 public override void PostMapInit()
 {
     if (HugsLibUtility.HasDesignation((Thing)this, CombatTrainingDefOf.TrainCombatDesignation))
     {
         trainingType = TrainingTypes.Any;
     }
     else if (HugsLibUtility.HasDesignation((Thing)this, CombatTrainingDefOf.TrainCombatDesignationMeleeOnly))
     {
         trainingType = TrainingTypes.Melee;
     }
     else if (HugsLibUtility.HasDesignation((Thing)this, CombatTrainingDefOf.TrainCombatDesignationRangedOnly))
     {
         trainingType = TrainingTypes.Ranged;
     }
 }
Example #3
0
 public override void PostMapInit()
 {
     if (this.HasDesignation(CombatTrainingDefOf.TrainCombatDesignation))
     {
         trainingType = TrainingTypes.Any;
     }
     else if (this.HasDesignation(CombatTrainingDefOf.TrainCombatDesignationMeleeOnly))
     {
         trainingType = TrainingTypes.Melee;
     }
     else if (this.HasDesignation(CombatTrainingDefOf.TrainCombatDesignationRangedOnly))
     {
         trainingType = TrainingTypes.Ranged;
     }
 }
Example #4
0
 private Training GetTraining(UserParameter userParams, TrainingTypes trainingType)
 {
     return(TennisSettings.TennisContext.Trainings.First(x => x.level == userParams.level && x.trainingTypeId == (int)trainingType));
 }