Example #1
0
        public override void _Process(float delta)
        {
            var weaponSocket = _weaponSocketComponents[_currentSocket];

            weaponSocket.AimWeapon(GetGlobalMousePosition());
            if (_isAttacking)
            {
                weaponSocket.Weapon?.AttemptFire(GetGlobalMousePosition());
            }

            if (weaponSocket.Weapon != null)
            {
                _playerHands.AlignWithWeapon(weaponSocket.Weapon);
            }
            else
            {
                _playerHands.ResetTransforms();
            }
        }
Example #2
0
        public override void _Process(float delta)
        {
            if (_aiBehaviorComponent.Aggressive)
            {
                var player = GetTree().GetFirstNodeInGroup <Player>(Player.GROUP);
                if (player != null)
                {
                    _weaponSocketComponent.AimWeapon(player.GlobalPosition);
                    _weaponSocketComponent.Weapon?.AttemptFire(player.GlobalPosition);
                }
            }
            else
            {
                _weaponSocketComponent.ResetWeaponAim();
            }

            if (_hands != null && _weaponSocketComponent.Weapon != null)
            {
                _hands.AlignWithWeapon(_weaponSocketComponent.Weapon);
            }
        }