Esempio n. 1
0
        public override void RemoveOutcome(Vessel vessel)
        {
            ProtoCrewMember[] astronauts    = null;
            AstronautData     astronautData = null;

            //Get the crew manifest
            if (vessel.loaded)
            {
                astronauts = vessel.GetVesselCrew().ToArray();
            }
            else
            {
                astronauts = vessel.protoVessel.GetVesselCrew().ToArray();
            }

            //Go through each kerbal and set their condition
            for (int index = 0; index < astronauts.Length; index++)
            {
                astronautData = SnacksScenario.Instance.GetAstronautData(astronauts[index]);

                //If the vessel is loaded then restore skills
                if (vessel.loaded)
                {
                    SnacksScenario.Instance.RestoreSkillsIfNeeded(astronauts[index]);
                }

                astronautData.ClearCondition(conditionName);
            }

            //Call base class
            base.RemoveOutcome(vessel);
        }
Esempio n. 2
0
        protected void onRosterResourceUpdated(Vessel vessel, SnacksRosterResource rosterResource, AstronautData astronautData, ProtoCrewMember astronaut)
        {
            //Make sure it's a resource we're interested in.
            if (!rosterResource.resourceName.Contains(StressConditionName))
            {
                return;
            }

            //If the resource has gone down below max, then remove the stress condition.
            if (rosterResource.amount < rosterResource.maxAmount && astronautData.conditionSummary.Contains(StressConditionName))
            {
                astronautData.ClearCondition(StressConditionName);
                SnacksScenario.Instance.RestoreSkillsIfNeeded(astronaut);
                ScreenMessages.PostScreenMessage(astronaut.name + " " + StressRecoveryMessage, 5.0f, ScreenMessageStyle.UPPER_LEFT);
            }

            //If the resource has maxed out then add the stress condition
            else if (rosterResource.amount >= rosterResource.maxAmount && !astronautData.conditionSummary.Contains(StressConditionName))
            {
                astronautData.SetCondition(StressConditionName);
                SnacksScenario.Instance.RemoveSkillsIfNeeded(astronaut);
                ScreenMessages.PostScreenMessage(vessel.vesselName + ": " + astronaut.name + " " + StressPlayerMessage, 5.0f, ScreenMessageStyle.UPPER_LEFT);
            }
        }