示例#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;
                    }
                }
            }
        }
示例#2
0
        // PRIVATE

        private void ThrowTotem()
        {
            if (_totemOwnership.IsLocalOwner(state.OwnerID) && _totemOwnership.IsSynchronized())
            {
                TotemThrown totemThrownEvent = TotemThrown.Create();
                totemThrownEvent.KartEntity       = entity;
                totemThrownEvent.OwnerID          = state.OwnerID;
                totemThrownEvent.ForwardDirection = _throwingDirection.LastDirectionUp != Direction.Backward; // TO DO BETTER
                totemThrownEvent.Send();
            }
        }
示例#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();
                }
            }
        }