Example #1
0
            public void FixProblems(ScenarioShip ship)
            {
                if (Metal + Gold + Silicon + Food + Water >= CargoSpace)
                {
                    int i = 0;
                    while (Metal + Gold + Silicon + Food + Water >= CargoSpace)
                    {
                        switch (i)
                        {
                        case 0:
                            Metal--;
                            break;

                        case 1:
                            Gold--;
                            break;

                        case 2:
                            Silicon--;
                            break;

                        case 3:
                            Food--;
                            break;

                        case 4:
                            Water--;
                            break;
                        }

                        i++;
                        if (i > 4)
                        {
                            i = 0;
                        }
                    }
                }

                if (Credits < 0)
                {
                    Credits = 0;
                }
            }
Example #2
0
            public void FixProblems(ScenarioShip ship)
            {
                if (GameObject.Find("Manager").GetComponent <ManagerOptions>().namesMaleList == null || GameObject.Find("Manager").GetComponent <ManagerOptions>().namesMaleList.Count == 0)
                {
                    GameObject.Find("Manager").GetComponent <ManagerOptions>().buildGameDictionary();
                    GameObject.Find("Manager").GetComponent <ManagerOptions>().buildGameNames();
                }

                if (maleNameList == null)
                {
                    maleNameList = GameObject.Find("Manager").GetComponent <ManagerOptions>().namesMaleList.ToArray();
                }

                if (femaleNameList == null)
                {
                    femaleNameList = GameObject.Find("Manager").GetComponent <ManagerOptions>().namesFemaleList.ToArray();
                }


                if (Gender == CrewGender.Random)
                {
                    Gender = (CrewGender)UnityEngine.Random.Range(1, 2);
                }

                if (String.IsNullOrEmpty(Name))
                {
                    if (Gender == CrewGender.Male)
                    {
                        Name = maleNameList[UnityEngine.Random.Range(0, maleNameList.Length - 1)];
                    }
                    else
                    {
                        Name = femaleNameList[UnityEngine.Random.Range(0, femaleNameList.Length - 1)];
                    }
                }

                if (Agility + Endurance + Engineering + Intelligence + Combat == 0)
                {
                    Agility = Endurance = Engineering = Intelligence = Combat = 1;
                    int pointsToDistribute = ship.MaxCrewPoints;
                    while (pointsToDistribute > 0)
                    {
                        int skill = UnityEngine.Random.Range(0, 5);

                        if (skill == 0 && Agility < 3)
                        {
                            Agility++;
                            pointsToDistribute--;
                        }
                        else if (skill == 1 && Endurance < 3)
                        {
                            Endurance++;
                            pointsToDistribute--;
                        }
                        else if (skill == 2 && Engineering < 3)
                        {
                            Engineering++;
                            pointsToDistribute--;
                        }
                        else if (skill == 3 && Intelligence < 3)
                        {
                            Intelligence++;
                            pointsToDistribute--;
                        }
                        else if (skill == 4 && Combat < 3)
                        {
                            Combat++;
                            pointsToDistribute--;
                        }
                    }
                }

                Agility      = FixPoints(Agility);
                Endurance    = FixPoints(Endurance);
                Engineering  = FixPoints(Engineering);
                Intelligence = FixPoints(Intelligence);
                Combat       = FixPoints(Combat);

                if (HairColor == null)
                {
                    HairColor = new Color(GameObject.Find("TileMap").GetComponent <Crew>().returnRandomHairColor());
                }

                if (HeadColor == null)
                {
                    HeadColor = new Color(GameObject.Find("TileMap").GetComponent <Crew>().returnRandomHeadColor());
                }

                if (HairType < 1 || HairType > 32)
                {
                    HairType = UnityEngine.Random.Range(1, 32);
                }

                if (HeadType < 1 || HeadType > 32)
                {
                    HeadType = UnityEngine.Random.Range(1, 32);
                }

                if (BodyType < 1 || BodyType > 32)
                {
                    BodyType = UnityEngine.Random.Range(2, 32);
                }

                if (FaceType < 1 || FaceType > 32)
                {
                    FaceType = UnityEngine.Random.Range(17, 25);
                }
            }