コード例 #1
0
        public Particle(double life, Point2D pos, Point2D vel, double radius, Color color, float weight)
            : base("particle")
        {
            _physics          = new PhysicsComponent(this);
            _physics.Velocity = vel;
            _physics.Position = pos;

            _maxLife = life;
            _life    = life;
            _radius  = radius;

            _color = color;

            if (weight == 0f)
            {
                _physics.GravityEnabled = false;
                _physics.Weight         = 0f;
            }
            else
            {
                _physics.GravityEnabled = true;
                _physics.Weight         = weight;
            }
        }
コード例 #2
0
        public Character(string name, int health, int armour, Player parent)
            : base(name)
        {
            _parent     = parent;
            _weaponList = new List <Weapon>(_weaponCapacity);
            _inventory  = new List <Weapon>(_inventoryCapacity);

            for (int i = 0; i < _weaponCapacity; i++)
            {
                _weaponList.Add(null);
            }

            for (int i = 0; i < _inventoryCapacity; i++)
            {
                _inventory.Add(null);
            }

            _physics  = new PhysicsComponent(this);
            _selected = false;


            _targetBox = new Rectangle()
            {
                Width  = 100,
                Height = 15,
                Y      = -50
            };
            _targetBox.X = -_targetBox.Width / 2;


            _rearGlassBox = new Rectangle();
            _armourBox    = new Rectangle();
            _healthBox    = new Rectangle();

            _nameBox       = new Rectangle();
            _nameBoxTarget = new Rectangle()
            {
                Width  = 70,
                Height = 15,
                Y      = -70
            };

            _wepBox       = new Rectangle();
            _wepBoxTarget = new Rectangle()
            {
                Width  = 70,
                Height = 15,
                Y      = +20
            };
            _nameBoxTarget.X = -_nameBoxTarget.Width / 2;

            _glassColor       = SwinGame.RGBAColor(0, 0, 0, 0);
            _glassColorTarget = SwinGame.RGBAColor(250, 250, 255, 160);

            _healthColor       = SwinGame.RGBAColor(0, 0, 0, 0);
            _healthColorTarget = SwinGame.RGBAColor(87, 128, 109, 200);

            _armourColor       = SwinGame.RGBAColor(0, 0, 0, 0);
            _armourColorTarget = SwinGame.RGBAColor(124, 123, 127, 240);

            _textColor       = SwinGame.RGBAColor(0, 0, 0, 0);
            _textColorTarget = SwinGame.RGBAColor(20, 20, 50, 140);

            _fuel = _maxFuel;

            _maxArmour = armour;
            _maxHealth = health;

            Artillery3R.Services.EntityManager.AddEntity(this);

            _state = new StateComponent <CharacterState>(CharacterState.Idle);


            _selectedWeapon           = null;
            _physics.WindFrictionMult = 0.01f;

            _switchWeaponTimer = new Timer(20);


            _smokeCount = 0;
        }