示例#1
0
        public void Initialize(Vector2 pos, float mass, Vector2 velocity,
                               int boundingBoxWidth, int boundingBoxHeight,
                               AnimatedSpriteSheet animSS, AnimationTexture animTex,
                               TimeSpan timeToLive, float scaler, Character owner)
        {
            this.position = pos;
            this.mass     = mass;
            this.velocity = velocity;
            if (animSS != null)
            {
                Vector2 temp = animSS.getBoundingBox();
                this.boundingBox.X      = (int)pos.X;
                this.boundingBox.Y      = (int)pos.Y;
                this.boundingBox.Width  = (int)(temp.X * scaler);
                this.boundingBox.Height = (int)(temp.Y * scaler);
                this.aSS = animSS;
            }
            else if (animTex != null)
            {
                Vector2 temp = animTex.getBoundingBox();
                this.boundingBox.X      = (int)pos.X;
                this.boundingBox.Y      = (int)pos.Y;
                this.boundingBox.Width  = (int)(temp.X * scaler);
                this.boundingBox.Height = (int)(temp.Y * scaler);
                this.aT = animTex;
            }

            this.isActive        = true;
            this.ttl             = timeToLive;
            this.scaler          = scaler;
            this.owner           = owner;
            this.currentRotation = MathHelper.ToRadians(random.Next(75));
            this.rotVal         += MathHelper.ToRadians(random.Next(7) + 1);
        }
示例#2
0
 public Vector2 getBoundingBox()
 {
     if (aSS != null)
     {
         return(aSS.getBoundingBox());
     }
     else if (aT != null)
     {
         return(aT.getBoundingBox());
     }
     return(Vector2.Zero);
 }