示例#1
0
 /// <summary>
 /// Sets the cell type. Each cell type is determined by chance.
 /// </summary>
 internal void SetCellType()
 {
     if (HasChance(60, GameManager.Instance.Random))
     {
         _baseCell = new CellBase();
         return;
     }
     if (HasChance(40, GameManager.Instance.Random))
     {
         var monsterCell = new MonsterCell(this);
         _baseCell = monsterCell;
         monsterCell.UpdateStatusText();
         return;
     }
     if (HasChance(20, GameManager.Instance.Random))
     {
         _baseCell = new GoldCell(this);
         return;
     }
     if (HasChance(10, GameManager.Instance.Random))
     {
         _baseCell = new IncreaseAttackCell();
         return;
     }
     if (HasChance(40, GameManager.Instance.Random))
     {
         _baseCell = new ItemCell(this);
         return;
     }
     if (HasChance(20, GameManager.Instance.Random))
     {
         _baseCell = new ManaPotionCell(this);
         return;
     }
     if (HasChance(30, GameManager.Instance.Random))
     {
         _baseCell = new WeaponCell(this);
         return;
     }
     if (HasChance(30, GameManager.Instance.Random))
     {
         _baseCell = new SpellCell();
         return;
     }
     if (HasChance(10, GameManager.Instance.Random))
     {
         _baseCell = new ShopCell();
     }
     else
     {
         _baseCell = new HealthPotionCell(this);
     }
 }
示例#2
0
        private void OnMouseDown()
        {
            if (!IsSelectable || IsLocked)
            {
                return;
            }

            if (Foreground.activeSelf)
            {
                Foreground.SetActive(false);
                IsOpen = true;

                if (OpenCell != null)
                {
                    OpenCell.Invoke(this);
                }

                _baseCell.UpdateStatusText();
            }
            else if (GetCellType() != CellType.Enter)
            {
                _baseCell.DoAction();
                if (_baseCell.CanRemoveContent())
                {
                    if (GetCellType() == CellType.Monster)
                    {
                        if (MonsterKilled != null)
                        {
                            MonsterKilled.Invoke(this);
                        }
                    }
                    Content.sprite = null;
                    HealthStatusText.gameObject.SetActive(false);
                    AttackStatusText.gameObject.SetActive(false);
                    _baseCell = new CellBase();
                }
            }
            else if (GetCellType() == CellType.Enter && IsOpen)
            {
                _baseCell.DoAction();
            }

            GameManager.Instance.Board.Validate();
        }
示例#3
0
 internal void SetKeyType()
 {
     _baseCell = new KeyCell();
 }
示例#4
0
 internal void SetEnterType()
 {
     _baseCell = new EnterCell();
 }