|
|
@ -73,7 +73,19 @@ public class Water : ActiveBlock |
|
|
|
|
|
|
|
|
|
|
|
StartCoroutine(LerpToPosition(trappedCharacter.transform, VisualPosition, 1)); |
|
|
|
yield return StartCoroutine(LerpToPosition(lillyPad.transform, VisualPosition, 1)); |
|
|
|
StartCoroutine(LerpToPosition(lillyPad.transform, VisualPosition, 1)); |
|
|
|
|
|
|
|
if (CurrentPlayer != null) |
|
|
|
{ |
|
|
|
yield return new WaitForSeconds(0.2f); |
|
|
|
yield return StartCoroutine(PushPlayOnTop()); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
yield return new WaitForSeconds(1); |
|
|
|
CurrentPlayer = trappedCharacter; |
|
|
|
} |
|
|
|
|
|
|
|
trappedCharacter.stuck = false; |
|
|
|
isLillyPadUp = true; |
|
|
|
trappedCharacter = null; |
|
|
@ -83,6 +95,21 @@ public class Water : ActiveBlock |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private IEnumerator PushPlayOnTop() |
|
|
|
{ |
|
|
|
Direction[] possibleDirections = DirectionExtras.RandomOrder(); |
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) |
|
|
|
{ |
|
|
|
if (Block.isBlockAtPosition(position + possibleDirections[i].ToVector() + Vector3.up, 1, ~0)) |
|
|
|
continue; |
|
|
|
|
|
|
|
yield return StartCoroutine(DoPush(trappedCharacter, possibleDirections[i].ToVector())); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private IEnumerator LerpToPosition(Transform target, Vector3 endPos, float time) |
|
|
|
{ |
|
|
|
Vector3 _startPos = target.position; |
|
|
|