feat: add throwable boxs and set it as prefab

This commit is contained in:
Pierre Ryssen
2026-03-30 23:49:36 +02:00
871 changed files with 541814 additions and 229 deletions

View File

@@ -0,0 +1,38 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
m_Name: InputSystem.inputsettings
m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.InputSettings
m_SupportedDevices: []
m_UpdateMode: 1
m_ScrollDeltaBehavior: 0
m_MaxEventBytesPerUpdate: 5242880
m_MaxQueuedEventsPerUpdate: 1000
m_CompensateForScreenOrientation: 1
m_BackgroundBehavior: 0
m_EditorInputBehaviorInPlayMode: 0
m_InputActionPropertyDrawerMode: 0
m_DefaultDeadzoneMin: 0.125
m_DefaultDeadzoneMax: 0.925
m_DefaultButtonPressPoint: 0.5
m_ButtonReleaseThreshold: 0.75
m_DefaultTapTime: 0.2
m_DefaultSlowTapTime: 0.5
m_DefaultHoldTime: 0.4
m_TapRadius: 5
m_MultiTapDelayTime: 0.75
m_DisableRedundantEventsMerging: 0
m_ShortcutKeysConsumeInputs: 0
m_iOSSettings:
m_MotionUsage:
m_Enabled: 0
m_Description:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 23cbff887a25b3802a937fef9deab3ec
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: b319948d6750538498f201a24c05aef3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 0
wrapperCodePath:
wrapperClassName:
wrapperCodeNamespace:

View File

@@ -0,0 +1,6 @@
using UnityEngine;
public class PlayerAnimation
{
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3c207b98ba2f6229b84db151dd7b4255

View File

@@ -0,0 +1,120 @@
using UnityEngine;
public class PlayerHeadController : MonoBehaviour
{
public Transform Head;
public Transform CameraTransform;
public Transform BodyTransform;
public float ThrowForce;
public float PickupDistance;
public bool isHoldingHead;
private Rigidbody m_headRigidbody;
private Vector3 m_headInitialLocalPos;
private Quaternion m_headInitialLocalRot;
private Animator animator;
private PlayerInputController input;
private void Awake()
{
animator = GetComponent<Animator>();
input = GetComponent<PlayerInputController>();
}
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Vector3 offset = new Vector3(0f, -0.5f, 0.5f);
m_headInitialLocalPos = BodyTransform.localPosition + offset;
m_headInitialLocalRot = BodyTransform.localRotation;
m_headRigidbody = Head.GetComponent<Rigidbody>();
Head.SetParent(null);
}
void Update()
{
if (input.HeadInteractionPressed)
{
InteractHead();
}
if (input.ThrowPressed)
{
ThrowHead();
}
}
private void InteractHead()
{
if (!isHoldingHead)
TryPickupHead();
else
DropHead();
}
private void DropHead()
{
Debug.Log("DropHead");
animator.SetTrigger("Throw");
isHoldingHead = false;
Head.SetParent(null);
m_headRigidbody = Head.gameObject.AddComponent<Rigidbody>();
m_headRigidbody.mass = 1f;
m_headRigidbody.constraints =
RigidbodyConstraints.FreezeRotationX |
RigidbodyConstraints.FreezeRotationZ |
RigidbodyConstraints.FreezeRotationY;
}
private void ThrowHead()
{
Debug.Log("ThrowHead");
if (!isHoldingHead)
return;
DropHead();
m_headRigidbody.AddForce(CameraTransform.forward * ThrowForce, ForceMode.Impulse);
}
private void TryPickupHead()
{
if (isHoldingHead)
return;
float distance = Vector3.Distance(transform.position, Head.position);
if (distance <= PickupDistance)
{
PickupHead();
}
}
private void PickupHead()
{
Debug.Log("PickupHead");
isHoldingHead = true;
if (m_headRigidbody != null)
{
Destroy(m_headRigidbody);
}
Head.SetParent(transform);
Head.localPosition = m_headInitialLocalPos;
Head.localRotation = m_headInitialLocalRot;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2da51dfecccc45b469912e3bb3f1953b

View File

@@ -0,0 +1,80 @@
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerInputController : MonoBehaviour
{
public InputActionAsset InputActions;
public bool InputEnabled { get; private set; } = true;
private InputAction m_moveAction;
private InputAction m_lookAction;
private InputAction m_jumpAction;
private InputAction m_throwAction;
private InputAction m_shiftAction;
private InputAction m_interactAction;
private InputAction m_headInteractAction;
public Vector2 MoveAmount { get; private set; }
public Vector2 LookAmount { get; private set; }
public bool JumpPressed { get; private set; }
public bool ShiftPressed { get; private set; }
public bool ThrowPressed { get; private set; }
public bool InteractPressed { get; private set; }
public bool HeadInteractionPressed { get; private set; }
private void Awake()
{
var map = InputActions.FindActionMap("Player");
m_moveAction = map.FindAction("Move");
m_lookAction = map.FindAction("Look");
m_jumpAction = map.FindAction("Jump");
m_shiftAction = map.FindAction("Shift");
m_throwAction = map.FindAction("Throw");
m_interactAction = map.FindAction("Interact");
m_headInteractAction = map.FindAction("HeadInteract");
}
private void OnEnable()
{
InputActions.FindActionMap("Player").Enable();
}
private void OnDisable()
{
InputActions.FindActionMap("Player").Disable();
}
private void Update()
{
if (!InputEnabled)
{
MoveAmount = Vector2.zero;
LookAmount = Vector2.zero;
ShiftPressed = false;
JumpPressed = false;
ThrowPressed = false;
InteractPressed = false;
HeadInteractionPressed = false;
return;
}
MoveAmount = m_moveAction.ReadValue<Vector2>();
LookAmount = m_lookAction.ReadValue<Vector2>();
ShiftPressed = m_shiftAction.IsPressed();
JumpPressed = m_jumpAction.WasPressedThisFrame();
ThrowPressed = m_throwAction.WasPressedThisFrame();
InteractPressed = m_interactAction.WasPressedThisFrame();
HeadInteractionPressed = m_headInteractAction.WasPressedThisFrame();
}
public void SetInputEnabled(bool enabled)
{
InputEnabled = enabled;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1d8f349ed7dc088a4a6e2690ee87094a

View File

@@ -0,0 +1,34 @@
using UnityEngine;
public class PlayerJump : MonoBehaviour
{
public float JumpForce = 5;
public Transform GroundCheck;
public float GroundCheckRadius = 0.2f;
private Rigidbody m_rigidbody;
private PlayerInputController input;
private void Awake()
{
m_rigidbody = GetComponent<Rigidbody>();
input = GetComponent<PlayerInputController>();
}
private void Update()
{
if (input.JumpPressed)
{
Jump();
}
}
public void Jump()
{
if (Physics.CheckSphere(GroundCheck.position, GroundCheckRadius, LayerMask.GetMask("Ground")))
{
m_rigidbody.AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9c524d12bc1668e42a00cbd8050107f6

View File

@@ -0,0 +1,57 @@
using UnityEngine;
public class PlayerLook : MonoBehaviour
{
public Transform CameraTransform;
public Transform Head;
public float RotateSpeed = 5;
public float MaxLookAngle = 90f;
private float m_verticalRotation = 0f;
private Rigidbody m_rigidbody;
private PlayerInputController input;
private PlayerHeadController headController;
private void Awake()
{
m_rigidbody = GetComponent<Rigidbody>();
input = GetComponent<PlayerInputController>();
headController = GetComponent<PlayerHeadController>();
}
private void FixedUpdate()
{
Vector2 m_lookAmt = input.LookAmount;
if (m_lookAmt.magnitude <= 0.01f)
return;
if (!headController.isHoldingHead || input.ShiftPressed && headController.isHoldingHead)
{
float headRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
Head.Rotate(0, headRotation, 0);
if (CameraTransform != null)
{
m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
}
}
else
{
float horizontalRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
Quaternion deltaRotation = Quaternion.Euler(0, horizontalRotation, 0);
m_rigidbody.MoveRotation(m_rigidbody.rotation * deltaRotation);
if (CameraTransform != null)
{
m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
}
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6c1ddada0161b8c4783806ef6775348a

View File

@@ -0,0 +1,74 @@
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float WalkSpeed = 10;
public float rotationSpeed = 10f;
public Animator animator;
public Transform cameraTransform;
private Rigidbody m_rigidbody;
private PlayerInputController input;
private PlayerHeadController headController;
private Vector3 moveDirection;
private void Awake()
{
m_rigidbody = GetComponent<Rigidbody>();
input = GetComponent<PlayerInputController>();
animator = GetComponent<Animator>();
headController = GetComponent<PlayerHeadController>();
if (m_rigidbody != null)
{
m_rigidbody.freezeRotation = true;
}
}
private void FixedUpdate()
{
Vector2 m_moveAmt = input.MoveAmount;
float horizontal = m_moveAmt.x;
float vertical = m_moveAmt.y;
Vector3 cameraForward = cameraTransform.forward;
Vector3 cameraRight = cameraTransform.right;
cameraForward.y = 0f;
cameraRight.y = 0f;
cameraForward.Normalize();
cameraRight.Normalize();
moveDirection = (cameraForward * vertical + cameraRight * horizontal).normalized;
if (headController.isHoldingHead)
{
m_rigidbody.MovePosition(
m_rigidbody.position + Time.deltaTime * WalkSpeed * moveDirection
);
}
else
{
if (moveDirection.magnitude >= 0.1f)
{
m_rigidbody.MovePosition(
m_rigidbody.position + Time.deltaTime * WalkSpeed * moveDirection
);
Quaternion targetRotation = Quaternion.LookRotation(moveDirection);
transform.rotation = Quaternion.Slerp(
transform.rotation,
targetRotation,
rotationSpeed * Time.deltaTime
);
}
}
bool isMoving = m_moveAmt.magnitude > 0.1f;
animator.SetBool("isWalking", isMoving);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7f91586e8c2742341aa8f6925e597bf1

View File

@@ -0,0 +1,264 @@
using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class RobotBootSequence : MonoBehaviour
{
[Header("References")]
public PlayerInputController InputController;
public Transform CameraTransform;
[Header("Timing")]
public bool PlayOnStart = true;
[Min(0.1f)] public float BootDuration = 2.4f;
[Min(0.1f)] public float CharacterPerSecond = 40f;
[Min(0f)] public float LinePause = 0.35f;
[Min(0f)] public float DelayBeforeReveal = 0.4f;
[Header("Motion")]
public Vector2 StartYawPitch = new Vector2(-30f, -20f);
public float RollWobble = 2.5f;
public float WobbleFrequency = 16f;
public AnimationCurve EaseCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
[Header("Boot Text")]
public Color BootTextColor = new Color(0.62f, 1f, 0.7f, 1f);
public string[] BootLines =
{
"UNIT SB-3954 | preparing startup . . .",
"verification of OS-5 . . . 4 . . . 3 . . . 2 . . . 1",
"system integrity: OK",
"motor bus: OK",
"vision pipeline: ONLINE",
"SYSTEM OK"
};
[Header("Optional Audio")]
public AudioSource BootAudioSource;
private bool m_IsPlaying;
private struct BootUI
{
public Canvas Canvas;
public RectTransform LeftPanel;
public RectTransform RightPanel;
public TextMeshProUGUI Text;
}
private void Awake()
{
if (InputController == null)
{
InputController = GetComponent<PlayerInputController>();
}
}
private void Start()
{
if (PlayOnStart)
{
StartCoroutine(PlayBootSequence());
}
}
[ContextMenu("Play Boot Sequence")]
public void PlayBootSequenceFromMenu()
{
if (!Application.isPlaying || m_IsPlaying)
{
return;
}
StartCoroutine(PlayBootSequence());
}
public IEnumerator PlayBootSequence()
{
if (m_IsPlaying)
{
yield break;
}
m_IsPlaying = true;
if (InputController != null)
{
InputController.SetInputEnabled(false);
}
if (BootAudioSource != null)
{
BootAudioSource.Play();
}
if (CameraTransform == null)
{
m_IsPlaying = false;
if (InputController != null)
{
InputController.SetInputEnabled(true);
}
yield break;
}
Quaternion gameplayRotation = CameraTransform.localRotation;
Quaternion fromRotation = Quaternion.Euler(StartYawPitch.y, StartYawPitch.x, 0f) * gameplayRotation;
CameraTransform.localRotation = fromRotation;
BootUI bootUI = CreateBootUI();
yield return StartCoroutine(PlayBootText(bootUI.Text));
if (DelayBeforeReveal > 0f)
{
yield return new WaitForSeconds(DelayBeforeReveal);
}
float elapsed = 0f;
while (elapsed < BootDuration)
{
elapsed += Time.deltaTime;
float t = Mathf.Clamp01(elapsed / BootDuration);
float eased = EaseCurve.Evaluate(t);
float wobbleFade = 1f - eased;
float roll = Mathf.Sin(Time.time * WobbleFrequency) * RollWobble * wobbleFade;
Quaternion wobbleRotation = Quaternion.Euler(0f, 0f, roll);
CameraTransform.localRotation = Quaternion.Slerp(fromRotation, gameplayRotation, eased) * wobbleRotation;
RectTransform rootRect = bootUI.Canvas.GetComponent<RectTransform>();
float halfWidth = rootRect.rect.width * 0.5f;
float leftTarget = -(halfWidth + 24f);
float rightTarget = halfWidth + 24f;
bootUI.LeftPanel.anchoredPosition = new Vector2(Mathf.Lerp(0f, leftTarget, eased), 0f);
bootUI.RightPanel.anchoredPosition = new Vector2(Mathf.Lerp(0f, rightTarget, eased), 0f);
Color textColor = bootUI.Text.color;
textColor.a = 1f - eased;
bootUI.Text.color = textColor;
yield return null;
}
CameraTransform.localRotation = gameplayRotation;
if (bootUI.Canvas != null)
{
Destroy(bootUI.Canvas.gameObject);
}
if (InputController != null)
{
InputController.SetInputEnabled(true);
}
m_IsPlaying = false;
}
private IEnumerator PlayBootText(TextMeshProUGUI label)
{
if (label == null || BootLines == null || BootLines.Length == 0)
{
yield break;
}
label.text = string.Empty;
float charDelay = CharacterPerSecond <= 0f ? 0f : 1f / CharacterPerSecond;
for (int i = 0; i < BootLines.Length; i++)
{
string line = BootLines[i];
for (int c = 0; c < line.Length; c++)
{
label.text += line[c];
if (charDelay > 0f)
{
yield return new WaitForSeconds(charDelay);
}
}
if (i < BootLines.Length - 1)
{
label.text += "\n";
}
if (LinePause > 0f)
{
yield return new WaitForSeconds(LinePause);
}
}
}
private BootUI CreateBootUI()
{
BootUI ui = new BootUI();
GameObject canvasGO = new GameObject("RobotBootCanvas", typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));
Canvas canvas = canvasGO.GetComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvas.sortingOrder = 5000;
CanvasScaler scaler = canvasGO.GetComponent<CanvasScaler>();
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
scaler.referenceResolution = new Vector2(1920f, 1080f);
scaler.matchWidthOrHeight = 0.5f;
RectTransform root = canvasGO.GetComponent<RectTransform>();
root.anchorMin = Vector2.zero;
root.anchorMax = Vector2.one;
root.offsetMin = Vector2.zero;
root.offsetMax = Vector2.zero;
RectTransform leftPanel = CreatePanel("LeftPanel", root, true);
RectTransform rightPanel = CreatePanel("RightPanel", root, false);
TextMeshProUGUI label = CreateBootLabel(root);
ui.Canvas = canvas;
ui.LeftPanel = leftPanel;
ui.RightPanel = rightPanel;
ui.Text = label;
return ui;
}
private RectTransform CreatePanel(string panelName, RectTransform parent, bool isLeft)
{
GameObject panelGO = new GameObject(panelName, typeof(RectTransform), typeof(Image));
RectTransform rect = panelGO.GetComponent<RectTransform>();
rect.SetParent(parent, false);
rect.anchorMin = isLeft ? new Vector2(0f, 0f) : new Vector2(0.5f, 0f);
rect.anchorMax = isLeft ? new Vector2(0.5f, 1f) : new Vector2(1f, 1f);
rect.pivot = new Vector2(0.5f, 0.5f);
rect.offsetMin = Vector2.zero;
rect.offsetMax = Vector2.zero;
rect.anchoredPosition = Vector2.zero;
Image image = panelGO.GetComponent<Image>();
image.color = Color.black;
return rect;
}
private TextMeshProUGUI CreateBootLabel(RectTransform parent)
{
GameObject textGO = new GameObject("BootText", typeof(RectTransform), typeof(TextMeshProUGUI));
RectTransform rect = textGO.GetComponent<RectTransform>();
rect.SetParent(parent, false);
rect.anchorMin = new Vector2(0.13f, 0.5f);
rect.anchorMax = new Vector2(0.13f, 0.5f);
rect.pivot = new Vector2(0f, 0.5f);
rect.sizeDelta = new Vector2(980f, 380f);
TextMeshProUGUI text = textGO.GetComponent<TextMeshProUGUI>();
text.text = string.Empty;
text.fontSize = 40f;
text.alignment = TextAlignmentOptions.Left;
text.color = BootTextColor;
text.textWrappingMode = TextWrappingModes.Normal;
return text;
}
}

View File

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

View File

@@ -0,0 +1,216 @@
//using TMPro;
//using UnityEngine;
//using UnityEngine.InputSystem;
//public class PlayerMovement : MonoBehaviour
//{
// public InputActionAsset InputActions;
// private InputAction m_moveAction;
// private InputAction m_lookAction;
// private InputAction m_jumpAction;
// private InputAction m_throwAction;
// private InputAction m_pickupAction;
// private Vector2 m_moveAmt;
// private Vector2 m_lookAmt;
// private Rigidbody m_rigidbody;
// [Header("Camera/Head")]
// public Transform CameraTransform;
// public float MaxLookAngle = 90f;
// private float m_verticalRotation = 0f;
// public float WalkSpeed = 10;
// public float RotateSpeed = 5;
// public float JumpForce = 5;
// public Transform GroundCheck;
// public float GroundCheckRadius = 0.2f;
// public Animator animator;
// [Header("Head Settings")]
// public Transform Head;
// public float ThrowForce = 10f;
// public float PickupDistance = 3f;
// private bool m_isHeadThrown = false;
// private Rigidbody m_headRigidbody;
// private Vector3 m_headInitialLocalPos;
// private Quaternion m_headInitialLocalRot;
// private void Awake()
// {
// var map = InputActions.FindActionMap("Player");
// m_moveAction = map.FindAction("Move");
// m_lookAction = map.FindAction("Look");
// m_jumpAction = map.FindAction("Jump");
// m_throwAction = map.FindAction("Throw");
// m_pickupAction = map.FindAction("Pickup");
// m_rigidbody = GetComponent<Rigidbody>();
// animator = GetComponent<Animator>();
// }
// private void OnEnable()
// {
// InputActions.FindActionMap("Player").Enable();
// }
// private void OnDisable()
// {
// InputActions.FindActionMap("Player").Disable();
// }
// void Start()
// {
// Cursor.lockState = CursorLockMode.Locked;
// m_headInitialLocalPos = Head.localPosition;
// m_headInitialLocalRot = Head.localRotation;
// }
// private void Update()
// {
// m_moveAmt = m_moveAction.ReadValue<Vector2>();
// m_lookAmt = m_lookAction.ReadValue<Vector2>();
// if (m_jumpAction.WasPressedThisFrame())
// {
// Jump();
// }
// if (m_throwAction.WasPressedThisFrame())
// {
// ThrowHead();
// }
// if (m_pickupAction.WasPressedThisFrame())
// {
// TryPickupHead();
// }
// }
// private void FixedUpdate()
// {
// Walking();
// Rotating();
// }
// private void Walking()
// {
// Vector3 move =
// transform.forward * m_moveAmt.y +
// transform.right * m_moveAmt.x;
// m_rigidbody.MovePosition(
// m_rigidbody.position + move * WalkSpeed * Time.deltaTime
// );
// bool isMoving = m_moveAmt.magnitude > 0.1f;
// animator.SetBool("isWalking", isMoving);
// }
// private void Rotating()
// {
// if (m_lookAmt.magnitude <= 0.01f)
// return;
// if (!m_isHeadThrown)
// {
// NORMAL BODY ROTATION
// float horizontalRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
// Quaternion deltaRotation = Quaternion.Euler(0, horizontalRotation, 0);
// m_rigidbody.MoveRotation(m_rigidbody.rotation * deltaRotation);
// if (CameraTransform != null)
// {
// m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
// m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
// CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
// }
// }
// else
// {
// HEAD ROTATION ON GROUND
// float headRotation = m_lookAmt.x * RotateSpeed * Time.deltaTime;
// Head.Rotate(0, headRotation, 0);
// Add vertical camera rotation when head is on ground
// if (CameraTransform != null)
// {
// m_verticalRotation -= m_lookAmt.y * RotateSpeed * Time.deltaTime;
// m_verticalRotation = Mathf.Clamp(m_verticalRotation, -MaxLookAngle, MaxLookAngle);
// CameraTransform.localRotation = Quaternion.Euler(m_verticalRotation, 0, 0);
// }
// }
// }
// public void Jump()
// {
// if (Physics.CheckSphere(GroundCheck.position, GroundCheckRadius, LayerMask.GetMask("Ground")))
// {
// m_rigidbody.AddForce(Vector3.up * JumpForce, ForceMode.Impulse);
// }
// }
// private void ThrowHead()
// {
// if (m_isHeadThrown)
// return;
// animator.SetTrigger("Throw");
// m_isHeadThrown = true;
// Head.SetParent(null);
// m_headRigidbody = Head.gameObject.AddComponent<Rigidbody>();
// m_headRigidbody.mass = 1f;
// m_headRigidbody.constraints =
// RigidbodyConstraints.FreezeRotationX |
// RigidbodyConstraints.FreezeRotationZ;
// m_headRigidbody.AddForce(CameraTransform.forward * ThrowForce, ForceMode.Impulse);
// }
// private void TryPickupHead()
// {
// if (!m_isHeadThrown)
// return;
// float distance = Vector3.Distance(transform.position, Head.position);
// if (distance <= PickupDistance)
// {
// PickupHead();
// }
// }
// private void PickupHead()
// {
// m_isHeadThrown = false;
// Remove Rigidbody
// if (m_headRigidbody != null)
// {
// Destroy(m_headRigidbody);
// }
// Reattach to player
// Head.SetParent(transform);
// Reset position & rotation
// Head.localPosition = m_headInitialLocalPos;
// Head.localRotation = m_headInitialLocalRot;
// }
//}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 85fce5e45a2682243a133de9ba0a4324