Example #1
0
        /// <summary>
        /// Create an entity with job levels, equipment, family, etc
        /// </summary>
        /// <param name="template"></param>
        /// <param name="needs"></param>
        /// <param name="level"></param>
        /// <param name="experience"></param>
        /// <param name="job"></param>
        /// <param name="sex"></param>
        /// <param name="sexuality"></param>
        /// <param name="position"></param>
        /// <param name="icons"></param>
        /// <param name="naturalWeapons"></param>
        /// <param name="equipment"></param>
        /// <param name="backpack"></param>
        /// <param name="relationships"></param>
        /// <param name="identifiedItems"></param>
        /// <param name="family"></param>
        /// <param name="jobLevels"></param>
        /// <param name="world"></param>
        /// <param name="tileset"></param>
        public Entity(EntityTemplate template, Dictionary <NeedIndex, EntityNeed> needs, int level, float experience, JobType job, Sex sex, Sexuality sexuality,
                      Vector2Int position, List <Sprite> sprites, ItemInstance naturalWeapons, Dictionary <string, ItemInstance> equipment,
                      List <ItemInstance> backpack, Dictionary <long, int> relationships, List <string> identifiedItems, Dictionary <long, RelationshipStatus> family,
                      Dictionary <string, int> jobLevels, WorldInstance world, string tileset) :
            base(NameProvider.GetRandomName(template.CreatureType, sex), template.Statistics[StatisticIndex.Endurance].Value * 2, position, sprites, template.JoyType, true)
        {
            this.CreatureType = template.CreatureType;
            this.Slots        = template.Slots;

            this.m_Size = template.Size;

            this.m_JobLevels       = jobLevels;
            this.m_Sexuality       = sexuality;
            this.m_IdentifiedItems = identifiedItems;
            this.m_Statistics      = template.Statistics;

            if (template.Skills.Count == 0)
            {
                this.m_Skills = EntitySkillHandler.GetSkillBlock(needs);
            }
            else
            {
                this.m_Skills = template.Skills;
            }
            this.m_Needs     = needs;
            this.m_Abilities = template.Abilities;
            this.m_Level     = level;
            for (int i = 1; i < level; i++)
            {
                this.LevelUp();
            }
            this.m_Experience     = experience;
            this.m_CurrentJob     = job;
            this.m_Sentient       = template.Sentient;
            this.m_NaturalWeapons = naturalWeapons;
            this.m_Equipment      = equipment;
            this.m_Backpack       = backpack;
            this.m_Relationships  = relationships;
            this.Sex          = sex;
            this.m_Family     = family;
            this.m_VisionType = template.VisionType;

            this.m_Tileset = tileset;

            this.CalculateDerivatives();

            this.m_Vision = new bool[1, 1];

            this.m_Pathfinder      = new Pathfinder();
            this.m_PathfindingData = new Queue <Vector2Int>();

            this.m_FulfillingNeed    = (NeedIndex)(-1);
            this.m_FulfilmentCounter = 0;

            this.RegenTicker = RNG.Roll(0, REGEN_TICK_TIME - 1);

            this.MyWorld = world;

            SetFOVHandler();
            SetCurrentTarget();
        }