Ejemplo n.º 1
0
        private void OnKerbalStatusChange(ProtoCrewMember pcm, ProtoCrewMember.RosterStatus oldStatus, ProtoCrewMember.RosterStatus newStatus)
        {
            if (oldStatus == ProtoCrewMember.RosterStatus.Assigned && newStatus == ProtoCrewMember.RosterStatus.Available)
            {
                FlightLog tmpLog = new FlightLog();
                foreach (FlightLog.Entry entry in pcm.careerLog.Entries.Union(pcm.flightLog.Entries))
                {
                    tmpLog.AddEntry(entry);
                }

                float xp  = KerbalRoster.CalculateExperience(pcm.careerLog);
                float xp2 = KerbalRoster.CalculateExperience(tmpLog);

                float amount = (xp2 - xp) * multiplier;

                if (currency == Currency.Funds)
                {
                    Funding.Instance.AddFunds(amount, TransactionReasons.Strategies);
                }
                else if (currency == Currency.Reputation)
                {
                    Reputation.Instance.AddReputation(amount, TransactionReasons.Strategies);
                }
                else if (currency == Currency.Science)
                {
                    ResearchAndDevelopment.Instance.AddScience(amount, TransactionReasons.Strategies);
                }

                CurrencyPopup.Instance.AddPopup(currency, amount, TransactionReasons.Strategies, Parent.Config.Title, false);
            }
        }
        private void OnKerbalStatusChange(ProtoCrewMember pcm, ProtoCrewMember.RosterStatus oldStatus, ProtoCrewMember.RosterStatus newStatus)
        {
            if (oldStatus == ProtoCrewMember.RosterStatus.Assigned && newStatus == ProtoCrewMember.RosterStatus.Available)
            {
                FlightLog tmpLog = new FlightLog();
                foreach (FlightLog.Entry entry in pcm.careerLog.Entries.Union(pcm.flightLog.Entries))
                {
                    tmpLog.AddEntry(entry);
                }

                float xp = KerbalRoster.CalculateExperience(pcm.careerLog);
                float xp2 = KerbalRoster.CalculateExperience(tmpLog);

                float amount = (xp2 - xp) * multiplier;

                if (currency == Currency.Funds)
                {
                    Funding.Instance.AddFunds(amount, TransactionReasons.Strategies);
                }
                else if (currency == Currency.Reputation)
                {
                    Reputation.Instance.AddReputation(amount, TransactionReasons.Strategies);
                }
                else if (currency == Currency.Science)
                {
                    ResearchAndDevelopment.Instance.AddScience(amount, TransactionReasons.Strategies);
                }

                CurrencyPopup.Instance.AddPopup(currency, amount, TransactionReasons.Strategies, Parent.Config.Title, false);
            }
        }
        void generateCrew(string kerbalTrait, ProtoCrewMember.Gender gender)
        {
            ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.GetNewKerbal(ProtoCrewMember.KerbalType.Crew);

            while (crew.trait != kerbalTrait)
            {
                crew = HighLogic.CurrentGame.CrewRoster.GetNewKerbal(ProtoCrewMember.KerbalType.Crew);
            }
            crew.ChangeName(crewName);
            crew.type            = ProtoCrewMember.KerbalType.Crew;
            crew.gender          = gender;
            crew.experienceLevel = 5;
            FlightLog flight = new FlightLog();

            flight.AddEntry("Land,Eeloo");
            flight.AddEntry("Land,Dres");
            flight.AddEntry("Land,Pol");
            flight.AddEntry("Land,Gilly");
            flight.AddEntry("Land,Tylo");
            flight.AddEntry("Land,Bop");
            flight.AddEntry("Land,Vall");
            flight.AddEntry("Land,Laythe");
            crew.careerLog.AddFlight();
            for (int i = flight.Entries.Count - 1; i >= 0; --i)
            {
                FlightLog.Entry entries = flight.Entries[i];
                crew.careerLog.AddEntry(entries);
            }
            for (int i = FlightGlobals.Vessels.Count - 1; i >= 0; --i)
            {
                Vessel vessel = FlightGlobals.Vessels[i];
                if (vessel.vesselName == "Kerbin Station")
                {
                    for (int j = vessel.Parts.Count - 1; j >= 0; --j)
                    {
                        Part part = vessel.Parts[j];
                        if (part.protoModuleCrew.Count < part.CrewCapacity)
                        {
                            part.AddCrewmember(crew);
                            part.Actions.part.SpawnIVA();
                            CameraManager.Instance.SetCameraMap();
                            CameraManager.Instance.SetCameraFlight();
                            break;
                        }
                    }
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        public static void GenerateCrew()
        {
            int i;

            crewToHire = new List <ProtoCrewMember>();
            for (i = crewToHire.Count; i <= 5;)
            {
                ProtoCrewMember crew = HighLogic.CurrentGame.CrewRoster.GetNewKerbal();
                crew.type            = ProtoCrewMember.KerbalType.Crew;
                crew.experienceLevel = Math.Abs(UnityEngine.Random.Range(0, 6));
                FlightLog flight = new FlightLog();
                if (crew.experienceLevel >= 1)
                {
                    flight.AddEntry("Orbit,Kerbin");
                }
                if (crew.experienceLevel >= 2)
                {
                    flight.AddEntry("Land,Duna");
                }
                if (crew.experienceLevel >= 3)
                {
                    flight.AddEntry("Land,Ike");
                }
                if (crew.experienceLevel >= 4)
                {
                    flight.AddEntry("Land,Pol");
                }
                if (crew.experienceLevel >= 5)
                {
                    flight.AddEntry("Land,Eeloo");
                    flight.AddEntry("Land,Dres");
                }
                crew.careerLog.AddFlight();
                foreach (FlightLog.Entry entries in flight.Entries)
                {
                    crew.careerLog.AddEntry(entries);
                }
                crewToHire.Add(crew);
                i = crewToHire.Count;
            }
            hireCrewWindow = true;
        }