2
0
Fork 0
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:
in0finite 2019-07-21 18:34:12 +02:00
parent c49ff01e90
commit de0cb01239
6 changed files with 28 additions and 3 deletions

View file

@ -271,6 +271,12 @@ namespace SanAndreasUnity.Behaviours.Peds.States
}
public virtual void OnDrawHUD()
{
}
public virtual void OnSwitchedStateByServer(byte[] data)
{
m_ped.SwitchState(this.GetType());

View file

@ -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

View file

@ -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) {

View file

View file

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

View file

@ -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 ;