You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

52 lines
1.3 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Air : ActiveBlock
{
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;
isFinished = true;
}
public override IEnumerator OnRoundEnd(PlayerData[] allPlayers)
{
isFinished = true;
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;
}
}