示例#1
0
    public override void FireWeapon()
    {
        StandardBullet _clone     = (StandardBullet)_bulletScene.Instance();
        Node           _sceneRoot = GetTree().Root.GetChild(0);

        _sceneRoot.AddChild(_clone);

        _clone.GlobalTransform = GlobalTransform;
        _clone.Scale           = new Vector3(4, 4, 4);
        _clone.BulletDamage    = damage;
        AmmoInWeapon--;
        Playernode.CreateSound(gunFireSound);
    }
示例#2
0
    public override void FireWeapon()
    {
        RayCast Ray = GetNode <RayCast>("Ray_Cast");

        Ray.ForceRaycastUpdate();
        AmmoInWeapon--;

        if (Ray.IsColliding())
        {
            var _body = Ray.GetCollider();

            if (_body != Playernode && _body.HasMethod("BulletHit"))
            {
                _callback = GD.FuncRef(_body, "BulletHit");
                _callback.CallFunc(damage, GlobalTransform);
            }
        }

        Playernode.CreateSound(gunFireSound);
    }