Exemple #1
0
        private void Awake()
        {
            // Cache references
            mobileBillboard = GetComponentInChildren <MobilePersonBillboard>();

            // Need to repath if floating origin ticks while in range
            FloatingOrigin.OnPositionUpdate += FloatingOrigin_OnPositionUpdate;
        }
        /// <summary>
        /// used to set remaining fields of person (with random values) and update billboards
        /// this function should be called after race, gender and personOutfitVariant has been set beforehand
        /// </summary>
        void SetPerson()
        {
            // do several things in switch statement:
            // get person's face texture record index for this race and gender and outfit variant
            // get correct nameBankType for this race
            int[] recordIndices = null;
            NameHelper.BankTypes nameBankType;
            switch (race)
            {
            case Races.Redguard:
                recordIndices = (gender == Genders.Male) ? maleRedguardFaceRecordIndex : femaleRedguardFaceRecordIndex;
                //nameBankType = NameHelper.BankTypes.Redguard;
                break;

            case Races.Nord:
                recordIndices = (gender == Genders.Male) ? maleNordFaceRecordIndex : femaleNordFaceRecordIndex;
                //nameBankType = NameHelper.BankTypes.Nord;
                break;

            case Races.Breton:
            default:
                recordIndices = (gender == Genders.Male) ? maleBretonFaceRecordIndex : femaleBretonFaceRecordIndex;
                //nameBankType = NameHelper.BankTypes.Breton;
                break;
            }

            // create name for npc
            DFLocation.ClimateSettings climateSettings = MapsFile.GetWorldClimateSettings(GameManager.Instance.PlayerGPS.ClimateSettings.WorldClimate);
            switch (climateSettings.Names)
            {
            case FactionFile.FactionRaces.Breton:
            default:
                nameBankType = NameHelper.BankTypes.Breton;
                break;

            case FactionFile.FactionRaces.Nord:
                nameBankType = NameHelper.BankTypes.Nord;
                break;

            case FactionFile.FactionRaces.Redguard:
                nameBankType = NameHelper.BankTypes.Redguard;
                break;
            }
            this.nameNPC = DaggerfallUnity.Instance.NameHelper.FullName(nameBankType, gender);

            // get face record id to use (randomize portrait for current person outfit variant)
            int personFaceVariant = Random.Range(0, numPersonFaceVariants);

            this.personFaceRecordId = recordIndices[personOutfitVariant] + personFaceVariant;

            // set billboard to correct race, gender and outfit variant
            billboard = GetComponentInChildren <MobilePersonBillboard>();
            billboard.SetPerson(race, gender, personOutfitVariant, isGuard);
        }
        /// <summary>
        /// used to set remaining fields of person (with random values) and update billboards
        /// this function should be called after race, gender and personOutfitVariant has been set beforehand
        /// </summary>
        void SetPerson()
        {
            // get person's face texture record index for this race and gender and outfit variant
            int[] recordIndices = null;
            switch (race)
            {
            case Races.Redguard:
                recordIndices = (gender == Genders.Male) ? maleRedguardFaceRecordIndex : femaleRedguardFaceRecordIndex;
                break;

            case Races.Nord:
                recordIndices = (gender == Genders.Male) ? maleNordFaceRecordIndex : femaleNordFaceRecordIndex;
                break;

            case Races.Breton:
            default:
                recordIndices = (gender == Genders.Male) ? maleBretonFaceRecordIndex : femaleBretonFaceRecordIndex;
                break;
            }

            // get correct nameBankType for this race and create name for npc
            NameHelper.BankTypes nameBankType = NameHelper.BankTypes.Breton;
            if (GameManager.Instance.PlayerGPS.CurrentRegionIndex > -1)
            {
                nameBankType = (NameHelper.BankTypes)MapsFile.RegionRaces[GameManager.Instance.PlayerGPS.CurrentRegionIndex];
            }

            this.nameNPC = DaggerfallUnity.Instance.NameHelper.FullName(nameBankType, gender);

            // get face record id to use (randomize portrait for current person outfit variant)
            int personFaceVariant = Random.Range(0, numPersonFaceVariants);

            this.personFaceRecordId = recordIndices[personOutfitVariant] + personFaceVariant;

            // set billboard to correct race, gender and outfit variant
            billboard = GetComponentInChildren <MobilePersonBillboard>();
            billboard.SetPerson(race, gender, personOutfitVariant, isGuard);
        }