Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 49 additions & 1 deletion Assets/Gameplay/Player Scrips/PlayerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using UnityEngine.InputSystem;

public class PlayerUI : MonoBehaviour
{
Expand Down Expand Up @@ -68,6 +69,8 @@ public class PlayerUI : MonoBehaviour

public Text killName;

private Button btn;

// Init
void Start()
{
Expand All @@ -79,6 +82,51 @@ void Start()
if (SceneManager.GetActiveScene().name == "MainMenu") return;
pauseScreen = GameObject.Find("/MenuSystem/Pause UI").transform.GetChild(0).gameObject;
statsCanvas = GameObject.Find("/Network Client/Lobby Stats UI");
// Minimalistic button creation
Canvas canvas = FindObjectOfType<Canvas>();
if (!canvas)
{
GameObject canvasObj = new GameObject("Canvas");
canvas = canvasObj.AddComponent<Canvas>();
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
canvasObj.AddComponent<CanvasScaler>();
canvasObj.AddComponent<GraphicRaycaster>();
}

// Create minimal button
GameObject btnObj = new GameObject("MinimalButton");
btnObj.transform.SetParent(canvas.transform, false);
btn = btnObj.AddComponent<Button>();
var img = btnObj.AddComponent<Image>();
img.color = Color.gray;

var rect = btnObj.GetComponent<RectTransform>();
rect.sizeDelta = new Vector2(100, 30);
rect.anchoredPosition = Vector2.zero; // Center

btn.onClick.AddListener(OnButtonPressed);
}

void Update()
{
// Map 'w' key using the new Input System
if (Keyboard.current != null && Keyboard.current.wKey.wasPressedThisFrame)
{
btn.onClick.Invoke();
}
}

private void OnButtonPressed()
{
Debug.Log("Minimal button clicked (or W pressed)");
if (playerMotor != null)
{
// Simulate pressing W (forward)
float x = 1f; // Vertical axis (forward)
float z = 0f; // Horizontal axis (no strafe)
//while (x > 0)
playerMotor.Move(x, z);
}
}

public void ToggleStats(bool show)
Expand All @@ -92,7 +140,7 @@ public void ToggleStats(bool show)
if (!scopeIn)
{
playerCanvas.SetActive(false);
}
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Splash
m_Shader: {fileID: 210, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON _FADING_ON _NORMALMAP _REQUIRE_UV2
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHABLEND_ON
- _FADING_ON
- _NORMALMAP
- _REQUIRE_UV2
m_InvalidKeywords: []
m_LightmapFlags: 0
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- ALWAYS
- GRABPASS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -56,6 +65,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlendOp: 0
- _BumpScale: 1
Expand Down Expand Up @@ -95,3 +105,5 @@ Material:
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0.14150941, g: 0.14150941, b: 0.14150941, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 10, b: 0, a: 0}
m_BuildTextureStacks: []
m_AllowLocking: 1
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BulletDecalWood
m_Shader: {fileID: 210, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON _NORMALMAP _PARALLAXMAP
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHABLEND_ON
- _NORMALMAP
m_InvalidKeywords:
- _PARALLAXMAP
m_LightmapFlags: 0
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- ALWAYS
- GRABPASS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -60,6 +68,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlendOp: 0
- _BumpScale: 0.75
Expand Down Expand Up @@ -98,3 +107,5 @@ Material:
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: WoodSplintersParticle
m_Shader: {fileID: 210, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHATEST_ON _NORMALMAP
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _ALPHATEST_ON
- _NORMALMAP
m_InvalidKeywords: []
m_LightmapFlags: 0
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2450
stringTagMap:
RenderType: TransparentCutout
disabledShaderPasses:
- ALWAYS
- GRABPASS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -60,6 +67,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BlendOp: 0
- _BumpScale: 1
Expand Down Expand Up @@ -98,3 +106,5 @@ Material:
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
Binary file modified Assets/Maps/Apex_Twin/Apex_Twin.unity
Binary file not shown.
Loading