Exemplo n.º 1
0
        // 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();
     }
 }
Exemplo n.º 3
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.CompareTag(Constants.Tag.ItemBox))
            {
                if (!_totemOwnership)
                {
                    _totemOwnership = FindObjectOfType <TotemOwnership>();
                }

                if (entity.isAttached && !state.CanPickTotem && !_totemOwnership.IsLocalOwner(state.OwnerID))
                {
                    Debug.Log("Recharching kart.");
                    _energyDischarger.FullyCharge();
                    other.GetComponent <Items.Lottery.ItemBox>().Activate();
                }
            }
        }
Exemplo n.º 4
0
        // 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();
                    }
                }
            }
        }