Lobby done with broken animation and without steam

This commit is contained in:
Madhav Kapa
2023-06-14 07:21:44 -04:00
parent 39eb7753d2
commit 463545ad9c
11 changed files with 497 additions and 460 deletions

View File

@ -1,7 +1,10 @@
using UnityEngine;
using FishNet.Object;
using FishNet.Connection;
namespace Player
{
public class CameraController : MonoBehaviour
public class CameraController : NetworkBehaviour
{
//private float mouseX = 0;
//private float mouseY;
@ -20,7 +23,6 @@ namespace Player
//[SerializeField]
// private bool isChild = false;
// Start is called before the first frame update
private void Start()
{

View File

@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Player
{

View File

@ -19,7 +19,7 @@ namespace Player
[SerializeField] private PlayerMovementController movement;
//private float verticalAiming = 0;
[SerializeField] private Camera hiddenCam;
public Camera hiddenCam;
private bool isRunning;

View File

@ -1,11 +1,13 @@
using System.Collections;
using Cinemachine;
using UnityEngine;
using FishNet.Object;
using FishNet.Connection;
namespace Player
{
public class PlayerMovementController : MonoBehaviour
public class PlayerMovementController : NetworkBehaviour
{
[SerializeField] private PlayerAnimationController animcontroller;
@ -21,6 +23,8 @@ namespace Player
[SerializeField] public Camera cam;
private GameObject camObject;
[HideInInspector] public bool AllowRotation;
[HideInInspector] public bool IsAiming;
@ -46,7 +50,7 @@ namespace Player
private Vector3 lookingDirectionVector;
[SerializeField]
private Scriptable.GameState manager;
private bool movementLocked;
@ -57,15 +61,33 @@ namespace Player
public float NoiseDistance => noiseSettings.NoiseDistance;
public override void OnStartClient()
{
base.OnStartClient();
if (base.IsOwner)
{
cam = GameObject.Find("CameraHidden").GetComponent<Camera>();
camObject = GameObject.Find("CM vcam1");
Debug.Log("Setting camera for " + transform.GetChild(0).GetChild(2).name + "with camera " + camObject.name);
camObject.GetComponent<CinemachineFreeLook>().Follow = transform;
camObject.GetComponent<CinemachineFreeLook>().LookAt = transform.GetChild(0).GetChild(2);
transform.GetChild(0).GetComponent<PlayerAnimationController>().hiddenCam = cam;
}
else
{
this.enabled = false;
}
}
// Start is called before the first frame update
private void Start()
{
ccForceAddon = ccontroller.gameObject.GetComponent<CharacterControllerForce>();
initXSensitivity = freelook.m_XAxis.m_MaxSpeed;
initYSensitivity = freelook.m_YAxis.m_MaxSpeed;
}
// Update is called once per frame
@ -105,10 +127,10 @@ namespace Player
IsRunning = Mathf.Abs(y) > 0.1f || Mathf.Abs(x) > 0.1f;
}
/// <summary>
/// Gets called by PlayerComponent to change sensitivity.
/// </summary>
/// <param name="sensitivity"></param>
/// <summary>
/// Gets called by PlayerComponent to change sensitivity.
/// </summary>
/// <param name="sensitivity"></param>
public void SetSensitivity(float sensitivity)
{
freelook.m_XAxis.m_MaxSpeed = initXSensitivity * sensitivity;