Ejemplo n.º 1
0
        public Missile createMissile(Missile.MissileType mMissileType, GameObject.GameObjectName gameName, int index = 0, float mX = 0.0f, float mY = 0.0f)
        {
            Missile missile = null;

            switch (mMissileType)
            {
            case Missile.MissileType.MissileRoot:
                missile = new MissileRoot(gameName, Sprite.SpriteName.NullObject, index, mX, mY, Missile.MissileType.MissileRoot);
                GameObjectNodeManager.add(missile, cPCSTree);
                break;

            case Missile.MissileType.StraightMissile:
                missile = new StraightMissile(gameName, Sprite.SpriteName.StraightMissile, index, mX, mY, Missile.MissileType.StraightMissile);
                break;

            case Missile.MissileType.Uninitilized:
                Debug.WriteLine("Missile Type is Uninitilized");
                break;
            }

            this.cPCSTree.Insert(missile, this.cParent);
            //  cSpriteBatch.addToBatch(missile.getProxySprite());
            // cSpriteBatch.addToBatch(missile.getCollisionObj().cSpriteBox);
            missile.addSpriteToBatch(this.cSpriteBatch);
            missile.addCollisionToBatch(SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes));
            return(missile);
        }
Ejemplo n.º 2
0
 private ShipManager()
 {
     this.shipReadyState         = new ShipReadyState();
     this.shipMissileFlyingState = new ShipMissileFlyingState();
     this.shipEndState           = new ShipEndState();
     this.cannonShip             = null;
     this.missile = null;
 }
Ejemplo n.º 3
0
        public override void visitMissileStraight(StraightMissile m)
        {
            Debug.WriteLine("ZigZagBomb StraightMissile");
            Debug.WriteLine("Both tress finished to roots");

            CollisionPair colpair = CollisionPairManager.getCurrentColPair();

            colpair.setSubject(this, m);
            colpair.notifyObserver();
        }
Ejemplo n.º 4
0
        public override void visitMissileStraight(StraightMissile m)
        {
            Debug.WriteLine("AlienUFO StraightMissile");
            Debug.WriteLine("Both tress finished to roots");
            CollisionPair currColPair = CollisionPairManager.getCurrentColPair();

            Debug.Assert(currColPair != null);
            currColPair.setSubject(this, m);
            currColPair.notifyObserver();
        }
Ejemplo n.º 5
0
        public override void visitMissileStraight(StraightMissile m)
        {
            Debug.WriteLine("WallTop StraightMissile");
            Debug.WriteLine("Both tress finished to roots");
            //m.hit = true;
            //  m.delta = -2.0f;

            CollisionPair colpair = CollisionPairManager.getCurrentColPair();

            colpair.setSubject(m, this);
            colpair.notifyObserver();
        }
Ejemplo n.º 6
0
        public override void shoot(CannonShip ship)
        {
            // Debug.WriteLine("ShipReadyState shoot");
            StraightMissile missile = ShipManager.activateMissile();

            Debug.Assert(missile != null);

            missile.x = ship.x;
            missile.y = ship.y;
            missile.launchMissile();

            IrrKlang.ISoundEngine sndEngine = FactoryManager.getSoundEngine();
            IrrKlang.ISound       music     = sndEngine.Play2D("shoot.wav");
            music.Volume = 0.2f;

            this.handle(ship);
        }
Ejemplo n.º 7
0
        public static StraightMissile activateMissile()
        {
            ShipManager shipMan = ShipManager.getSingleton();

            Debug.Assert(shipMan != null);

            GameObjectNode gon     = GameObjectNodeManager.findGameObjectNode(GameObject.GameObjectName.MissileRoot);
            PCSTree        pcsTree = gon.getPCSTree();
            GameObject     gameObj = gon.getGameObject();

            Debug.Assert(pcsTree != null);
            Debug.Assert(gameObj != null);

            // StraightMissile missile = new StraightMissile(GameObject.GameObjectName.StraightMissile, Sprite.SpriteName.Straight, 1, 400, 100f,Missile.MissileType.Straight);

            ///to do
            StraightMissile missile = (StraightMissile)FactoryManager.getMissileFactry().createMissile(Missile.MissileType.StraightMissile, GameObject.GameObjectName.StraightMissile, 1, 300, 200);

            //StraightMissile missile = (StraightMissile)GhostManager.find(GameObject.GameObjectName.StraightMissile);
            //if(missile==null)
            //{
            //   missile = (StraightMissile)FactoryManager.getMissileFactry().createMissile(Missile.MissileType.StraightMissile, GameObject.GameObjectName.StraightMissile, 1, 300, 200);
            //}
            //StraightMissile missile = (StraightMissile)GhostManager.find(GameObject.GameObjectName.StraightMissile);

            shipMan.missile = missile;

            //  SpriteBatch missileBatch = SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Missiles);
            //  SpriteBatch boxBatch = SpriteBatchManager.find(SpriteBatch.SpriteBatchName.Boxes);

            //  Debug.Assert(missileBatch != null);
            //  Debug.Assert(boxBatch != null);

            // missile.addSpriteToBatch(missileBatch);
            //  missile.addCollisionToBatch(boxBatch);
            GameObject pMissileRoot = GameObjectNodeManager.find(GameObject.GameObjectName.MissileRoot);

            Debug.Assert(pMissileRoot != null);
            ///////////////////////////Not sure
            // pcsTree.Insert(missile, pMissileRoot);
            // pcsTree.GetRoot.
            pMissileRoot.update();

            return(missile);
        }
Ejemplo n.º 8
0
 public override void visitMissileStraight(StraightMissile m)
 {
     ///  Debug.WriteLine("UFORoot StraightMissile");
     CollisionPair.detectCollision(m, (GameObject)this.pChild);
 }
Ejemplo n.º 9
0
 public override void visitMissileStraight(StraightMissile m)
 {
     // Missile vs ShieldColumn
     CollisionPair.detectCollision(m, (GameObject)this.pChild);
 }
 public virtual void visitMissileStraight(StraightMissile m)
 {
 }