Next: , Previous: , Up: Network   [Contents][Index]


13.5 Photon Health

Component: PhotonHealth

This generic Health implementation is fully compatible with all MultiGame systems and forms the basis for combat and death in your game worlds. It receives the ’ModifyHealth’ message with a floating point value. Make anything killable!

Field of PhotonHealth: float maxHP

How much health can we have?

Default value: 100.0f

Field of PhotonHealth: bool autodestruct

Do we destroy the object when health runs out?

Default value: true

Field of PhotonHealth: GameObject[] deathPrefabs

What should we spawn when we die from HP loss?

Field of PhotonHealth: Scrollbar uIhealthBar

If using the Unity UI, create a scroll bar for the health and drop a reference to it here. The handle of the scrollbar is resized to show the health amount.

Field of PhotonHealth: bool showHealthBarGUI

Should we show a legacy Unity GUI? NOTE: Not suitable for mobile devices.

Default value: false

Optional Field of PhotonHealth: GUISkin guiSkin

What skin should we use for the Legacy GUI

Field of PhotonHealth: Rect healthBar

Normalized viewport rectangle describing the area of the health bar, values between 0 and 1

Default value: new Rect(.2f, .01f, .4f, .085f)

Field of PhotonHealth: bool autoHide

Should we hide the health bar when health is full?

Default value: true

Field of PhotonHealth: Color barColor

Should we color this bar to differentiate it from others?

Default value: Color.white

Field of PhotonHealth: MessageManager.ManagedMessage healthGoneMessage

When we run out of health, what message should we send?

Field of PhotonHealth: MessageManager.ManagedMessage hitMessage

When we are hit, what message should we send?

Message on PhotonHealth: Die ()

Kill this object immediately!

Message on PhotonHealth: ModifyHealth (float)

Change the health this object has

Argument: Amount to change the health by. Positive to increase, negative to decrease.

Message on PhotonHealth: ModifyMaxHealth (float)

Change the maximum health this object can have

Argument: Amount to change the max health by. Positive to increase, negative to decrease.

Field of PhotonHealth: float maxHP

How much health can we have?

Default value: 100.0f

Field of PhotonHealth: bool autodestruct

Do we destroy the object when health runs out?

Default value: true

Field of PhotonHealth: GameObject[] deathPrefabs

What should we spawn when we die from HP loss?

Field of PhotonHealth: Scrollbar uIhealthBar

If using the Unity UI, create a scroll bar for the health and drop a reference to it here. The handle of the scrollbar is resized to show the health amount.

Field of PhotonHealth: bool showHealthBarGUI

Should we show a legacy Unity GUI? NOTE: Not suitable for mobile devices.

Default value: false

Optional Field of PhotonHealth: GUISkin guiSkin

What skin should we use for the Legacy GUI

Field of PhotonHealth: Rect healthBar

Normalized viewport rectangle describing the area of the health bar, values between 0 and 1

Default value: new Rect(.2f, .01f, .4f, .085f)

Field of PhotonHealth: bool autoHide

Should we hide the health bar when health is full?

Default value: true

Field of PhotonHealth: Color barColor

Should we color this bar to differentiate it from others?

Default value: Color.white

Field of PhotonHealth: MessageManager.ManagedMessage healthGoneMessage

When we run out of health, what message should we send?

Field of PhotonHealth: MessageManager.ManagedMessage hitMessage

When we are hit, what message should we send?

Message on PhotonHealth: Die ()

Kill this object immediately!

Message on PhotonHealth: ModifyHealth (float)

Change the health this object has

Argument: Amount to change the health by. Positive to increase, negative to decrease.

Message on PhotonHealth: ModifyMaxHealth (float)

Change the maximum health this object can have

Argument: Amount to change the max health by. Positive to increase, negative to decrease.


Next: , Previous: , Up: Network   [Contents][Index]