示例#1
0
        public SaveableClone SpawnNewNPC(FeedeeClass feedeeClass, string feedeeUUID, object state = null)
        {
            foreach (var prefab in feedeePrefabs)
            {
                if (prefab.GetClass() == feedeeClass)
                {
                    BaseFeedeeStats feedee        = Instantiate(prefab, parentTransform);
                    SaveableClone   saveableClone = feedee.GetComponent <SaveableClone>();
                    saveableClone.SetUniqueIdentifier(feedeeUUID);
                    if (state != null)
                    {
                        saveableClone.RestoreState(state);
                    }

                    return(saveableClone);
                }
            }
            return(null);
        }
示例#2
0
        public SaveableClone SpawnActiveFollower(CharacterClass followerClass, string followerUUID, object state = null)
        {
            foreach (var prefab in followerPrefabs)
            {
                if (prefab.GetClass() == followerClass)
                {
                    Transform     followerTransform = Instantiate(prefab, parentTransform).transform;
                    SaveableClone saveableClone     = followerTransform.GetComponent <SaveableClone>();
                    saveableClone.SetUniqueIdentifier(followerUUID);
                    if (state != null)
                    {
                        saveableClone.RestoreState(state);
                    }
                    followerTransform.SetSiblingIndex(siblingIndex);

                    return(saveableClone);
                }
            }
            return(null);
        }
示例#3
0
        public SaveableClone SpawnBackgroundFollower(CharacterClass followerClass, string followerUUID, object state = null)
        {
            if (isCombat)
            {
                return(null);
            }

            foreach (var prefab in nonCombatPrefabs)
            {
                if (prefab.GetClass() == followerClass)
                {
                    BaseStats     followerBase  = Instantiate(prefab, parentTransformBackground);
                    SaveableClone saveableClone = followerBase.GetComponent <SaveableClone>();
                    saveableClone.SetUniqueIdentifier(followerUUID);
                    if (state != null)
                    {
                        saveableClone.RestoreState(state);
                    }

                    return(saveableClone);
                }
            }
            return(null);
        }