Esempio n. 1
0
 public void SetBuffInfo(Entity.Buff buff)
 {
     this.buff     = buff;
     _image        = this.gameObject.GetComponentInChildren <Image>();
     _text         = this.gameObject.GetComponentInChildren <Text>();
     _image.sprite = sprites[buff.buffTypeId];
 }
        public void RemoveBuff(Entity.Buff buff)
        {
            playerPanel.GetComponent <playBehaviour>().RemoveInfo(playerBuffMap[buff], buff);

            BuffRemove?.Invoke(buff, playerBuffMap[buff]);
            buff.Remove(playerBuffMap[buff], this);
            playerBuffMap.Remove(buff);
        }
        public void AddBuffToPlayer(int playerId, Entity.Buff buff)
        {
            buff.isUsed = true;
            playerBuffMap.Add(buff, playerId);
            buff.Add(playerId, this);
            BuffAdd?.Invoke(buff, playerBuffMap[buff]);

            playerPanel.GetComponent <playBehaviour>().SetBuffInfo(playerId, buff);
        }
Esempio n. 4
0
        public void EdgeDie()
        {
            if (_dataManager.Properties.shield > 0)
            {
                _dataManager.Properties.shield = 0;
                Entity.Buff buff = PlayerBuffManager.Instance.GetPlayerBuff(_dataManager.Properties.playerId).Where(b => b.buffTypeId == 2).FirstOrDefault();
                buff.activeCount = 0;
            }

            _dataManager.Properties.life--;
            transform.position = spawnPoint;
        }
Esempio n. 5
0
        public void SetBuffInfo(int playerId, Entity.Buff buff)
        {
            var obj = Instantiate(buffInfoPrefab);

            obj.GetComponent <BuffInfoBehaviour>().SetBuffInfo(buff);
            GameObject parent = GameObject.Find("/PlayUI/MainPanel/PlayerPanel/BuffStack" + playerId);

            obj.transform.SetParent(parent.transform);
            obj.transform.position = new Vector3(parent.transform.position.x, parent.transform.position.y + GetCount() * 25);
            obj.name = "BuffInfo" + buff.buffId;
            buffs.Add(buff);
            buffInfoList.Add(obj);
        }
Esempio n. 6
0
 public void Die()
 {
     PlayerWeapons.Instance.SpawnWeapon(this.transform.position, _attack._weapon.Id);
     if (_dataManager.Properties.shield > 0)
     {
         _dataManager.Properties.shield--;
         Entity.Buff buff = PlayerBuffManager.Instance.GetPlayerBuff(_dataManager.Properties.playerId).Where(b => b.buffTypeId == 2).FirstOrDefault();
         buff.activeCount--;
     }
     else
     {
         _dataManager.Properties.life--;
         transform.position = spawnPoint;
     }
     PlayerWeapons.Instance.SwitchPlayerWeapon(this.gameObject, WeaponTypeEnum.Sword, true);
 }
Esempio n. 7
0
        public void RemoveInfo(int playerId, Entity.Buff buff)
        {
            if (!buffs.Remove(buff))
            {
                return;
            }

            GameObject obj = GameObject.Find("BuffInfo" + buff.buffId);

            buffInfoList.Remove(obj);
            Destroy(obj);

            GameObject parent = GameObject.Find("/PlayUI/MainPanel/PlayerPanel/BuffStack" + playerId);

            for (int i = 0; i < buffInfoList.Count; i++)
            {
                buffInfoList[i].transform.position = new Vector3(parent.transform.position.x, parent.transform.position.y + i * 25);
            }
        }
 public void SetBuff(Entity.Buff buff)
 {
     this.buff        = buff;
     _renderer.sprite = sprites[buff.buffTypeId];
 }