Exemple #1
0
    private void UseHandGrenade(IMPULSE imp, PlayerCmd pCmd)
    {
        if (PrimingGren != null)
        {
            ThrowGren(pCmd.attackDir);
        }
        else
        {
            int grenCount = 0;
            switch (imp)
            {
            case IMPULSE.GRENONE:
                grenCount = _gren1Count;
                break;

            case IMPULSE.GRENTWO:
                grenCount = _gren2Count;
                break;
            }

            if (grenCount > 0)
            {
                // play timer
                if (this.ID == _game.Network.ID && _grenTimer != null)
                {
                    _grenTimer.Play();
                }

                WEAPONTYPE grenType = WEAPONTYPE.NONE;

                switch (imp)
                {
                case IMPULSE.GRENONE:
                    _gren1Count -= 1;
                    grenType     = _gren1Type;
                    break;

                case IMPULSE.GRENTWO:
                    _gren2Count -= 1;
                    grenType     = _gren2Type;
                    break;
                }

                Projectile proj = _game.World.ProjectileManager.AddProjectile(this, pCmd.attackDir, pCmd.projName, grenType);
                // FIXME - need projnames to be an array, shooting + gren on same frame
                pCmd.projName = proj.Name;
            }
            else
            {
                PrintGrenCount(imp);
            }
        }
    }
Exemple #2
0
    private void PrintGrenCount(IMPULSE imp)
    {
        int        grenCount = 0;
        WEAPONTYPE grenType  = WEAPONTYPE.NONE;

        switch (imp)
        {
        case IMPULSE.GRENONE:
            grenCount = _gren1Count;
            grenType  = _gren1Type;
            break;

        case IMPULSE.GRENTWO:
            grenCount = _gren2Count;
            grenType  = _gren2Type;
            break;
        }
        Console.Print("You have " + grenCount + " " + grenType + "s left.");
    }
Exemple #3
0
    private void ProcessImpulses(PlayerCmd pCmd)
    {
        foreach (float i in pCmd.impulses)
        {
            IMPULSE imp = (IMPULSE)i;
            switch (imp)
            {
            case IMPULSE.WEAPONONE:
                if (_weapon1 != null)
                {
                    ActiveWeapon = Weapon1;
                }
                break;

            case IMPULSE.WEAPONTWO:
                if (Weapon2 != null)
                {
                    ActiveWeapon = Weapon2;
                }
                break;

            case IMPULSE.WEAPONTHREE:
                if (Weapon3 != null)
                {
                    ActiveWeapon = Weapon3;
                }
                break;

            case IMPULSE.WEAPONFOUR:
                if (Weapon4 != null)
                {
                    ActiveWeapon = Weapon4;
                }
                break;

            case IMPULSE.GRENONE:
            case IMPULSE.GRENTWO:
                UseHandGrenade(imp, pCmd);
                break;

            case IMPULSE.DETPIPE:
                Demoman.Detpipe(this);
                break;

            case IMPULSE.SPECIAL:
                UseSpecialSkill();
                break;

            case IMPULSE.DETPACK5:
                Demoman.Detpack(this, 5, true);
                break;

            case IMPULSE.DETPACK20:
                Demoman.Detpack(this, 20, true);
                break;

            case IMPULSE.DETPACK50:
                Demoman.Detpack(this, 50, true);
                break;

            case IMPULSE.DETPACK255:
                Demoman.Detpack(this, 255, true);
                break;

            case IMPULSE.DETPACKUNSET:
                Demoman.Detpack(this, 0, false);
                break;
            }
        }
    }