Ejemplo n.º 1
0
 private void FinishStage(Stage stage)
 {
     playerEntity.GetComponent <IMovementController>().OnMovement -= RefreshLootInventory;
     itemController.OnItemDrop   -= RefreshLootInventory;
     itemController.OnItemPickup -= RefreshLootInventory;
     playerEntity = null;
 }
Ejemplo n.º 2
0
 public override List <Cell> GetAvailableTargets(CellEntity cellEntity)
 {
     return(new List <Cell>()
     {
         cellEntity.Cell
     });
 }
Ejemplo n.º 3
0
        private void SpawnItem(GameObject chestPrefab, Cell cell, ItemController itemController)
        {
            CellEntity chestEntity = Instantiate(chestPrefab, cell.Transform).GetComponent <CellEntity>();

            chestEntity.Attach(cell);
            chestEntity.GetComponent <ChestInteractable>()?.Initialize(itemController);
        }
Ejemplo n.º 4
0
        public CellEntity GenerateEnemy(GameObject prefab, Cell cell)
        {
            CellEntity enemy = Instantiate(prefab).GetComponent <CellEntity>();

            enemy.Attach(cell);
            enemy.transform.position = cell.Transform.position;
            return(enemy);
        }
 public void Interact(CellEntity cellEntity)
 {
     if (CanInteract)
     {
         ExpandableInteract(cellEntity);
         interactionsLeft--;
     }
 }
 private void StartStage(Stage stage)
 {
     playerEntity         = stage.PlayerEntity;
     playerMoveController = playerEntity.GetComponent <MoveController>();
     stage.PlayerEntity.GetComponent <IMovementController>().OnMovement += CheckInteractiables;
     playerMoveController.OnActionSelected   += ShowUseItemButton;
     playerMoveController.OnActionDeselected += HideUseItemButton;
 }
Ejemplo n.º 7
0
        public CellEntity GeneratePlayer(Cell cell)
        {
            CellEntity player = Instantiate(playerPrefab).GetComponent <CellEntity>();

            player.Attach(cell);
            player.transform.position = cell.Transform.position;
            return(player);
        }
Ejemplo n.º 8
0
        public void Interact(CellEntity cellEntity)
        {
            if (selectedItems == null)
            {
                GenerateItems();
            }

            ShopController.Instance.ShowShop(this, selectedItems);
        }
Ejemplo n.º 9
0
        public bool CheckPath(CellEntity cellEntity, Cell first, Cell second)
        {
            if (second == null)
            {
                return(false);
            }

            return(CheckPath(cellEntity, first, Direction.GetDirection(first.StagePosition, second.StagePosition)));
        }
Ejemplo n.º 10
0
        public void PickupItem(LootItem itemEntity, Cell cell, CellEntity cellEntity)
        {
            itemEntity.Pickup(cellEntity);
            OnItemPickup?.Invoke(itemEntity, cell);

            if (!HasItems(cell))
            {
                DeleteItemBag(cell);
            }
        }
Ejemplo n.º 11
0
    public int BoardCellToValue(CellEntity cell)
    {
        int value = 0;

        if (!cell.empty)
        {
            value = (int)(cell.ball.color) * 10 + (cell.ball.size == Ball.Size.Dot ? 0 : 5);
        }

        return(value);
    }
Ejemplo n.º 12
0
        protected override void ExpandableInteract(CellEntity cellEntity)
        {
            GetComponent <SpriteRenderer>().sprite = openedChest;
            CellEntity chestCellEntity = GetComponent <CellEntity>();

            foreach (GameObject gameObject in GetItemsToSpawn())
            {
                LootItem lootItem = itemController.CreateItem(gameObject);
                itemController.DropItem(lootItem, chestCellEntity.Cell);
            }
        }
Ejemplo n.º 13
0
 public RuntimeBoard()
 {
     for (int i = 0; i < BOARD_SIZE; i++)
     {
         for (int j = 0; j < BOARD_SIZE; j++)
         {
             cells[i, j]           = new CellEntity();
             cells[i, j].rowOffset = i;
             cells[i, j].colOffset = j;
         }
     }
 }
Ejemplo n.º 14
0
 public bool CheckPath(CellEntity cellEntity, Cell cell, Direction direction)
 {
     if (cell.BorderEntities[direction] != null)
     {
         IPassable passable = cell.BorderEntities[direction].GetComponent <IPassable>();
         if (passable != null)
         {
             return(passable.CanPass(cellEntity));
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 15
0
        public override void SetUp()
        {
            base.SetUp();
            var cellEntity = new CellEntity
            {
                Id         = 1,
                Urgency    = 2,
                Importance = 3,
                Title      = "test cell"
            };

            Repository.Add(cellEntity);
        }
Ejemplo n.º 16
0
        public override List <Cell> GetAvailableTargets(CellEntity cellEntity)
        {
            List <Cell> cells = new List <Cell>();

            foreach (Cell cell in cellEntity.Cell.Stage.Cells)
            {
                if (CanTarget(cellEntity, cell))
                {
                    cells.Add(cell);
                }
            }
            return(cells);
        }
Ejemplo n.º 17
0
        public async Task <CellModel> AddCellAsync(CellModel newCellModel)
        {
            var newCellEntity = new CellEntity {
                Title = newCellModel.Title
            };
            var addedCellEntity = await repository.AddAsync(newCellEntity);

            var addedCellModel = addedCellEntity.ToCellModel();

            Subscribe(addedCellModel);
            cells.Add(addedCellModel);
            return(addedCellModel);
        }
Ejemplo n.º 18
0
        protected new void Awake()
        {
            base.Awake();

            cellEntity = GetComponent <CellEntity>();

            PlayerInputHandler playerInputHandler = GetComponent <PlayerInputHandler>();

            playerInputHandler.OnSwipe += CheckMove;
            playerInputHandler.OnPress += CheckMove;

            GameController.Instance.OnStageStart += s => Activate();
        }
Ejemplo n.º 19
0
 public virtual void SetUp()
 {
     Sut = new CellRepository();
     Sut.RemoveAll();
     CellEntity1 = new CellEntity {
         Title = "test cell 1"
     };
     CellEntity2 = new CellEntity {
         Title = "test cell 2"
     };
     CellEntity3 = new CellEntity {
         Title = "test cell 3"
     };
 }
Ejemplo n.º 20
0
        private void StartStage(Stage stage)
        {
            playerEntity = stage.PlayerEntity;

            playerMoveController = playerEntity.GetComponent <PlayerMoveController>();

            playerMovement             = playerEntity.GetComponent <IMovementController>();
            playerMovement.OnMovement += RefreshLootInventory;

            itemController.OnItemDrop   += RefreshLootInventory;
            itemController.OnItemPickup += RefreshLootInventory;

            RefreshInventory(playerEntity.Cell);
        }
Ejemplo n.º 21
0
        public override List <Cell> GetAvailableTargets(CellEntity cellEntity)
        {
            List <Cell> cells = new List <Cell>();

            foreach (Direction direction in Direction.Values)
            {
                Cell cell = cellEntity.Cell.Stage.GetCell(cellEntity.Cell, direction);
                if (cell != null && CanTarget(cellEntity, cell))
                {
                    cells.Add(cell);
                }
            }

            return(cells);
        }
Ejemplo n.º 22
0
        public static CellModel ToCellModel(this CellEntity cellEntity)
        {
            if (cellEntity == null)
            {
                throw new ArgumentNullException(nameof(cellEntity));
            }

            return(new CellModel
            {
                Id = cellEntity.Id,
                Title = cellEntity.Title,
                Urgency = cellEntity.Urgency,
                Importance = cellEntity.Importance,
                Goal = cellEntity.Goal,
                Tags = cellEntity.Tags,
                TimeSpent = cellEntity.TimeSpent
            });
        }
Ejemplo n.º 23
0
 public virtual void SetUp()
 {
     Sut = new CellEntity();
 }
Ejemplo n.º 24
0
 public void Pickup(CellEntity cellEntity)
 {
     CellEntity.Detach();
     ParentEntity = cellEntity;
 }
Ejemplo n.º 25
0
 public void Drop(Cell cell)
 {
     CellEntity.Attach(cell);
     ParentEntity = null;
 }
 private void Awake()
 {
     entityAttack = GetComponent <EntityAttack>();
     cellEntity   = GetComponent <CellEntity>();
 }
Ejemplo n.º 27
0
 public bool CanPass(CellEntity cellEntity)
 {
     return(isOpened || cellEntity != null && cellEntity.Team == EntityTeam.Player);
 }
Ejemplo n.º 28
0
 private void Awake()
 {
     movementController = GetComponent <MovementController>();
     cellEntity         = GetComponent <CellEntity>();
 }
Ejemplo n.º 29
0
 public void Pass(CellEntity cellEntity, Direction direction)
 {
     OpenDoor(direction);
 }
Ejemplo n.º 30
0
 public void Interact(CellEntity cellEntity, Direction direction)
 {
     OpenDoor(direction);
 }