Browse Source

Did things

develop
Joshua Reason 3 years ago
parent
commit
49d950df58
9 changed files with 59 additions and 16 deletions
  1. BIN
      Assets/Data/GameTime.asset
  2. +8
    -0
      Assets/Data/GameTime.asset.meta
  3. +3
    -3
      Assets/Player/Leggies Controller.controller
  4. BIN
      Assets/Scenes/CreditScreen.unity
  5. BIN
      Assets/Scenes/MainGameplayScene.unity
  6. +8
    -0
      Assets/Scripts/Behaviours/YeetController.cs
  7. +25
    -0
      Assets/Scripts/Managers/GameManager.cs
  8. +7
    -9
      Assets/Scripts/Player Scripts/PlayerInputController.cs
  9. +1
    -0
      Assets/World Assets/Prefabs/Player.prefab

BIN
Assets/Data/GameTime.asset (Stored with Git LFS) View File

size 462

+ 8
- 0
Assets/Data/GameTime.asset.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 62f467f95cb26b748ab8b7b78ce2a931
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

+ 3
- 3
Assets/Player/Leggies Controller.controller View File

@ -10,7 +10,7 @@ AnimatorStateTransition:
m_Conditions: m_Conditions:
- m_ConditionMode: 3 - m_ConditionMode: 3
m_ConditionEvent: Movement m_ConditionEvent: Movement
m_EventTreshold: 0.1
m_EventTreshold: 0.2
m_DstStateMachine: {fileID: 0} m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 3556678140949118445} m_DstState: {fileID: 3556678140949118445}
m_Solo: 0 m_Solo: 0
@ -91,7 +91,7 @@ AnimatorController:
m_DefaultFloat: 0 m_DefaultFloat: 0
m_DefaultInt: 0 m_DefaultInt: 0
m_DefaultBool: 0 m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers: m_AnimatorLayers:
- serializedVersion: 5 - serializedVersion: 5
m_Name: Base Layer m_Name: Base Layer
@ -142,7 +142,7 @@ AnimatorStateTransition:
m_Conditions: m_Conditions:
- m_ConditionMode: 4 - m_ConditionMode: 4
m_ConditionEvent: Movement m_ConditionEvent: Movement
m_EventTreshold: 0.1
m_EventTreshold: 0.2
m_DstStateMachine: {fileID: 0} m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4814522835881346177} m_DstState: {fileID: -4814522835881346177}
m_Solo: 0 m_Solo: 0

BIN
Assets/Scenes/CreditScreen.unity (Stored with Git LFS) View File

size 43060

BIN
Assets/Scenes/MainGameplayScene.unity (Stored with Git LFS) View File

size 723701

+ 8
- 0
Assets/Scripts/Behaviours/YeetController.cs View File

@ -38,6 +38,9 @@ public class YeetController : InputBehaviour
private Vector3 preyeetPosition; private Vector3 preyeetPosition;
public PlayerInputController playerController;
private void Awake() private void Awake()
{ {
m_body = this.gameObject; m_body = this.gameObject;
@ -61,6 +64,9 @@ public class YeetController : InputBehaviour
m_YeetAnimator.SetBool("Yeet", true); m_YeetAnimator.SetBool("Yeet", true);
m_audioSource.Play(); m_audioSource.Play();
playerController.m_playerSpeed /= 3;
} }
public void Preyeet() public void Preyeet()
@ -91,6 +97,8 @@ public class YeetController : InputBehaviour
Destroy(m_lineRenderer); Destroy(m_lineRenderer);
m_audioSource.Play(); m_audioSource.Play();
playerController.m_playerSpeed *= 3;
} }
void Start() void Start()

+ 25
- 0
Assets/Scripts/Managers/GameManager.cs View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Variables;
public class GameManager : MonoBehaviour public class GameManager : MonoBehaviour
{ {
@ -11,7 +12,16 @@ public class GameManager : MonoBehaviour
[SerializeField] [SerializeField]
private GameObject m_playerPrefab; private GameObject m_playerPrefab;
[SerializeField]
private Reference<float> m_TimeLeft;
[SerializeField]
private Reference<float> m_TotalTime;
[SerializeField,NaughtyAttributes.Scene]
private string m_creditScene;
private bool m_gameEndCalled;
private Camera m_camera; private Camera m_camera;
private void OnEnable() private void OnEnable()
@ -29,6 +39,16 @@ public class GameManager : MonoBehaviour
{ {
SetUpPlayers(); SetUpPlayers();
m_camera = Camera.main; m_camera = Camera.main;
m_TimeLeft.Value = m_TotalTime;
}
private void Update()
{
m_TimeLeft.Value -= Time.deltaTime;
if (m_TimeLeft < 0 && !m_gameEndCalled)
OnGameEnd();
} }
private void SetUpPlayers() private void SetUpPlayers()
@ -39,6 +59,11 @@ public class GameManager : MonoBehaviour
} }
} }
private void OnGameEnd()
{
m_gameEndCalled = true;
UnityEngine.SceneManagement.SceneManager.LoadScene(m_creditScene);
}
private void SpawnPlayer(PlayerData data) private void SpawnPlayer(PlayerData data)
{ {

+ 7
- 9
Assets/Scripts/Player Scripts/PlayerInputController.cs View File

@ -9,7 +9,7 @@ public class PlayerInputController : InputBehaviour
[SerializeField] [SerializeField]
private float m_playerSpeed = 1;
public float m_playerSpeed = 1;
[SerializeField] [SerializeField]
private float m_rotationSpeed = 1; private float m_rotationSpeed = 1;
@ -29,10 +29,13 @@ public class PlayerInputController : InputBehaviour
private Vector3 m_desiredDirection; private Vector3 m_desiredDirection;
private bool m_recievedInput => m_desiredDirection.magnitude != 0; private bool m_recievedInput => m_desiredDirection.magnitude != 0;
public Vector3 m_CameraForwards;
private void Awake() private void Awake()
{ {
m_controller = GetComponent<CharacterController>(); m_controller = GetComponent<CharacterController>();
//m_CameraForwards = Vector3.ProjectOnPlane(Camera.main.transform.forward,Vector3.up).normalized;
} }
@ -53,16 +56,11 @@ public class PlayerInputController : InputBehaviour
private void ApplyRotation() private void ApplyRotation()
{ {
transform.forward = Vector3.Slerp(transform.forward, m_desiredDirection.normalized, m_rotationSpeed * Time.deltaTime);
transform.forward = Vector3.Slerp(transform.forward, m_desiredDirection, m_rotationSpeed * Time.deltaTime);
} }
private void ApplyMovement() private void ApplyMovement()
{
{
float forwardRatio = (Vector3.Dot(transform.forward, m_desiredDirection.normalized) + 1) / 2; float forwardRatio = (Vector3.Dot(transform.forward, m_desiredDirection.normalized) + 1) / 2;
float speed = m_turnRadius.Evaluate(forwardRatio) * m_playerSpeed; float speed = m_turnRadius.Evaluate(forwardRatio) * m_playerSpeed;
m_legAnimator.SetFloat("Movement", speed); m_legAnimator.SetFloat("Movement", speed);
@ -70,7 +68,7 @@ public class PlayerInputController : InputBehaviour
if (!m_recievedInput) if (!m_recievedInput)
return; return;
m_controller.Move(transform.forward * speed * Time.deltaTime);
m_controller.Move(transform.forward.normalized * speed * Time.deltaTime);
} }
private void LockAxis(Vector3 axis) private void LockAxis(Vector3 axis)

+ 1
- 0
Assets/World Assets/Prefabs/Player.prefab View File

@ -153,6 +153,7 @@ MonoBehaviour:
windupSpeed: 0.1 windupSpeed: 0.1
m_YeetAnimator: {fileID: 7280267804803618209} m_YeetAnimator: {fileID: 7280267804803618209}
trajectoryLineMaterial: {fileID: 2100000, guid: e4dd9001cbdeb53449bec6dddcf07c3d, type: 2} trajectoryLineMaterial: {fileID: 2100000, guid: e4dd9001cbdeb53449bec6dddcf07c3d, type: 2}
playerController: {fileID: 2725293205319018847}
--- !u!1 &6496616781582263990 --- !u!1 &6496616781582263990
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

Loading…
Cancel
Save