private void CheckToAddRowsBelow(GridSquare cell) { //if cell is occupied and on the highest row. //add a new row - then set all of them unlandable, other than the one's adjacent to current cell. int highest = GetHighestLayer(); if (cell.Occupied && cell.LayerIndex.x == highest) { var newRow = InitRow(highest + 1, false); GridCells.Add(newRow); var SurrondingCells = CheckSurrondingCells(cell, true); foreach (GridSquare square in newRow.Row) { if (!SurrondingCells.Contains(square)) { square.SetLanded(false); } } if (GridCells.Count > 8) { StartCoroutine(myEasing.CoMoveY(0, 0.5f, transform.localPosition.y, transform.localPosition.y + MagicSpacing * 0.9f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); RemoveRow(GridCells.Find(x => x.Layer == GetLowestLayer())); } } }
private IEnumerator PullBack(EasingActions easing, Vector3 epicentre) { yield return(new WaitForSeconds(0.1f)); StartCoroutine(easing.CoMoveY(0, 0.1f, transform.localPosition.y, transform.localPosition.y - epicentre.y * 0.1f, transform, Easing.Function.Sinusoidal, Easing.Direction.In)); StartCoroutine(easing.CoMoveX(0, 0.1f, transform.localPosition.x, transform.localPosition.x - epicentre.x * 0.1f, transform, Easing.Function.Sinusoidal, Easing.Direction.In)); }
private IEnumerator DelayedDownMovement(EasingActions easing) { yield return(new WaitForSeconds(0.2f)); StartCoroutine(easing.CoMoveY(0, 0.4f, transform.localPosition.y, -3f, transform, Easing.Function.Sinusoidal, Easing.Direction.In)); StartCoroutine(DelayedDestroy(0.4f)); }
public void PushedAnimation(Vector3 epicentre) { epicentre.Normalize(); EasingActions easing = new EasingActions(); StartCoroutine(easing.CoMoveY(0, 0.1f, transform.localPosition.y, transform.localPosition.y + epicentre.y * 0.1f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(easing.CoMoveX(0, 0.1f, transform.localPosition.x, transform.localPosition.x + epicentre.x * 0.1f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(PullBack(easing, epicentre)); }
public void FallGridSquare() { StopAllCoroutines(); myCollider.enabled = false; CanLand = false; EasingActions easing = new EasingActions(); StartCoroutine(easing.CoMoveY(0, 0.2f, transform.localPosition.y, transform.localPosition.y + 0.5f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(DelayedDownMovement(easing)); }
public void CombineGridSquare(Vector3 position) { StopAllCoroutines(); myCollider.enabled = false; CanLand = false; EasingActions easing = new EasingActions(); StartCoroutine(easing.CoMoveY(0, 0.5f, transform.localPosition.y, position.y, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(easing.CoMoveX(0, 0.5f, transform.localPosition.x, position.x, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(easing.CoScale(0, 0.5f, 1f, 0.01f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(DelayedDestroy(0.5f)); }
public void AnimateScoreRising(int Score) { myText.enabled = true; myText.text = Score.ToString(); EasingActions easing = new EasingActions(); StartCoroutine(easing.CoMoveY(0, 0.5f, transform.position.y, transform.position.y + 0.5f, transform, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(easing.CoFadeTextAlpha(0, 0.2f, 0f, 1f, myText, Easing.Function.Sinusoidal, Easing.Direction.Out)); StartCoroutine(DelayedDestroy()); }