mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
Changed Player Stats and altered kick hit box
This commit is contained in:
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
|
||||
public class dGrapplingHook : NetworkBehaviour
|
||||
{
|
||||
public float maxGrappleDistance = 25;
|
||||
public float maxGrappleDistance = 25;
|
||||
|
||||
public bool isGrappled;
|
||||
private int hookPointIndex;
|
||||
@@ -19,6 +19,13 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
[SerializeField] private float ropeLength;
|
||||
private float climbRate = 5;
|
||||
|
||||
Vector3 tensionDirection;
|
||||
Vector3 pendulumSideDirection;
|
||||
Vector3 tangentDirection;
|
||||
float tensionForce;
|
||||
public Vector3 forceDirection;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -56,6 +63,7 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
//if (!IsLocalPlayer) { return; }
|
||||
if (isGrappled)
|
||||
{
|
||||
Debug.DrawRay(gameObject.transform.position, (hookPoint.transform.position - gameObject.transform.position)); //Visual of line
|
||||
@@ -82,9 +90,7 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
if (Vector3.Distance(gameObject.transform.position, hookPoint.transform.position) > ropeLength )
|
||||
{
|
||||
//Impact Based
|
||||
Debug.Log("y");
|
||||
playerMovement.g = 2;
|
||||
movementController.Move((hookPoint.transform.position - gameObject.transform.position) * Time.deltaTime);
|
||||
forceDirection = calculateForceDirection(1, playerMovement.g, hookPoint.transform.position);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -105,60 +111,20 @@ public class dGrapplingHook : NetworkBehaviour
|
||||
}
|
||||
return index;
|
||||
}
|
||||
///////////Hookshot Concept
|
||||
// public float maxGrappleDistance = 25;
|
||||
|
||||
// public bool isGrappled;
|
||||
// private Vector3 hookPoint;
|
||||
// private float distance;
|
||||
// public float propelPower = 100;
|
||||
Vector3 calculateForceDirection(float mass, float g, Vector3 hPoint){
|
||||
tensionDirection = (hPoint - transform.position).normalized;
|
||||
Debug.Log(tensionDirection);
|
||||
|
||||
// private CharacterController movementController;
|
||||
// private dPlayerMovement playerMovement;
|
||||
// private PlayerStats pStats;
|
||||
// private Camera cam;
|
||||
// private Vector3 forwardHookLerp;
|
||||
// private Vector3 upwardsHookLerp;
|
||||
float inclinationAngle = Vector3.Angle(transform.position - hPoint, -transform.up);
|
||||
|
||||
// // Start is called before the first frame update
|
||||
// void Start()
|
||||
// {
|
||||
// isGrappled = false;
|
||||
// movementController = gameObject.GetComponent<CharacterController>();
|
||||
// playerMovement = gameObject.GetComponent<dPlayerMovement>();
|
||||
// pStats = gameObject.GetComponent<PlayerStats>();
|
||||
// cam = playerMovement.cam;
|
||||
// }
|
||||
|
||||
// private void FixedUpdate()
|
||||
// {
|
||||
// getGrapplePoint();
|
||||
// //Debug.Log((hookPoint.transform.position - transform.position).normalized);
|
||||
// if (isGrappled && !Input.GetKeyDown(KeyCode.E))
|
||||
// {
|
||||
// //playerMovement.AddImpact((hookPoint - transform.position), propelPower);
|
||||
// forwardHookLerp = Vector3.Lerp(forwardHookLerp, transform.forward * 50, .03f);
|
||||
// movementController.Move(forwardHookLerp * Time.deltaTime);
|
||||
tensionForce = mass * -g * Mathf.Cos(Mathf.Deg2Rad * inclinationAngle);
|
||||
Debug.Log(g);
|
||||
|
||||
// upwardsHookLerp = Vector3.Lerp(upwardsHookLerp, (hookPoint - transform.position).normalized * Vector3.Distance(transform.position, hookPoint) * propelPower, .03f);
|
||||
// movementController.Move(upwardsHookLerp * Time.deltaTime);
|
||||
// isGrappled = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void getGrapplePoint(){
|
||||
// //if E or left face gamepad button is pressed is slightly pressed
|
||||
// if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton2)) //If grapple button is hit
|
||||
// {
|
||||
// if (!isGrappled) //If we are not grappling
|
||||
// {
|
||||
// if(Physics.Raycast(cam.transform.position, cam.transform.forward, out RaycastHit raycastHit)){
|
||||
// if(raycastHit.collider.gameObject.transform.tag == "HookPoint"){
|
||||
// isGrappled = true;
|
||||
// hookPoint = new Vector3 (raycastHit.point.x,raycastHit.point.y,raycastHit.point.z);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Vector3 fDirection = tensionDirection * tensionForce;
|
||||
Debug.Log(fDirection);
|
||||
return fDirection;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public class dKickController : NetworkBehaviour
|
||||
leg.SetActive(true);
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
isKicking = false;
|
||||
leg.GetComponent<Collider>().isTrigger = false;
|
||||
leg.SetActive(false);
|
||||
|
||||
}
|
||||
@@ -74,6 +75,7 @@ public class dKickController : NetworkBehaviour
|
||||
Vector3 direction = this.transform.forward;
|
||||
Debug.Log(direction);
|
||||
collision.rigidbody.AddForce(direction * pStats.KickPow, ForceMode.Impulse);
|
||||
leg.GetComponent<Collider>().isTrigger = true;
|
||||
}
|
||||
if (collision.transform.CompareTag("destroyable") && myCollider == leg.GetComponent<Collider>()){
|
||||
collision.transform.gameObject.GetComponent<BreakableBlock>().damage(pStats.KickPow);
|
||||
|
||||
@@ -212,9 +212,9 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
driftVel = Vector3.zero;
|
||||
if(animator != null) animator.SetBool("isRunning", false);
|
||||
}
|
||||
|
||||
//Move Player
|
||||
moveController.Move(driftVel + (moveY * Time.deltaTime));
|
||||
if(grapple.isGrappled) moveController.Move(grapple.forceDirection * Time.deltaTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
if (Input.GetAxis("Jump") != 0 && !jumpHeld && curJumpNum < pStats.JumpNum && !isSliding)
|
||||
{
|
||||
if(wallRun.IsWallRunning()){
|
||||
AddImpact((wallRun.GetWallJumpDirection()), pStats.JumpPow * 10f);
|
||||
AddImpact((wallRun.GetWallJumpDirection()), pStats.JumpPow * 8f);
|
||||
g = pStats.JumpPow;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ public class dPlayerMovement : NetworkBehaviour
|
||||
}
|
||||
|
||||
//apply gravity if not grounded and coyote timer is less than 0
|
||||
if(isGrounded == false && curCoyJumpTimer <= 0){
|
||||
if((isGrounded == false && curCoyJumpTimer <= 0) || grapple.isGrappled){
|
||||
g -= grav * Time.deltaTime;
|
||||
}
|
||||
//else don't apply gravity
|
||||
|
||||
Reference in New Issue
Block a user