void ChangePreviewDirection(Direction newDir) { if (actionPiece == null) { actionPiece = Instantiate(actionPreview).GetComponent <ActionPiece>(); actionPiece.board = board; actionPiece.absoluteOrigin = unit.tile.coordinate; } actionPiece.ChangeDirection(newDir); }
/// <summary> /// Handles interaction with <paramref name="other"/>. /// Returns true if this action_piece should have /// decrement in action count. /// </summary> /// <param name="other"></param> /// <returns>true if current_action_count should be reduced</returns> protected override bool handle_interaction(ActionPiece other) { switch (other.e_type) { case EntityType.FREE_SPACE: // Preserves the target positions return(true); case EntityType.STATIC_OBJECT: case EntityType.BARRIER: //Can't access that tile. Fall back. set_target_position(this.world_x, this.world_y); return(false); case EntityType.WALL: // Might be able to break a wall // Handle it here //Otherwise set_target_position(this.world_x, this.world_y); return(false); case EntityType.DYNAMO: // Game over for now this.destroy(); world.destroy(); return(true); case EntityType.SMALL_FOOD: food_mtr.on_collect_food(1); other.destroy(); return(true); case EntityType.FOOD_SPEED_UP: case EntityType.FOOD_VOMIT: // TODO: Implement this for big food pickup return(true); case EntityType.HOUSE: // Gratz, you won the scene world.destroy(); return(true); } return(false); }
/// <summary> /// Handles interaction with <paramref name="other"/>. /// Returns true if this action_piece should have /// decrement in action count. /// </summary> /// <param name="other"></param> /// <returns>true if current_action_count should be reduced</returns> protected virtual bool handle_interaction(ActionPiece other) { //Static objs can't move. return(true); }