// CORE private void Update() { if (entity.isAttached && entity.isOwner) { if (!_totemPosition) { var totem = TotemHelpers.FindTotem(); if (totem) { _totemPosition = totem.transform; _totemOwnership = totem.GetComponent <TotemOwnership>(); } } else { //Arrow stick to the ground this.transform.forward = new Vector3(-(_totemPosition.transform.position.x - this.transform.position.x), 0, -(_totemPosition.transform.position.z - this.transform.position.z)); if (_totemOwnership.IsLocalOwner(state.OwnerID)) { _arrowTotem.enabled = false; } else { _arrowTotem.enabled = true; } } } }
public override void OnEvent(PlayerHit evnt) { if (!_totemOwnership) { _totemOwnership = TotemHelpers.GetTotemComponent(); } if (_totemOwnership && evnt.VictimID == _totemOwnership.LocalOwnerID) // The totem owner has been hit { OnTotemLost.Invoke(); } }
// PUBLIC public void MapInputs() { if (Enabled) { if (Input.GetButtonDown(Constants.Input.UseItem) || Input.GetButtonDown(Constants.Input.UseItemForward) || Input.GetButtonDown(Constants.Input.UseItemBackward)) { if (!_totemOwnership) { _totemOwnership = TotemHelpers.GetTotemComponent(); } if (_totemOwnership) { ThrowTotem(); } } } }