コード例 #1
0
        public void InitCreature(BaseCreature creature, Location loc)
        {
            Template          = creature;
            EntityName        = Template.creatureName;
            Hash              = EntityManager.Instance.AddEntity(this);
            EntityBuffManager = new BuffManager(Hash);
            foreach (var buff in Template.buffs)
            {
                EntityBuffManager.AddBuff(new BuffHandler(Hash, Hash, buff.Hash));
            }
            m_spriteRenderer.sprite = Template.sprite;
            m_attribute             = Template.attribute;
            HealthPoints            = MaxHealthPoints;

            foreach (var skill in Template.skills)
            {
                SkillHashes.Add(skill.Hash);
            }
            NextCastSkillID = 0;

            //var h = EntitySprite.bounds.size.y;
            //hpBar.transform.localPosition += new Vector3(0, h, 0);

            hpBar.enabled             = false;
            mask_hpEffect.alphaCutoff = 1;
            mask_hp.alphaCutoff       = 1;
            MoveToTile(loc, 0, true);

            hpBar.enabled = true;
            CreatureHpChangeAnimation(MaxHealthPoints, MaxHealthPoints, 1);
        }
コード例 #2
0
        public void RemoveASkill(int skillID)
        {
            if (SkillDeck.Count == 0)
            {
                SkillDeck        = SkillDiscardPile;
                SkillDiscardPile = new List <int>();
            }
            int r = SkillDeck.Count.Random();

            SkillHashes.Insert(0, SkillDeck[r]);
            SkillDeck.RemoveAt(r);
            SkillDiscardPile.Add(SkillHashes[skillID + 1]);
            SkillHashes.RemoveAt(skillID + 1);
            ssAnimEvent?.Invoke(ssAnimDuration);
            //Debug.Log("skill: " + SkillDiscardPile[SkillDiscardPile.Count - 1] + " was removed");
        }
コード例 #3
0
        public void ShiftASkill()
        {
            if (SkillDeck.Count == 0)
            {
                SkillDeck        = SkillDiscardPile;
                SkillDiscardPile = new List <int>();
            }

            int r = SkillDeck.Count.Random();

            SkillHashes.Insert(0, SkillDeck[r]);
            ssAnimEvent?.Invoke(ssAnimDuration);
            SkillDeck.RemoveAt(r);
            if (SkillHashes.Count <= defaultSkillCount)
            {
                return;
            }

            SkillDiscardPile.Add(SkillHashes[defaultSkillCount]);
            SkillHashes.RemoveAt(defaultSkillCount);
            //Debug.Log("skill: " + SkillDiscardPile[SkillDiscardPile.Count - 1] + " was shifted");
        }
コード例 #4
0
 public void AddASkillToMind(int insertID, int skillHash)
 {
     SkillHashes.Insert(insertID, skillHash);
     SkillHashes.RemoveAt(defaultSkillCount);
 }