public static KCompBuilder.BodyData CreateBodyData(Personality p)
 {
     KCompBuilder.BodyData result = default(KCompBuilder.BodyData);
     result.eyes      = HashCache.Get().Add($"eyes_{p.eyes:000}");
     result.hair      = HashCache.Get().Add($"hair_{p.hair:000}");
     result.headShape = HashCache.Get().Add($"headshape_{p.headShape:000}");
     result.mouth     = HashCache.Get().Add($"mouth_{p.mouth:000}");
     result.neck      = HashCache.Get().Add($"neck_{p.neck:000}");
     result.arms      = HashCache.Get().Add($"arm_{p.body:000}");
     result.body      = HashCache.Get().Add($"body_{p.body:000}");
     result.hat       = HashedString.Invalid;
     return(result);
 }
コード例 #2
0
 public void GetBodySlots(ref KCompBuilder.BodyData fd)
 {
     fd.eyes      = HashedString.Invalid;
     fd.hair      = HashedString.Invalid;
     fd.headShape = HashedString.Invalid;
     fd.mouth     = HashedString.Invalid;
     fd.neck      = HashedString.Invalid;
     fd.body      = HashedString.Invalid;
     fd.arms      = HashedString.Invalid;
     fd.hat       = HashedString.Invalid;
     for (int i = 0; i < accessories.Count; i++)
     {
         Accessory accessory = accessories[i].Get();
         if (accessory != null)
         {
             if (accessory.slot.Id == "Eyes")
             {
                 fd.eyes = accessory.IdHash;
             }
             else if (accessory.slot.Id == "Hair")
             {
                 fd.hair = accessory.IdHash;
             }
             else if (accessory.slot.Id == "HeadShape")
             {
                 fd.headShape = accessory.IdHash;
             }
             else if (accessory.slot.Id == "Mouth")
             {
                 fd.mouth = accessory.IdHash;
             }
             else if (accessory.slot.Id == "Neck")
             {
                 fd.neck = accessory.IdHash;
             }
             else if (accessory.slot.Id == "Body")
             {
                 fd.body = accessory.IdHash;
             }
             else if (accessory.slot.Id == "Arm")
             {
                 fd.arms = accessory.IdHash;
             }
             else if (accessory.slot.Id == "Hat")
             {
                 fd.hat = HashedString.Invalid;
             }
         }
     }
 }
    public MinionStartingStats(bool is_starter_minion, string guaranteedAptitudeID = null)
    {
        if (is_starter_minion)
        {
            int idx = UnityEngine.Random.Range(0, 29);
            personality = Db.Get().Personalities[idx];
        }
        else
        {
            int idx2 = UnityEngine.Random.Range(0, 35);
            personality = Db.Get().Personalities[idx2];
        }
        voiceIdx        = UnityEngine.Random.Range(0, 4);
        Name            = personality.Name;
        NameStringKey   = personality.nameStringKey;
        GenderStringKey = personality.genderStringKey;
        Traits.Add(Db.Get().traits.Get(MinionConfig.MINION_BASE_TRAIT_ID));
        List <ChoreGroup> disabled_chore_groups = new List <ChoreGroup>();

        GenerateAptitudes(guaranteedAptitudeID);
        int pointsDelta = GenerateTraits(is_starter_minion, disabled_chore_groups);

        GenerateAttributes(pointsDelta, disabled_chore_groups);
        KCompBuilder.BodyData bodyData = CreateBodyData(personality);
        foreach (AccessorySlot resource in Db.Get().AccessorySlots.resources)
        {
            if (resource.accessories.Count != 0)
            {
                Accessory accessory = null;
                if (resource == Db.Get().AccessorySlots.HeadShape)
                {
                    accessory = resource.Lookup(bodyData.headShape);
                    if (accessory == null)
                    {
                        personality.headShape = 0;
                    }
                }
                else if (resource == Db.Get().AccessorySlots.Mouth)
                {
                    accessory = resource.Lookup(bodyData.mouth);
                    if (accessory == null)
                    {
                        personality.mouth = 0;
                    }
                }
                else if (resource == Db.Get().AccessorySlots.Eyes)
                {
                    accessory = resource.Lookup(bodyData.eyes);
                    if (accessory == null)
                    {
                        personality.eyes = 0;
                    }
                }
                else if (resource == Db.Get().AccessorySlots.Hair)
                {
                    accessory = resource.Lookup(bodyData.hair);
                    if (accessory == null)
                    {
                        personality.hair = 0;
                    }
                }
                else if (resource != Db.Get().AccessorySlots.HatHair)
                {
                    if (resource == Db.Get().AccessorySlots.Body)
                    {
                        accessory = resource.Lookup(bodyData.body);
                        if (accessory == null)
                        {
                            personality.body = 0;
                        }
                    }
                    else if (resource == Db.Get().AccessorySlots.Arm)
                    {
                        accessory = resource.Lookup(bodyData.arms);
                    }
                }
                if (accessory == null)
                {
                    accessory = resource.accessories[0];
                }
                accessories.Add(accessory);
            }
        }
    }
コード例 #4
0
    protected override void OnSpawn()
    {
        if (addToIdentityList)
        {
            ValidateProxy();
            CleanupLimboMinions();
        }
        PathProber component = GetComponent <PathProber>();

        if ((UnityEngine.Object)component != (UnityEngine.Object)null)
        {
            component.SetGroupProber(MinionGroupProber.Get());
        }
        SetName(name);
        if (nameStringKey == null)
        {
            nameStringKey = name;
        }
        SetGender(gender);
        if (genderStringKey == null)
        {
            genderStringKey = "NB";
        }
        if (addToIdentityList)
        {
            Components.MinionIdentities.Add(this);
            if (!base.gameObject.HasTag(GameTags.Dead))
            {
                Components.LiveMinionIdentities.Add(this);
            }
        }
        SymbolOverrideController component2 = GetComponent <SymbolOverrideController>();

        if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            Accessorizer component3 = base.gameObject.GetComponent <Accessorizer>();
            if ((UnityEngine.Object)component3 != (UnityEngine.Object)null)
            {
                bodyData = default(KCompBuilder.BodyData);
                component3.GetBodySlots(ref bodyData);
                string text = HashCache.Get().Get(component3.GetAccessory(Db.Get().AccessorySlots.HeadShape).symbol.hash);
                string str  = text.Replace("headshape", "cheek");
                component2.AddSymbolOverride("snapto_cheek", Assets.GetAnim("head_swap_kanim").GetData().build.GetSymbol(str), 1);
                component2.AddSymbolOverride(Db.Get().AccessorySlots.HairAlways.targetSymbolId, component3.GetAccessory(Db.Get().AccessorySlots.Hair).symbol, 1);
                component2.AddSymbolOverride(Db.Get().AccessorySlots.HatHair.targetSymbolId, Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(component3.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol, 1);
            }
        }
        voiceId  = "0";
        voiceId += (voiceIdx + 1).ToString();
        Prioritizable component4 = GetComponent <Prioritizable>();

        if ((UnityEngine.Object)component4 != (UnityEngine.Object)null)
        {
            component4.showIcon = false;
        }
        Pickupable component5 = GetComponent <Pickupable>();

        if ((UnityEngine.Object)component5 != (UnityEngine.Object)null)
        {
            component5.carryAnimOverride = Assets.GetAnim("anim_incapacitated_carrier_kanim");
        }
        ApplyCustomGameSettings();
    }