static private void DestroyCellInLine(int x, int y, TypeLineBonus typeLine) { Field field = BonusManager.GetField(); switch (typeLine) { case TypeLineBonus.Horizontal: { for (int i = 0; i < Field.size; i++) { field.cells[i, y].DestroyCrystal(); } break; } case TypeLineBonus.Verical: { for (int i = 0; i < Field.size; i++) { field.cells[x, i].DestroyCrystal(); } break; } } }
public void Move(TypeLineBonus type) { transform.localPosition = new Vector3(0, -0.5f, 0); spriteRenderer = GetComponent <SpriteRenderer>(); typeLineBonus = type; MoveForwardUp(); }
public void MoveToSlot(Slot slotToMove) { directionOfMove = TypeLineBonus.Verical; if (slot.x == slotToMove.x) { directionOfMove = TypeLineBonus.Verical; } if (slot.y == slotToMove.y) { directionOfMove = TypeLineBonus.Horizontal; } if (slot != null) { slot.planet = null; } slot = null; slotToMove.planet = this; transform.DOMove(slotToMove.transform.position, speedMove).SetEase(Ease.Linear).OnUpdate( delegate { if (slot != null) { SlotController.CanPlanetMove = false; } }).OnComplete(() => OnCompliteMove(slotToMove)); }
static public void DestroyCell(int x, int y, TypeLineBonus typeLine) { Field field = BonusManager.GetField(); GameObject lizer = (GameObject)Instantiate(BonusManager.GetLizerPrefab(), field.cells[x, y].transform.position, field.cells[x, y].transform.rotation); float speed = 0.7f; switch (typeLine) { case TypeLineBonus.Horizontal: { for (int i = 0; i < Field.size; i++) { lizer.transform.localEulerAngles = Vector3.zero; } if (Field.size / 2 > x) { speed = Mathf.Abs((x - Field.size / 2) + 1); } else { speed = (x - Field.size / 2); } speed = 0.7f - speed / 10; break; } case TypeLineBonus.Verical: { for (int i = 0; i < Field.size; i++) { lizer.transform.localEulerAngles = new Vector3(0, 0, 90); } if (Field.size / 2 > y) { speed = Mathf.Abs((y - Field.size / 2) + 1); } else { speed = (y - Field.size / 2); } speed = 0.7f - speed / 10; break; } } lizer.transform.DOScale(new Vector3(10, 0.1f, 1), speed / 1.5f).OnComplete(delegate { DestroyCellInLine(x, y, typeLine); Destroy(lizer); }); }
public void MoveToSlot(Slot slotToMove, Planet exPlanet) { directionOfMove = TypeLineBonus.Verical; if (slot.x == slotToMove.x) { directionOfMove = TypeLineBonus.Verical; } if (slot.y == slotToMove.y) { directionOfMove = TypeLineBonus.Horizontal; } if (slot != null) { slot.planet = null; } slot = null; slotToMove.planet = this; transform.DOMove(slotToMove.transform.position, speedMove).SetEase(Ease.Linear).OnUpdate( delegate { if (slot != null) { SlotController.CanPlanetMove = false; } }).OnComplete(delegate { if (HaveStarBonus()) { typeOfPlanet = exPlanet.typeOfPlanet; if (exPlanet.CountBonus() != 0) { typeOfExPlanetBonus = exPlanet.bonuses[0]; } } OnCompliteMove(slotToMove); }); }
public void Line(TypeLineBonus _type, Field _field, Crystal _crystal) { type = _type; field = _field; crystal = _crystal; }
public void SetDirectionOfMove(TypeLineBonus typeDir) { directionOfMove = typeDir; }