Ejemplo n.º 1
0
        public override void HandleMessage(ComponentMessage message, IComponent component)
        {
            base.HandleMessage(message, component);

            switch (message)
            {
            case PlayerAttachedMsg _:
                if (_gui == null)
                {
                    _gui = new GhostGui(this);
                }
                else
                {
                    _gui.Orphan();
                }

                _gameHud.HandsContainer.AddChild(_gui);
                SetGhostVisibility(true);
                _isAttached = true;

                break;

            case PlayerDetachedMsg _:
                _gui.Parent?.RemoveChild(_gui);
                SetGhostVisibility(false);
                _isAttached = false;
                break;
            }
        }