Exemplo n.º 1
0
        public void SetDropObject(ObjectField newObject)
        {
            var newObjectPoints = newObject.GetRelativePoints()
                                  .Select(el => el + new PointField(spawnPoint - new Vector2Int(0, newObject.Size.y / 2))).ToArray();

            var occupiedPoints = newObjectPoints.Where(HasPoint).ToArray();

            if (occupiedPoints.Length > 0)
            {
                CantCreateObjectEvent?.Invoke();
                return;
            }

            objectField = newObject;

            positionObjectField = spawnPoint - new Vector2Int(0, newObject.Size.y / 2);

            CreateObjectEvent?.Invoke(GetDropObjectRelativePoints());
        }
Exemplo n.º 2
0
 public IEnumerable <PointField> GetDropObjectRelativePoints()
 {
     return(objectField.GetRelativePoints().Select(el => new PointField(positionObjectField) + el).ToArray());
 }