TheKingsRace/Assets/Scripts/KickController.cs
Evan Nydahl 981b42dc51 Added a rough kicking prototype
-two scritpts that deal with kick logic
-added ball and leg to player in Evan_Prototypes scene
2021-10-08 13:52:36 -05:00

31 lines
748 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KickController : MonoBehaviour
{
//Important, may want to change blink code to only work for trigger collider
// so that the player doesn't teleport to their leg
public GameObject leg;
private bool isKicking = false;
void Update(){
//if k is pressed enable leg for .3 seconds
if(Input.GetKeyDown(KeyCode.F) && isKicking==false){
StartCoroutine(Kicking(.3f));
}
}
private IEnumerator Kicking(float waitTime)
{
isKicking = true;
leg.SetActive(true);
yield return new WaitForSeconds(waitTime);
isKicking = false;
leg.SetActive(false);
}
}