Ejemplo n.º 1
0
        private void FireDeathRayShot(EquippableTickInfo info)
        {
            PointProjectile prj = Main.i.factory.SpawnProjectile(string.Empty);

            if (prj == null)
            {
                Console.WriteLine($"Got no prj instance"); return;
            }

            Transform t = _launchNode.GlobalTransform;

            prj.Launch(t.origin, -t.basis.z, _riflePrjDef, info.src.ignoreBody, info.src.team);
        }
Ejemplo n.º 2
0
 public void Tick(float delta, EquippableTickInfo info)
 {
     if (_tick <= 0)
     {
         if (info.primaryOn && _volume != null)
         {
             _tick = _refireTime;
             _volume.SetDamage(_damage);
             _volume.Fire(info.src);
         }
     }
     else
     {
         _tick -= delta;
     }
 }
Ejemplo n.º 3
0
        public void Tick(float delta, EquippableTickInfo info)
        {
            if (info.secondaryWasOn)
            {
                _mode++;
                if (_mode >= Mode.Last)
                {
                    _mode = Mode.Deathray;
                }
                UpdateDisplayName();
            }
            switch (_mode)
            {
            case Mode.Deathray:
                if (info.primaryOn)
                {
                    FireDeathRayShot(info);
                }
                break;

            case Mode.Spawn:
                if (info.primaryWasOn)
                {
                    if (_aimLaserNode == null)
                    {
                        Console.WriteLine($"Godhand has no aim laser for spawning");
                        break;
                    }
                    Vector3 pos = _aimLaserNode.GlobalTransform.origin;
                    SpawnMob(pos);
                }
                break;

            case Mode.CycleSpawn:
                if (info.primaryWasOn)
                {
                    _mobTypeIndex++;
                    if (_mobTypeIndex >= _mobTypes.Length)
                    {
                        _mobTypeIndex = 0;
                    }
                    UpdateDisplayName();
                }
                break;

            case Mode.DebugTag:
                //_aimActorId
                Transform t      = _launchNode.GlobalTransform;
                Vector3   origin = t.origin;
                Vector3   dest   = origin + (-t.basis.z * 1000);
                Godot.Collections.Dictionary hitDict = ZqfGodotUtils
                                                       .CastRay(_launchNode, origin, dest, uint.MaxValue, info.src.ignoreBody);
                if (hitDict.Keys.Count == 0)
                {
                    _aimActorId = Game.NullActorId;
                    UpdateDisplayName();
                    break;
                }
                IActor actor = Game.ExtractActor(hitDict["collider"]);
                if (actor == null)
                {
                    _aimActorId = Game.NullActorId;
                    UpdateDisplayName();
                    break;
                }
                int newId = actor.actorId;
                // refresh actor Id if required
                if (_aimActorId != newId)
                {
                    _aimActorId = newId;
                    UpdateDisplayName();
                }
                if (info.primaryWasOn)
                {
                    Main.i.game.SetDebugActorId(_aimActorId);
                }
                break;
            }
        }
Ejemplo n.º 4
0
    public override void _PhysicsProcess(float delta)
    {
        if (Main.i.gameInputActive)
        {
            _input.ReadGodotInputs();
        }
        else
        {
            _input.Clear();
        }

        _fpsCtrl.ProcessMovement(_input, delta);
        //Main.i.SetDebugText(_fpsCtrl.debugStr);

        if (_input.isBitOn(FPSInput.BitNextSlot))
        {
            _inventory.SelectNextWeapon();
        }
        if (_input.isBitOn(FPSInput.BitPrevSlot))
        {
            _inventory.SelectPrevWeapon();
        }

        if (_input.isBitOn(FPSInput.BitSlot1))
        {
            _inventory.SelectWeaponByIndex(0);
        }
        if (_input.isBitOn(FPSInput.BitSlot2))
        {
            _inventory.SelectWeaponByIndex(1);
        }
        if (_input.isBitOn(FPSInput.BitSlot3))
        {
            _inventory.SelectWeaponByIndex(2);
        }
        if (_input.isBitOn(FPSInput.BitSlot4))
        {
            _inventory.SelectWeaponByIndex(3);
        }
        if (_input.isBitOn(FPSInput.BitSlot5))
        {
            _inventory.SelectWeaponByIndex(4);
        }
        if (_input.isBitOn(FPSInput.BitSlot6))
        {
            _inventory.SelectWeaponByIndex(5);
        }
        if (_input.isBitOn(FPSInput.BitSlot7))
        {
            _inventory.SelectWeaponByIndex(6);
        }
        if (_input.isBitOn(FPSInput.BitSlot8))
        {
            _inventory.SelectWeaponByIndex(7);
        }

        AttackSource src = new AttackSource();

        src.team       = GetTeam();
        src.ignoreBody = _body;
        src.actorId    = _entId;

        bool secondaryOnToggled = _input.hasBitToggledOn(FPSInput.BitAttack2);

        EquippableTickInfo info = new EquippableTickInfo(
            _input.isBitOn(FPSInput.BitAttack1),
            _input.hasBitToggledOn(FPSInput.BitAttack1),
            _input.isBitOn(FPSInput.BitAttack2),
            _input.hasBitToggledOn(FPSInput.BitAttack2),
            src);

        _inventory.Tick(delta, info);

        _inventory.FillHudStatus(_hudState);
        _hudState.health = _health;
        if (_viewModel != null)
        {
            _viewModel.SetViewModelState(_hudState.view);
        }
        Main.i.ui.SetHudState(_hudState);
    }