public override void Attached() { PlayerController = GetComponent <Bolt_PlayerController>(); if (entity.IsOwner) { state.Health = PlayerHealth; state.LostGame = false; // player did not lose the game yet. } state.AddCallback("Health", HealthCallback); // we changed a state. When the state is changed, the server will call the callback on everyone's computer. }
public override void Attached() { if (entity.IsOwner) { state.WeaponIndex = "0"; // spawn with nothing but fists! PlayerInventory = FindObjectOfType <Inventory>(); } PlayerController = GetComponentInParent <Bolt_PlayerController>(); state.AddCallback("Weapon", SetWeapon); // spawn the weapon when state.OnAttack = null; // //state.OnChangeWeapon = ToggleWeapon; }