mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-03-05 07:37:17 +00:00
state can draw it's own hud
This commit is contained in:
parent
c49ff01e90
commit
de0cb01239
6 changed files with 28 additions and 3 deletions
Assets/Scripts
Behaviours/Ped/States
UI
Utilities
Docs
|
@ -271,6 +271,12 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
}
|
||||
|
||||
|
||||
public virtual void OnDrawHUD()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public virtual void OnSwitchedStateByServer(byte[] data)
|
||||
{
|
||||
m_ped.SwitchState(this.GetType());
|
||||
|
|
|
@ -21,6 +21,8 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
void OnFlyButtonPressed();
|
||||
void OnFlyThroughButtonPressed();
|
||||
|
||||
void OnDrawHUD();
|
||||
|
||||
/// <summary> Called when server sends a message that ped state has changed. </summary>
|
||||
void OnSwitchedStateByServer(byte[] data);
|
||||
/// <summary> Called when state is switched on server. The returned data will be available on client
|
||||
|
|
|
@ -36,11 +36,13 @@ namespace SanAndreasUnity.UI {
|
|||
if (!Loader.HasLoaded)
|
||||
return;
|
||||
|
||||
if (null == Ped.Instance)
|
||||
var ped = Ped.Instance;
|
||||
|
||||
if (null == ped)
|
||||
return;
|
||||
|
||||
// draw crosshair
|
||||
if (Ped.Instance.IsAiming) {
|
||||
if (ped.IsAiming) {
|
||||
DrawCrosshair( new Vector2(Screen.width * 0.5f, Screen.height * 0.5f), Vector2.one * this.crosshairSize, this.crosshairScaleMode );
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,10 @@ namespace SanAndreasUnity.UI {
|
|||
if (this.drawRedDotOnScreenCenter)
|
||||
GUIUtils.DrawRect (GUIUtils.GetCenteredRect (new Vector2 (2f, 2f)), Color.red);
|
||||
|
||||
// let current state draw it's own hud
|
||||
if (ped.CurrentState != null)
|
||||
ped.CurrentState.OnDrawHUD();
|
||||
|
||||
}
|
||||
|
||||
public static void DrawCrosshair (Vector2 screenPos, Vector2 size, ScaleMode scaleMode) {
|
||||
|
|
0
Assets/Scripts/Utilities/CustomInput.cs
Normal file
0
Assets/Scripts/Utilities/CustomInput.cs
Normal file
11
Assets/Scripts/Utilities/CustomInput.cs.meta
Normal file
11
Assets/Scripts/Utilities/CustomInput.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 15fdcd3faa706b9fd9a440dcd477822b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
- Chat
|
||||
|
||||
- Android: touch input is required ; set default fps to 25 ;
|
||||
- Android: touch input is required ; set default fps to 25 ; add some predefined folders in file browser ;
|
||||
|
||||
- Play sounds: horn ; empty weapon slot ; ped damage ; footsteps in run and sprint states ;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue