示例#1
0
        private Vector2 GetNextLocalPosition(bool isTopRow, Row neighbor, RowSide side)
        {
            var position = Vector2.zero;
            var height   = GameConfiguration.Instance.RowSettings.RowHeight;

            if (isTopRow)
            {
                if (neighbor != null)
                {
                    position    = neighbor.transform.localPosition;
                    position.y += height;
                }
            }
            else
            {
                if (neighbor != null)
                {
                    position    = neighbor.transform.localPosition;
                    position.y -= height;
                }
            }

            var shift = GameConfiguration.Instance.RowSettings.RowShift;

            if (side == RowSide.Left)
            {
                position.x = -shift;
            }
            else
            {
                position.x = shift;
            }

            return(position);
        }
 public void CheckRowSide()
 {
     if (this.Rotation.z >= 15 && this.Rotation.z <= 60)
     {
         this._rowSide = RowSide.Left;
     }
     else if (this.Rotation.z <= 345 && this.Rotation.z >= 300)
     {
         this._rowSide = RowSide.Right;
     }
     else
     {
         this._rowSide = RowSide.None;
     }
 }
示例#3
0
        public void Setup(bool isTopRow, int index, Row neighbor = null, Spawner popSpawner = null)
        {
            _side = GetNextSide(neighbor);
            transform.SetSiblingIndex(index);
            transform.localPosition = GetNextLocalPosition(isTopRow, neighbor, _side);

            if (isTopRow && popSpawner != null)
            {
                for (var i = 0; i < _cells.Count; i++)
                {
                    var cell = _cells[i];
                    var pop  = popSpawner.Spawn() as Pop;
                    if (pop != null)
                    {
                        cell.Attach(pop);
                        pop.Setup(GameConfiguration.GetRandomColor(GameController.Instance.GameSession.Level));
                    }
                }
            }
        }
 public Row(RowSide rowSide)
 {
     RowSide = rowSide;
     Piles   = new List <Pile>();
 }
 public RowEventArgs(RowSide side, float strength, float efficiency)
 {
     this.Side = side;
     this.Strength = strength;
     this.Efficiency = efficiency;
 }