private void MoveRockToPosition(int xOrigin, int yOrigin, int xDestination, int yDestination) { BlockType destinationBlock = LV.pos[xDestination][yDestination].GetComponent <BlockType>(); BlockType originBlock = LV.pos[xOrigin][yOrigin].GetComponent <BlockType>(); if (destinationBlock.type == BlockType.Type.Floor) { if (originBlock.type == BlockType.Type.MovableRockOnFilledHole) { Destroy(originBlock.transform.GetChild(1).gameObject); originBlock.ChangeBlockType(BlockType.Type.FilledHole); } else { originBlock.ChangeBlockType(BlockType.Type.Floor); Destroy(originBlock.transform.GetChild(0).gameObject); } destinationBlock.ChangeBlockType(BlockType.Type.MovableRock); onPlayerAttack?.Invoke(); PlayerAnimation.SetTrigger("Attack"); } else if (destinationBlock.type == BlockType.Type.Hole) { originBlock.ChangeBlockType(BlockType.Type.Floor); Destroy(originBlock.transform.GetChild(0).gameObject); destinationBlock.ChangeBlockType(BlockType.Type.FilledHole); destinationBlock.isFilledHole = true; onPlayerAttack?.Invoke(); PlayerAnimation.SetTrigger("Attack"); } else if (destinationBlock.type == BlockType.Type.FilledHole) { if (originBlock.type == BlockType.Type.MovableRockOnFilledHole) { originBlock.ChangeBlockType(BlockType.Type.FilledHole); } else { originBlock.ChangeBlockType(BlockType.Type.Floor); Destroy(originBlock.transform.GetChild(0).gameObject); } destinationBlock.ChangeBlockType(BlockType.Type.MovableRockOnFilledHole); onPlayerAttack?.Invoke(); PlayerAnimation.SetTrigger("Attack"); } }