Beispiel #1
0
        public cPickupAble(cGameScene scene, cSpatialGrid grid, Vector2f pos, Vector2f emit_direction) : base(scene, pos)
        {
            this.grid     = grid;
            this.pickedUp = pulling = false;
            this.heading  = emit_direction;

            this.bounds = new cAABB();
            this.bounds.SetDims(new Vector2f(16.0f, 22.0f));
            this.bounds.SetPosByCenter(pos);
            this.HitCollisionRect = bounds;

            this.MaxSpeed = EMIT_SPEED * 2;
            this.mass     = 100.0f;

            this.velocity.X = this.heading.X * EMIT_SPEED;
            this.velocity.Y = this.heading.Y * EMIT_SPEED;
            orientation     = cAppMath.GetAngleOfVector(heading);

            this.sprite = new Sprite(cAssetManager.GetTexture("pickups"));

            pickup = PickupEffects.getWeighted(); //.get(PickupType.HEALTH);

            this.sprite.TextureRect = pickup.TextureRect;
            //this.sprite.Scale = new Vector2f(0.5f, 0.5f);
            //this.sprite.Rotation = (float)cAppMath.RadianToDegress(this.orientation);

            this.sprite.Origin = new Vector2f(12.0f, 12.0f);
        }
 /// <summary>
 /// If pickup type is unknown (not specified), generate one by weights
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="grid"></param>
 /// <param name="pos"></param>
 /// <param name="emit_direction"></param>
 public cPickupAble(GameScene scene, Vector2f pos, Vector2f emit_direction, PickupType type = PickupType.UNKNOWN) : base(scene, pos)
 {
     pickup = type == PickupType.UNKNOWN ? PickupEffects.getWeighted() : PickupEffects.get(type);
     this.init(pos, emit_direction);
 }