fixed camera system and brightened recipticles

This commit is contained in:
2023-05-10 23:59:58 -04:00
parent d90419f579
commit aafb240391
181 changed files with 35174 additions and 2991 deletions

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Xml;
using Unity.VisualScripting;
using Unity.VisualScripting.FullSerializer;
using UnityEngine;
[RequireComponent(typeof(Collider))]
@ -45,6 +46,9 @@ public class PlayerInteractionHandler : MonoBehaviour
public bool isDead = false;
//Check if button down
private AxisIsDown fireDown = new AxisIsDown("Fire1");
// Start is called before the first frame update
void Start()
{
@ -76,16 +80,36 @@ public class PlayerInteractionHandler : MonoBehaviour
index = -1;
return false;
}
private void DropHeavy()
{
if (heavyInvent != null)
{
heavyInvent.transform.parent = null;
heavyInvent.GetComponent<Rigidbody>().isKinematic = false;
heavyInvent.EnableAll();
heavyInvent = null;
}
}
// Update is called once per frame
void Update()
{
fireDown.Check();
if (this.isDead)
{
DropHeavy();
return;
}
if (manager.IsPaused||isDead)
{
return;
}
if(Input.GetButtonDown("Fire1"))
if(Input.GetButtonDown("Fire1")||fireDown.IsDown())
{
if (this.GunEnabled)
{
@ -173,10 +197,7 @@ public class PlayerInteractionHandler : MonoBehaviour
}
else
{
heavyInvent.transform.parent = null;
heavyInvent.GetComponent<Rigidbody>().isKinematic = false;
heavyInvent.EnableAll();
heavyInvent = null;
this.DropHeavy();
}
@ -233,6 +254,7 @@ public class PlayerInteractionHandler : MonoBehaviour
{
}
}
public void EnableFlashlight()
{
@ -292,3 +314,41 @@ public class PlayerInteractionHandler : MonoBehaviour
}
}
}
class AxisIsDown
{
private string axisName;
private bool isDown = false;
private bool pIsDown = false;
private float axis;
private bool down = false;
public void Check()
{
axis = Input.GetAxis(axisName);
isDown = axis > 0.5f;
if (isDown != pIsDown&&isDown)
{
down = true;
}
else
{
down = false;
}
pIsDown = isDown;
}
public bool IsDown()
{
return this.down;
}
public AxisIsDown(string axisName)
{
this.axisName = axisName;
}
}

View File

@ -69,9 +69,12 @@ public class PlayerMovementController : MonoBehaviour
private void MovePlayer()
{
Vector3 movement = Vector3.zero;
movement += transform.forward * Mathf.Abs(y) * Time.deltaTime * speed;//+(transform.right*x*Time.deltaTime*speed);
//movement += transform.right * Mathf.Abs(x) * Time.deltaTime * sideSpeed;
movement += transform.forward * Mathf.Abs(x) * Time.deltaTime * speed;
//movement += transform.forward * Mathf.Abs(y) * Time.deltaTime * speed;//+(transform.right*x*Time.deltaTime*speed);
movement += cam.transform.forward *y * Time.deltaTime * speed;
//movement += transform.forward * Mathf.Abs(x) * Time.deltaTime * speed;
movement += cam.transform.right * x * Time.deltaTime*speed;
movement += Vector3.down * 9.8f;
ccontroller.Move(movement);
}