Fixed NetworkTransforms and Added Host IP

- Fixed placement of NetworkTransform on Prefab - Needs to be on the
  same level as the character controller and movement
- Added a display of the host IP address in the lobby
This commit is contained in:
2021-11-03 14:03:43 -05:00
parent a47550e85b
commit 2953687180
14 changed files with 252 additions and 466 deletions

View File

@@ -1,10 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using MLAPI;
using UnityEngine;
public class Blink : MonoBehaviour{
public class Blink : NetworkBehaviour {
// Start is called before the first frame update
@@ -42,6 +43,8 @@ public class Blink : MonoBehaviour{
//blinks the player forwards
private void BlinkMove()
{
if (!IsLocalPlayer) { return; }
if (Input.GetMouseButton(1))
{
// Finding the origin and end point of laser.

View File

@@ -1,9 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using MLAPI;
using UnityEngine;
public class Dash : MonoBehaviour{
public class Dash : NetworkBehaviour {
public Vector3 moveDirection;
public const float maxDashTime = 1.0f;
@@ -20,6 +21,8 @@ public class Dash : MonoBehaviour{
//UPDATE CHECK FOR MOVEMENT ONLY WHEN DASHING
void FixedUpdate(){
if (!IsLocalPlayer) { return; }
if (Input.GetKeyDown(KeyCode.E))
{
currentDashTime = 0;

View File

@@ -1,9 +1,10 @@
using UnityEngine;
using System.Linq;
using MLAPI;
using UnityEngine.Rendering;
[RequireComponent (typeof(PlayerMovement))]
public class WallRun : MonoBehaviour
public class WallRun : NetworkBehaviour
{
public float wallMaxDistance = 1;
@@ -67,6 +68,8 @@ public class WallRun : MonoBehaviour
public void WallRunRoutine()
{
if (!IsLocalPlayer) { return; }
isWallRunning = false;
if(playerMovementController.GetJumpPressed())

View File

@@ -1,8 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using MLAPI;
using UnityEngine;
public class PlayerCam : MonoBehaviour
public class PlayerCam : NetworkBehaviour
{
public GameObject player;
@@ -16,6 +17,8 @@ public class PlayerCam : MonoBehaviour
void Update ()
{
if (!IsLocalPlayer) { return; }
offset = transform.parent.forward * rad.magnitude;
transform.position = new Vector3((player.transform.position.x - offset.x),((player.transform.position.y - offset.y)+2),(player.transform.position.z - offset.z));

View File

@@ -165,11 +165,8 @@ public class PlayerMovement : NetworkBehaviour
//Checks if player should respawn
Respawn();
}
//Reads inputs and moves player
private void InputController()
{
@@ -235,6 +232,8 @@ public class PlayerMovement : NetworkBehaviour
//Applies impact in a direction with the given force
public void AddImpact(Vector3 dir, float force)
{
if (!IsLocalPlayer) { return; }
dir.Normalize();
if (dir.y < 0) dir.y = -dir.y; // reflect down force on the ground
impact += dir.normalized * force / mass;