コード例 #1
0
        /// <summary>
        /// If the player was dead last round, give them default weapons specific
        /// to their team
        /// </summary>
        public void ResetWeapons()
        {
            switch (CurrentTeam)
            {
            case ServerClientInterface.Team.CounterTerrorist:
                SecondaryWeapon = new ClientWeapon(WeaponData.Weapon.Usp, this, Assets);
                break;

            case ServerClientInterface.Team.Terrorist:
                SecondaryWeapon = new ClientWeapon(WeaponData.Weapon.Glock, this, Assets);
                break;
            }
            PrimaryWeapon = new ClientWeapon(WeaponData.Weapon.None, this, Assets);
            Knife         = new ClientWeapon(WeaponData.Weapon.Knife, this, Assets);
            CurrentWeapon = Knife;
        }
コード例 #2
0
        private float rotation;     // Rotation of the player

        /// <summary>
        /// Creates a client-side version of the player class
        /// </summary>
        /// <param name="username"></param>
        /// <param name="identifier"></param>
        /// <param name="assets"></param>
        public ClientPlayer(string username, short identifier, Assets assets)
            : base(assets)
        {
            UserName        = username;
            Identifier      = identifier;
            CurrentTeam     = ServerClientInterface.Team.Spectator;
            State           = ServerClientInterface.PlayerState.Dead;
            Health          = 100;
            Armor           = 0;
            PrimaryWeapon   = new ClientWeapon(WeaponData.Weapon.None, this, assets);
            SecondaryWeapon = new ClientWeapon(WeaponData.Weapon.None, this, assets);
            Knife           = new ClientWeapon(WeaponData.Weapon.Knife, this, assets);
            CurrentWeapon   = Knife;
            Shot            = new RayCast();
            debrisEmitter   = new ParticleEmitter(Particle.ParticleTypes.Debris);
        }
コード例 #3
0
 /// <summary>
 /// Used by the server
 /// </summary>
 /// <param name="weapon"></param>
 public void SetCurrentWeapon(WeaponData.Weapon weapon)
 {
     CurrentWeapon = new ClientWeapon(weapon, this, Assets);
 }