Ejemplo n.º 1
0
 private void HandleHandCountChange(HandCountChangedEvent message)
 {
     if (message.Sender == Owner)
     {
         UpdateHandCount();
     }
 }
        /// <summary>
        ///     Check the current amount of hands the owner has, and if there's less hands than active cuffs we remove some cuffs.
        /// </summary>
        private void OnHandCountChanged(HandCountChangedEvent message)
        {
            var owner = message.Sender;

            if (!EntityManager.TryGetComponent(owner, out CuffableComponent? cuffable) ||
                !cuffable.Initialized)
            {
                return;
            }

            var dirty     = false;
            var handCount = EntityManager.GetComponentOrNull <HandsComponent>(owner)?.Count ?? 0;

            while (cuffable.CuffedHandCount > handCount && cuffable.CuffedHandCount > 0)
            {
                dirty = true;

                var container = cuffable.Container;
                var entity    = container.ContainedEntities[^ 1];