예제 #1
0
 public Projectile(GameWorld pGameWorld, uint pTeam, ProjectileType pType, float pXPos, float pYPos, float pRotation, ProjectileKit pProjKit, Ship pTarget = null, Ship pOwner = null)
 {
     mXPos       = pXPos;
     mYPos       = pYPos;
     mType       = pType;
     aaGameWorld = pGameWorld;
     mTeam       = pTeam;
     SetProjType();
     mRotation   = pRotation;
     mProjKit    = pProjKit;
     mTarget     = pTarget;
     mOwner      = pOwner;
     mDispObject = new DisplayObject(aaGameWorld.aaDisplay, mAssetKit.ASSET_NAME, mXPos, mYPos, (int)mAssetKit.ORIGIN.X, (int)mAssetKit.ORIGIN.Y, Constants.LAYER_PROJECTILE_DEPTH, mAssetKit.SRC_RECTX, mAssetKit.SRC_RECTY, mAssetKit.SRC_RECTWIDTH, mAssetKit.SRC_RECTHEIGHT, mRotation, false);
 }
예제 #2
0
 public Projectile(GameWorld pGameWorld, uint pTeam, ProjectileType pType, float pXPos, float pYPos, float pRotation, ProjectileKit pProjKit, Ship pTarget = null, Ship pOwner = null)
 {
     mXPos = pXPos;
     mYPos = pYPos;
     mType = pType;
     aaGameWorld = pGameWorld;
     mTeam = pTeam;
     SetProjType();
     mRotation = pRotation;
     mProjKit = pProjKit;
     mTarget = pTarget;
     mOwner = pOwner;
     mDispObject = new DisplayObject(aaGameWorld.aaDisplay, mAssetKit.ASSET_NAME, mXPos, mYPos, (int)mAssetKit.ORIGIN.X, (int)mAssetKit.ORIGIN.Y, Constants.LAYER_PROJECTILE_DEPTH, mAssetKit.SRC_RECTX, mAssetKit.SRC_RECTY, mAssetKit.SRC_RECTWIDTH, mAssetKit.SRC_RECTHEIGHT, mRotation, false);
 }
예제 #3
0
        public EntityManager(GameWorld pGameWorld)
        {
            aaGameWorld = pGameWorld;

            pEnemyBulletAssetKit = new AssetKit_Proj_Bullet_01();
            pLaserAssetKit = new AssetKit_Proj_Laser_01();
            pMineAssetKit = new AssetKit_Proj_Mine_01();
            pMissileAssetKit = new AssetKit_Proj_Missile_01();
            pPlayerBulletAssetKit = new AssetKit_Proj_PlayerBullet_01();
            pAntiBulletAssetKit = new AssetKit_Proj_AntiBullet();
            pPlayerMineAssetKit = new AssetKit_PlayerMine();

            pEnemyBulletProjectileKit = new ProjectileKit_Enemy_Bullet();
            pLaserProjectileKit = new ProjectileKit_Laser();
            pMineProjectileKit = new ProjectileKit_Mine();
            pMissileProjectileKit = new ProjectileKit_Missile();
            pPlayerBulletProjectileKit = new ProjectileKit_Player_Bullet();
            pAntiBulletProjectileKit = new ProjectileKit_Antibullet();
            mNextProjectileID = 0;
        }
예제 #4
0
        public EntityManager(GameWorld pGameWorld)
        {
            aaGameWorld = pGameWorld;

            pEnemyBulletAssetKit  = new AssetKit_Proj_Bullet_01();
            pLaserAssetKit        = new AssetKit_Proj_Laser_01();
            pMineAssetKit         = new AssetKit_Proj_Mine_01();
            pMissileAssetKit      = new AssetKit_Proj_Missile_01();
            pPlayerBulletAssetKit = new AssetKit_Proj_PlayerBullet_01();
            pAntiBulletAssetKit   = new AssetKit_Proj_AntiBullet();
            pPlayerMineAssetKit   = new AssetKit_PlayerMine();

            pEnemyBulletProjectileKit  = new ProjectileKit_Enemy_Bullet();
            pLaserProjectileKit        = new ProjectileKit_Laser();
            pMineProjectileKit         = new ProjectileKit_Mine();
            pMissileProjectileKit      = new ProjectileKit_Missile();
            pPlayerBulletProjectileKit = new ProjectileKit_Player_Bullet();
            pAntiBulletProjectileKit   = new ProjectileKit_Antibullet();
            mNextProjectileID          = 0;
        }
예제 #5
0
        public Projectile AddProjectile(uint pTeam, ProjectileType pType, Vector2 pPosition, float pRotation, ProjectileKitType pProjectileKitType, Ship pTarget = null, Ship pOwner = null)
        {
            ProjectileKit projectileKit = null;
            AssetKit      assetKit      = null;

            switch (pProjectileKitType)
            {
            case ProjectileKitType.EnemyBullet:
                projectileKit = pEnemyBulletProjectileKit;
                assetKit      = pEnemyBulletAssetKit;
                break;

            case ProjectileKitType.Laser:
                projectileKit = pLaserProjectileKit;
                assetKit      = pLaserAssetKit;
                break;

            case ProjectileKitType.Mine:
                if (pTeam == 0)
                {
                    assetKit = pPlayerMineAssetKit;
                }
                else
                {
                    assetKit = pMineAssetKit;
                }
                projectileKit = pMineProjectileKit;
                break;

            case ProjectileKitType.Missile:
                projectileKit = pMissileProjectileKit;
                assetKit      = pMissileAssetKit;
                break;

            case ProjectileKitType.PlayerBullet:
                projectileKit = pPlayerBulletProjectileKit;
                assetKit      = pPlayerBulletAssetKit;
                break;

            case ProjectileKitType.AntiBullet:
                projectileKit = pAntiBulletProjectileKit;
                assetKit      = pAntiBulletAssetKit;
                break;

            default:
                projectileKit = pEnemyBulletProjectileKit;
                assetKit      = pEnemyBulletAssetKit;
                break;
            }
            if (aaGameWorld.mRemovedProjectileList.Count != 0)
            {
                Projectile tempProj = aaGameWorld.mRemovedProjectileList.ElementAt(0);
                aaGameWorld.mRemovedProjectileList.RemoveAt(0);
                if (aaGameWorld.mProjectileList.Contains(tempProj))
                {
                    Projectile newProj = new Projectile(aaGameWorld, pTeam, pType, pPosition.X, pPosition.Y, pRotation, projectileKit, pTarget, pOwner);
                    aaGameWorld.mProjectileList.Add(newProj);
                    return(newProj);
                }
                else
                {
                    tempProj.mXPos = pPosition.X;
                    tempProj.mYPos = pPosition.Y;
                    tempProj.mType = pType;
                    tempProj.mTeam = pTeam;
                    tempProj.SetProjType();
                    tempProj.mRotation = pRotation;
                    tempProj.mProjKit  = projectileKit;
                    tempProj.mTarget   = pTarget;
                    tempProj.mOwner    = pOwner;
                    tempProj.mDispObject.mAssetFile     = assetKit.ASSET_NAME;
                    tempProj.mDispObject.src_RectX      = assetKit.SRC_RECTX;
                    tempProj.mDispObject.src_RectY      = assetKit.SRC_RECTY;
                    tempProj.mDispObject.src_RectWidth  = assetKit.SRC_RECTWIDTH;
                    tempProj.mDispObject.src_RectHeight = assetKit.SRC_RECTHEIGHT;
                    tempProj.mDispObject.SetZoom(1.0f);
                    tempProj.mDispObject.Show();
                    tempProj.mProjectileID = mNextProjectileID++;
                    //tempProj.mDispObject = new DisplayObject(aaGameWorld.aaDisplay, assetKit.ASSET_NAME, pPosition.X, pPosition.Y, (int)assetKit.ORIGIN.X, (int)assetKit.ORIGIN.Y, Constants.LAYER_PROJECTILE_DEPTH, assetKit.SRC_RECTX, assetKit.SRC_RECTY, assetKit.SRC_RECTWIDTH, assetKit.SRC_RECTHEIGHT, pRotation, false);
                    aaGameWorld.mProjectileList.Add(tempProj);
                    return(tempProj);
                }
            }
            else
            {
                Projectile newProj = new Projectile(aaGameWorld, pTeam, pType, pPosition.X, pPosition.Y, pRotation, projectileKit, pTarget, pOwner);
                newProj.mProjectileID = mNextProjectileID++;
                aaGameWorld.mProjectileList.Add(newProj);
                return(newProj);
            }
        }