Updated some of the player prefabs and repositioned the camera slightly

on them
This commit is contained in:
Melbyj1125
2022-01-26 13:56:45 -06:00
parent 076bf0e158
commit eb5e3e22a7
7 changed files with 55 additions and 38 deletions

View File

@@ -4,7 +4,7 @@ using MLAPI;
using UnityEngine;
public class Dash : NetworkBehaviour {
public class Dash : NetworkBehaviour{
public Vector3 moveDirection;
public const float maxDashTime = 1.0f;
@@ -19,17 +19,34 @@ public class Dash : NetworkBehaviour {
PlayerMovement pMove;
void Start(){
characterController = GetComponent<CharacterController>();
characterController = this.gameObject.GetComponent<CharacterController>();
pMove = GetComponent<PlayerMovement>();
}
//UPDATE CHECK FOR MOVEMENT ONLY WHEN DASHING
void FixedUpdate(){
if(pMove.pStats.HasDash) DashPlayer();
}
void DashPlayer(){
if (!IsLocalPlayer) { return; }
if(pMove.pStats.HasDash){
DashMovement();
if(characterController.enabled == true){
if (Input.GetKeyDown(KeyCode.E) && isOnCoolDown == false)
{
currentDashTime = 0;
StartCoroutine(startCoolDown());
}
if(currentDashTime < maxDashTime)
{
moveDirection = transform.forward * dashDistance;
currentDashTime += dashStoppingSpeed;
}
else
{
moveDirection = Vector3.zero;
}
characterController.Move(moveDirection * Time.deltaTime * dashSpeed);
}
}
private IEnumerator startCoolDown(){
@@ -41,23 +58,4 @@ public class Dash : NetworkBehaviour {
Debug.Log("end corotine");
}
private void DashMovement(){
if (Input.GetKeyDown(KeyCode.E) && isOnCoolDown == false)
{
currentDashTime = 0;
StartCoroutine(startCoolDown());
}
if(currentDashTime < maxDashTime)
{
moveDirection = transform.forward * dashDistance;
currentDashTime += dashStoppingSpeed;
}
else
{
moveDirection = Vector3.zero;
}
//characterController.Move(moveDirection * Time.deltaTime * dashSpeed);
}
}

View File

@@ -19,7 +19,7 @@ MonoBehaviour:
minVelM: 0
curVelM: 0
accM: 0
jumpPowM: 30
jumpPowM: 15
jumpNumM: 0
tractionM: 0
kickPowM: 0