コード例 #1
0
 public override void HandleCollision(CollisionDirection cd, PhysicsAble entity)
 {
     if (entity is Bullet)
     {
         bulletRef = (Bullet)entity;
         bulletRef.attach(this);
     }
     else if (entity is Level)
     {
         velocity = Vector2.Zero;
     }
     else
     {
         base.HandleCollision(cd, entity);
     }
 }
コード例 #2
0
 public void fireBullet(Vector2 velocity)
 {
     if (bulletRef == null) return;
     bulletRef.refire(this, velocity);
     bulletRef = null;
 }
コード例 #3
0
ファイル: GameState.cs プロジェクト: icefortress/SkyCrane
        public void createBullet(int posX, int posY, Vector2 velocity)
        {
            Bullet b = new Bullet(context, new Vector2(posX, posY), velocity);
            addEntity(200, b, b.id);

            StateChange sc = StateChangeFactory.createEntityStateChange(b.id, posX, posY, Bullet.frameWidth, b.GetFrameTime(), Bullet.textureName, b.scale, 200);
            changes.Add(sc);
        }