StrixBehaviourRpc Method (String, Object) |
Namespace: SoftGear.Strix.Unity.Runtime
public void Rpc( string rpcName, params Object[] args )
using SoftGear.Strix.Unity.Runtime; using UnityEngine; using UnityEngine.UI; public class StrixRpcExample : StrixBehaviour { [StrixSyncField] public int Health = 100; public Image HealthBar; private void OnMouseDown() { Rpc("Hit", Random.Range(3, 8)); } [StrixRpc(ProcedureCode = 1)] public void Hit(int damage) { Health = Mathf.Max(0, Health - damage); } public void Update() { HealthBar.fillAmount = Health / 100f; } }