private void FinishStage(Stage stage) { playerEntity.GetComponent <IMovementController>().OnMovement -= RefreshLootInventory; itemController.OnItemDrop -= RefreshLootInventory; itemController.OnItemPickup -= RefreshLootInventory; playerEntity = null; }
public override List <Cell> GetAvailableTargets(CellEntity cellEntity) { return(new List <Cell>() { cellEntity.Cell }); }
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); }
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; }
public CellEntity GeneratePlayer(Cell cell) { CellEntity player = Instantiate(playerPrefab).GetComponent <CellEntity>(); player.Attach(cell); player.transform.position = cell.Transform.position; return(player); }
public void Interact(CellEntity cellEntity) { if (selectedItems == null) { GenerateItems(); } ShopController.Instance.ShowShop(this, selectedItems); }
public bool CheckPath(CellEntity cellEntity, Cell first, Cell second) { if (second == null) { return(false); } return(CheckPath(cellEntity, first, Direction.GetDirection(first.StagePosition, second.StagePosition))); }
public void PickupItem(LootItem itemEntity, Cell cell, CellEntity cellEntity) { itemEntity.Pickup(cellEntity); OnItemPickup?.Invoke(itemEntity, cell); if (!HasItems(cell)) { DeleteItemBag(cell); } }
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); }
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); } }
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; } } }
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); }
public override void SetUp() { base.SetUp(); var cellEntity = new CellEntity { Id = 1, Urgency = 2, Importance = 3, Title = "test cell" }; Repository.Add(cellEntity); }
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); }
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); }
protected new void Awake() { base.Awake(); cellEntity = GetComponent <CellEntity>(); PlayerInputHandler playerInputHandler = GetComponent <PlayerInputHandler>(); playerInputHandler.OnSwipe += CheckMove; playerInputHandler.OnPress += CheckMove; GameController.Instance.OnStageStart += s => Activate(); }
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" }; }
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); }
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); }
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 }); }
public virtual void SetUp() { Sut = new CellEntity(); }
public void Pickup(CellEntity cellEntity) { CellEntity.Detach(); ParentEntity = cellEntity; }
public void Drop(Cell cell) { CellEntity.Attach(cell); ParentEntity = null; }
private void Awake() { entityAttack = GetComponent <EntityAttack>(); cellEntity = GetComponent <CellEntity>(); }
public bool CanPass(CellEntity cellEntity) { return(isOpened || cellEntity != null && cellEntity.Team == EntityTeam.Player); }
private void Awake() { movementController = GetComponent <MovementController>(); cellEntity = GetComponent <CellEntity>(); }
public void Pass(CellEntity cellEntity, Direction direction) { OpenDoor(direction); }
public void Interact(CellEntity cellEntity, Direction direction) { OpenDoor(direction); }