This commit is contained in:
GamerClassN7
2022-01-28 21:50:13 +01:00
parent 0fc153e885
commit 1820f823cc
17 changed files with 1802 additions and 457 deletions

View File

@@ -0,0 +1,68 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float walkSpeed = 7.5f;
public float runningSpeed = 7.5f;
public float jumpSpeed = 7.5f;
public float lookSpeed = 7.5f;
public float lookXLimit = 7.5f;
public Camera playerCamera;
Vector3 moveDirection = Vector3.zero;
CharacterController characterController;
public float rotationX = 0;
// Start is called before the first frame update
[HideInInspector]
bool canMove = true;
Rigidbody rb;
float moveDirectionY;
public Vector3 jump;
public float jumpForce = 2.0f;
void Start()
{
rb = GetComponent<Rigidbody>();
characterController = GetComponent<CharacterController>();
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
jump = new Vector3(0.0f, 2.0f, 0.0f);
}
// Update is called once per frame
void Update()
{
rotationX += -Input.GetAxis("Mouse Y") * lookSpeed;
rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit);
playerCamera.transform.localRotation = Quaternion.Euler(rotationX, 0, 0);
transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") * lookSpeed, 0);
bool isRunning = Input.GetKey(KeyCode.LeftShift);
float curSpeedX = canMove ? (isRunning ? runningSpeed : walkSpeed) * Input.GetAxis("Vertical") : 0;
float curSpeedY = canMove ? (isRunning ? runningSpeed : walkSpeed) * Input.GetAxis("Horizontal") : 0;
moveDirection = (transform.forward * curSpeedX * Time.deltaTime) + (transform.right * curSpeedY * Time.deltaTime);
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("Jump");
rb.AddForce(transform.up * jumpSpeed * 500 * Time.deltaTime, ForceMode.Impulse);
}
rb.MovePosition(rb.position + moveDirection);
//characterController.Move(moveDirection * Time.deltaTime);
}
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "platform")
{
this.gameObject.tranform.rotation = collision.gameObject.transform.rotation;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b108dca155b156640a1beb1eeaa1995d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PostProcessingController : MonoBehaviour
{
[ColorUsageAttribute(true, true)] public Color color;
public Renderer renderer;
public bool emissionUp = false;
private int emmisionStep = 0;
public int emmisionStepChange = 30;
// Start is called before the first frame update
void Start()
{
color = renderer.material.GetColor("_EmissionColor");
}
// Update is called once per frame
void FixedUpdate()
{
if (emmisionStep < emmisionStepChange)
{
if (emissionUp)
{
color += color * 0.01f;
}
else
{
color -= color * 0.01f;
}
}
else
{
emissionUp = !emissionUp;
emmisionStep = 0;
}
emmisionStep++;
renderer.material.SetColor("_EmissionColor", color);
Debug.Log(color);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f81168d5466126a439c5e406bfe5ce97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: