コード例 #1
0
        public static GameObject Find(GameObjectName goName, int index = 0)
        {
            GameObjectManager goMan    = GameObjectManager.GetInstance();
            GameObjectNode    pRoot    = (GameObjectNode)goMan.pActive;
            GameObject        pGameObj = null;

            bool found = false;

            while (pRoot != null && found == false)
            {
                PCSTreeForwardIterator iter = new PCSTreeForwardIterator(pRoot.pGameObject);
                pGameObj = (GameObject)iter.First();

                while (!iter.IsDone())
                {
                    if ((pGameObj.gameObjectName == goName) && (pGameObj.index == index))
                    {
                        found = true;
                        break;
                    }
                    pGameObj = (GameObject)iter.Next();
                }
                pRoot = (GameObjectNode)pRoot.pDNext;
            }
            return(pGameObj);
        }
コード例 #2
0
 public ShieldBrick(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx)
     : base(goName, sName, ShieldType.Brick, idx)
 {
     this.x = x;
     this.y = y;
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.White).pAzulColor;
 }
コード例 #3
0
 public WallTop(GameObjectName mGameObjectName, int index, Sprite.SpriteName mSpriteName, float x, float y, float width, float height, Wall.WallType walltype) : base(mGameObjectName, index, mSpriteName, walltype)
 {
     this.setCollisionRect(x, y, width, height);
     this.x = x;
     this.y = y;
     this.cCollisionObj.cSpriteBox.setColor(Unit.redColor);
 }
コード例 #4
0
        public static void UpdateScore(GameObject go)
        {
            ScoreManager   scoreMan   = ScoreManager.GetInstance();
            CurrentPlayer  player     = GetCurrentPlayer();
            GameObjectName goName     = go.gameObjectName;
            int            scoreValue = 0;

            switch (goName)
            {
            case GameObjectName.Crab:
                scoreValue = 20;
                break;

            case GameObjectName.Squid:
                scoreValue = 30;
                break;

            case GameObjectName.Octopus:
                scoreValue = 10;
                break;

            case GameObjectName.UFO:
                scoreValue = GenerateUFOScore();
                break;

            default:
                Debug.Assert(false);
                break;
            }
            UpdateCurrentPlayerScore(scoreValue);
        }
コード例 #5
0
ファイル: MissileRoot.cs プロジェクト: ccaunca/Projects
        public MissileRoot(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx)
            : base(goName, sName, MissileType.MissileRoot, idx)
        {
            this.x = x;
            this.y = y;

            this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor;
        }
コード例 #6
0
ファイル: WallRight.cs プロジェクト: ccaunca/Projects
 public WallRight(GameObjectName goName, SpriteBaseName sName, float x, float y, float w, float h, int idx)
     : base(goName, sName, WallType.Right, idx)
 {
     this.pCollisionObject.pCollisionRect.Set(x, y, w, h);
     this.x = x;
     this.y = y;
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Yellow).pAzulColor;
 }
コード例 #7
0
 public void wash()
 {
     this.cGameObjectName = GameObject.GameObjectName.Uninitialized;
     this.x = 0.0f;
     this.y = 0.0f;
     //dunno what to do
     this.index = 0;
 }
コード例 #8
0
 public Column(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx, Random pRandom)
     : base(goName, sName, AlienType.Column, idx)
 {
     this.x = x;
     this.y = y;
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Green).pAzulColor;
     this.alienCount = 0;
 }
コード例 #9
0
ファイル: Missile.cs プロジェクト: ccaunca/Projects
 public Missile(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx)
     : base(goName, sName, MissileType.Missile, idx)
 {
     this.x       = x;
     this.y       = y;
     this.enabled = false;
     this.speed   = 10.0f;
 }
コード例 #10
0
ファイル: UFO.cs プロジェクト: ccaunca/Projects
 public UFO(GameObjectName goName, SpriteBaseName sName, UFOStrategy strat, float x, float y)
     : base(goName, sName, UFOType.UFO, 0)
 {
     this.x         = x;
     this.y         = y;
     this.speed     = 4.0f;
     this.pStrategy = strat;
     this.pProxySprite.pSprite.pColor = ColorFactory.Create(ColorName.Red).pAzulColor;
 }
コード例 #11
0
ファイル: Splat.cs プロジェクト: ccaunca/Projects
 public Splat(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx)
     : base(goName, sName, AlienType.Splat, idx)
 {
     this.x = x;
     this.y = y;
     this.pProxySprite.x = x;
     this.pProxySprite.y = y;
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Black).pAzulColor;
 }
コード例 #12
0
ファイル: Explosion.cs プロジェクト: ccaunca/Projects
 public Explosion(GameObjectName goName, SpriteBaseName sName, AlienType alienType, GameObject go, ColorName color, int idx)
     : base(goName, sName, alienType, idx)
 {
     this.x = go.x;
     this.y = go.y;
     this.pProxySprite.x = x;
     this.pProxySprite.y = y;
     this.pProxySprite.pSprite.SetColor(ColorFactory.Create(color).pAzulColor);
 }
コード例 #13
0
 public Ship(GameObjectName goName, SpriteBaseName sName, float x, float y)
     : base(goName, sName, ShipType.Ship, 0)
 {
     this.x     = x;
     this.y     = y;
     this.state = null;
     this.speed = 5.0f;
     this.pProxySprite.pSprite.pColor = ColorFactory.Create(ColorName.Green).pAzulColor;
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Blue).pAzulColor;
 }
コード例 #14
0
ファイル: Bomb.cs プロジェクト: ccaunca/Projects
 public Bomb(GameObjectName goName, SpriteBaseName sName, FallStrategy strat, float x, float y, int idx)
     : base(goName, sName, BombType.Bomb, idx)
 {
     this.x     = x;
     this.y     = y;
     this.speed = 5.0f;
     Debug.Assert(strat != null);
     this.fallStrategy = strat;
     this.fallStrategy.Reset(this.y);
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Orange).pAzulColor;
 }
コード例 #15
0
        public BombRoot(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx)
            : base(goName, sName, BombType.BombRoot, idx)
        {
            this.x = x;
            this.y = y;
            SpriteBatch     sb     = new SpriteBatch();
            SpriteBatchNode sbNode = new SpriteBatchNode();

            sbNode.Set(SpriteManager.Find(SpriteBaseName.Null), sb);
            this.pProxySprite.SetSpriteBatchNode(sbNode);
            this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.White).pAzulColor;
        }
コード例 #16
0
 protected GameObject(GameObjectName goName, SpriteBaseName spriteName, int idx)
 {
     this.gameObjectName = goName;
     this.index          = idx;
     this.markedForDeath = false;
     this.x            = 0.0f;
     this.y            = 0.0f;
     this.pProxySprite = ProxySpriteManager.Add(spriteName);
     Debug.Assert(this.pProxySprite != null);
     this.pCollisionObject = new CollisionObject(this.pProxySprite);
     Debug.Assert(this.pCollisionObject != null);
 }
コード例 #17
0
        protected GameObject(GameObjectName mGameObjectName, int index, Sprite.SpriteName mSpriteName)
        {
            this.cGameObjectName = mGameObjectName;
            this.x            = 0.0f;
            this.y            = 0.0f;
            this.index        = index;
            this.cProxySprite = ProxySpriteManager.add(mSpriteName);
            Debug.Assert(cProxySprite != null);

            this.cCollisionObj = new CollisionObject(cProxySprite);
            Debug.Assert(cCollisionObj != null);
            this.death = false;
        }
コード例 #18
0
 public Grid(GameObjectName goName, SpriteBaseName sbName, float x, float y, int goIdx)
     : base(goName, sbName, AlienType.Grid, goIdx)
 {
     this.x = x;
     this.y = y;
     this.movementXDirection = 20.0f;
     this.movementYDirection = 0.0f;
     this.movementXDistance  = 20.0f;
     this.movementYDistance  = 5.0f;
     this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Yellow).pAzulColor;
     this.alienCount      = 0;
     this.colCount        = 0;
     this.marchSpeed      = 0.75f;
     this.bombFrequency   = 1.0f;
     this.decayFactor     = 0.0125f;
     this.bombDecayFactor = 0.01f;
     this.pRandom         = new Random();
 }
コード例 #19
0
ファイル: ShipFactory.cs プロジェクト: ccaunca/Projects
        public Alien Create(GameObjectName goName, float x, float y)
        {
            Alien pAlien = null;

            switch (goName)
            {
            case GameObjectName.Ship:
                pAlien = new Ship(goName, SpriteBaseName.Ship, x, y);
                break;

            case GameObjectName.Missile:
                pAlien = new Missile(x, y);
                break;
            }
            Debug.Assert(pAlien != null);
            //this.pTree.dumpTree();
            this.pTree.Insert(pAlien, this.pParent);
            //this.pTree.dumpTree();
            pAlien.ActivateGameSprite(this.pSpriteBatch);
            this.pSpriteBoxBatch.Attach(pAlien.pCollisionObject.pCollisionSpriteBox);
            return(pAlien);
        }
コード例 #20
0
ファイル: AlienFactory.cs プロジェクト: ccaunca/Projects
        public Alien Create(AlienType alienType, GameObjectName goName, int goIdx = 0, float x = 0.0f, float y = 0.0f)
        {
            Alien pAlien = null;

            switch (alienType)
            {
            case AlienType.Crab:
                pAlien = new Crab(goName, SpriteBaseName.Crab, x, y, goIdx);
                break;

            case AlienType.Squid:
                pAlien = new Squid(goName, SpriteBaseName.Squid, x, y, goIdx);
                break;

            case AlienType.Octopus:
                pAlien = new Octopus(goName, SpriteBaseName.Octopus, x, y, goIdx);
                break;

            case AlienType.Grid:
                pAlien = new Grid(goName, SpriteBaseName.Null, x, y, goIdx);
                GameObjectManager.AttachTree(pAlien);
                break;

            case AlienType.Column:
                pAlien = new Column(goName, SpriteBaseName.Null, x, y, goIdx, this.pRandom);
                break;

            default:
                Debug.Assert(pAlien != null);
                break;
            }
            this.pTree.Insert(pAlien, this.pParent);
            pAlien.ActivateGameSprite(this.pSpriteBatch);
            pAlien.ActivateCollisionSprite(this.pSpriteBatch);
            return(pAlien);
        }
コード例 #21
0
ファイル: ShieldGrid.cs プロジェクト: ccaunca/Projects
 public ShieldGrid(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx)
     : base(goName, sName, ShieldType.Grid, idx)
 {
     this.x = x;
     this.y = y;
 }
コード例 #22
0
ファイル: Wall.cs プロジェクト: snehalw22/Space-Invaders-Game
 public Wall(GameObjectName mGameObjectName, int index, Sprite.SpriteName mSpriteName, Wall.WallType walltype) : base(mGameObjectName, index, mSpriteName)
 {
     type = walltype;
 }
コード例 #23
0
 public RemoveExplosionObserver(GameObject go)
 {
     this.pGameObject = go;
     this.goName      = go.gameObjectName;
 }
コード例 #24
0
ファイル: Alien.cs プロジェクト: ccaunca/Projects
 public Alien(GameObjectName goName, SpriteBaseName spriteName, AlienType alienType, float x, float y)
     : base(goName, GameObjectType.Alien, spriteName, x, y)
 {
     this.alienType = alienType;
 }
コード例 #25
0
ファイル: Alien.cs プロジェクト: ccaunca/Projects
 public Alien(GameObjectName goName, SpriteBaseName spriteName, AlienType alienType, int idx)
     : base(goName, spriteName, idx)
 {
     this.alienType = alienType;
 }
コード例 #26
0
 protected ShieldCategory(GameObjectName goName, SpriteBaseName sName, ShieldType type, int idx)
     : base(goName, sName, idx)
 {
     this.type = type;
 }
コード例 #27
0
 public Octopus(GameObjectName goName, SpriteBaseName spriteName, float x, float y, int idx)
     : base(goName, spriteName, AlienType.Octopus, idx)
 {
     this.x = x;
     this.y = y;
 }
コード例 #28
0
 public WallRoot(GameObjectName mGameObjectName, int index, Sprite.SpriteName mSpriteName, Wall.WallType walltype) : base(mGameObjectName, index, mSpriteName, walltype)
 {
     // this.cCollisionObj.cSpriteBox.setColor(Unit.spriteBoxColor);
 }
コード例 #29
0
 protected Wall(GameObjectName goName, SpriteBaseName spriteName, WallType wallType, int idx)
     : base(goName, spriteName, idx)
 {
     this.type = wallType;
 }
コード例 #30
0
 public GameObjectNode(GameObjectName goName, int index)
 {
     this.pGameObject = new NullGameObject();
     this.pGameObject.gameObjectName = goName;
     this.pGameObject.index          = index;
 }