- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- public class Air : ActiveBlock
- {
-
- int DeleteCount = 2;
-
- public override int GetInitative()
- {
- return -1;
- }
-
- public override IEnumerator OnWalkedOnByPlayer(Character player, Vector3 moveDirection)
- {
- player.stuck = true;
- player.respawnNeeded = true;
-
- StartCoroutine(player.AnimateToPosition(transform.position + Vector3.down * 10,Character.Animation.Hit, 1));
- yield return StartCoroutine(LerpScale(player.transform, Vector3.zero, 1));
-
- //player.gameObject.SetActive(false);
- Debug.Log("Set player scale to one");
- player.transform.localScale = Vector3.one;
-
- }
-
- public override IEnumerator OnRoundEnd(PlayerData[] allPlayers)
- {
- isFinished = true;
-
- DeleteCount--;
- if (DeleteCount == 0)
- Destroy(gameObject);
-
- yield break;
- }
-
- private IEnumerator LerpScale(Transform target, Vector3 endScale, float time)
- {
-
- Vector3 startScale = target.localScale;
- float elapsedTime = 0;
-
- while(elapsedTime < time)
- {
-
- target.localScale = Vector3.Slerp(startScale, endScale, (elapsedTime / time));
-
- yield return new WaitForEndOfFrame();
- elapsedTime += Time.deltaTime;
- }
-
- target.localScale = endScale;
- }
- }
|