Ejemplo n.º 1
0
        protected override void DerivedWash(DLink pDLink)
        {
            Debug.Assert(pDLink != null);
            ProxySprite pNode = (ProxySprite)pDLink;

            pNode.Wash();
        }
Ejemplo n.º 2
0
        public ColObject(ProxySprite pProxySprite)
        {
            Debug.Assert(pProxySprite != null);

            // Create Collision Rect
            // Use the reference sprite to set size and shape
            // need to refactor if you want it different
            GameSprite pSprite = pProxySprite.pSprite;

            Debug.Assert(pSprite != null);

            // Origin is in the UPPER RIGHT
            this.poColRect = new ColRect(pSprite.GetScreenRect());
            Debug.Assert(this.poColRect != null);

            // Create the box sprite

            //WORKING
            //this.pColSprite = BoxSpriteManager.Add(GameSprite.Name.Box, this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);

            //TEST
            this.pColSprite = BoxSpriteManager.Add(pProxySprite.pSprite.GetName(), this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);


            ////get the box name from the matching sprite name;
            //BoxSprite.Name colBoxName = (BoxSprite.Name) pProxySprite.pSprite.GetName();
            //Debug.Assert(colBoxName != null);
            //this.pColSprite = BoxSpriteManager.Find(colBoxName);
            //this.pColSprite.SetScreenRect(this.poColRect.x, this.poColRect.y, this.poColRect.width, this.poColRect.height);
            //Debug.Assert(this.pColSprite != null);

            this.pColSprite.SetLineColor(1.0f, 1.0f, 0.0f);
        }
Ejemplo n.º 3
0
        public static void Remove(ProxySprite pProxy)
        {
            Debug.Assert(pMan != null);
            Debug.Assert(pProxy != null);

            pMan.baseRemove(pProxy);
        }
Ejemplo n.º 4
0
        public ProxySpriteMan(int reserveNum = 3, int growth = 1)
            : base()
        {
            this.BaseIntialize(reserveNum, growth);

            this.poNodeCompare = new ProxySprite();
        }
Ejemplo n.º 5
0
        public void DumpProxy()
        {
            Debug.WriteLine("Name: {0} ({1})", this.name, this.GetHashCode());
            Debug.WriteLine("PosX: {0}, PosY: {1}", this.x, this.y);
            Debug.WriteLine("Image: {0}, ({1})", this.pSprite.GetImage().GetName(), this.pSprite.GetImage().GetHashCode());

            if (this.pPrev == null)
            {
                Debug.WriteLine("previous: null");
            }
            else
            {
                ProxySprite pTemp = (ProxySprite)this.pPrev;
                Debug.WriteLine("previous: {0}, {1}", pTemp.name, pTemp.GetHashCode());
            }

            if (this.pNext == null)
            {
                Debug.WriteLine("next: null");
            }
            else
            {
                ProxySprite pTemp = (ProxySprite)this.pNext;
                Debug.WriteLine("next: {0}, {1}", pTemp.name, pTemp.GetHashCode());
            }
        }
        override protected void derivedDumpNode(DLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pData = (ProxySprite)pLink;

            pData.Dump();
        }
Ejemplo n.º 7
0
 public static ProxySprite Find(ProxySprite.Name name)
 {
     ProxySpriteManager pMan = ProxySpriteManager.PrivGetInstance();
     pMan.poNodeCompare.SetName(name);
     ProxySprite pData = (ProxySprite)pMan.BaseFind(pInstance.poNodeCompare);
     return pData;
 }
 protected GameObject(GameObject.Name gameName)
 {
     this.name         = gameName;
     this.x            = 0.0f;
     this.y            = 0.0f;
     this.pProxySprite = null;
 }
Ejemplo n.º 9
0
        protected override void DerivedDumpNode(DLink pDLink)
        {
            Debug.Assert(pDLink != null);
            ProxySprite pNode = (ProxySprite)pDLink;

            pNode.DumpProxy();
        }
Ejemplo n.º 10
0
        protected override void derivedReset(DLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pProxySprite = (ProxySprite)pLink;

            pProxySprite.deepClear();
        }
        override protected void derivedWash(DLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pNode = (ProxySprite)pLink;

            pNode.Wash();
        }
Ejemplo n.º 12
0
        protected override MLink createConcreteNode()
        {
            ProxySprite proxySprite = new ProxySprite(); // different

            Debug.Assert(proxySprite != null);
            return(proxySprite);
        }
Ejemplo n.º 13
0
        protected override void derivedPrint(DLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pSprite = (ProxySprite)pLink;

            pSprite.Print();
        }
Ejemplo n.º 14
0
        public static ProxySprite Add(GameSprite.Name name)
        {
            ProxySprite pNode = (ProxySprite)pInstance.BaseAdd();
            Debug.Assert(pNode != null);

            pNode.Set(name);
            return pNode;
        }
Ejemplo n.º 15
0
        //----------------------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------------------

        public GameObject() : base()
        {
            this.name          = GameObject.Name.Uninitialized;
            this.pProxySprite  = null;
            this.x             = 0.0f;
            this.y             = 0.0f;
            this.bMarkForDeath = false;
        }
Ejemplo n.º 16
0
        public static ProxySprite Add(SpriteBaseName spriteName)
        {
            ProxySpriteManager proxySpriteMan = ProxySpriteManager.GetInstance();
            ProxySprite        proxySprite    = (ProxySprite)proxySpriteMan.BaseAdd();

            proxySprite.Set(spriteName);
            return(proxySprite);
        }
        //----------------------------------------------------------------------
        // Override Abstract methods
        //----------------------------------------------------------------------
        override protected DLink derivedCreateNode()
        {
            DLink pNode = new ProxySprite();

            Debug.Assert(pNode != null);

            return(pNode);
        }
Ejemplo n.º 18
0
        public static void Remove(ProxySprite pNode)
        {
            ProxySpriteManager pMan = ProxySpriteManager.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemoveNode(pNode);
        }
Ejemplo n.º 19
0
        public static void remove(ProxySprite targetNode)
        {
            ProxySpriteManager spriteBoxMInstance = ProxySpriteManager.getSingletonInstance();

            Debug.Assert(proxyMInstance != null);

            Debug.Assert(targetNode != null);
            proxyMInstance.genericRemove(targetNode);
        }
        public Sprite createExplosion()
        {
            Sprite temp = new ProxySprite(SpriteType.Explosion, RealSpriteFactory.getSprite(SpriteType.Explosion));

            temp.setSprite(sprite);
            manager.createActive(temp);
            temp.setScale(SizeFactory.getFactory.alienScale.spriteWidth, SizeFactory.getFactory.alienScale.spriteHeight);
            return(temp);
        }
Ejemplo n.º 21
0
 public AlienGO(GameObject.Name gameName, GameSprite.Name spriteName, GameSprite.Name expSpriteName, int points, float x, float y)
     : base(gameName, spriteName)
 {
     this.x          = x;
     this.y          = y;
     this.delta      = 1.0f;
     this.points     = points;
     this.pExplosion = ProxySpriteManager.Add(expSpriteName);
 }
Ejemplo n.º 22
0
        //----------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------
        private ProxySpriteManager(int reserveNum = 3, int reserveGrow = 1)
            : base() // <--- Kick the can (delegate)
        {
            // At this point ImageMan is created, now initialize the reserve
            this.BaseInitialize(reserveNum, reserveGrow);

            // initialize derived data here
            this.poNodeCompare = new ProxySprite();
        }
Ejemplo n.º 23
0
 public ShipBulletLeaf(GameSpriteName spname, float x, float y, int lx, int ly)
 {
     proxySprite  = new ProxySprite(spname, x, y);
     CollisionObj = new CollisionObject(proxySprite);
     PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box);
     this.x    = x;
     this.y    = y;
     locationX = lx;
     locationY = ly;
 }
Ejemplo n.º 24
0
 public BombLeaf(GameSpriteName spname, FallStrategy strategy, float x, float y, int lx, int ly)
 {
     proxySprite  = new ProxySprite(spname, x, y);
     CollisionObj = new CollisionObject(proxySprite);
     PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box);
     this.x    = x;
     this.y    = y;
     _Strategy = strategy;
     _Strategy.Reset(this.y);
 }
Ejemplo n.º 25
0
        public CollisionObject(ProxySprite pProxy)
        {
            Debug.Assert(pProxy != null);

            this.poCollisionRect = new CollisionRect(pProxy.GetSpriteRect());

            this.pCollsionBoxSprite = BoxSpriteMan.Add(this.poCollisionRect.x, this.poCollisionRect.y, this.poCollisionRect.width, this.poCollisionRect.height);
            Debug.Assert(this.pCollsionBoxSprite != null);
            this.pCollsionBoxSprite.SetLineColor(1.0f, 1.0f, 0.0f);
        }
Ejemplo n.º 26
0
        public static void Remove(ProxySprite pSprite)
        {
            ProxySpriteManager pManager = ProxySpriteManager.privGetInstance();

            Debug.Assert(pManager != null);
            Debug.Assert(pSprite != null);

            // delegate to abstract manager who deals with the DLinks
            pManager.baseRemove(pSprite);
        }
Ejemplo n.º 27
0
        public GameObject(GameObject.Name gameName, GameSprite.Name spriteName) : base()
        {
            this.name = gameName;
            this.x    = 0.0f;
            this.y    = 0.0f;

            this.pProxySprite = ProxySpriteManager.Add(spriteName);
            this.poCollObj    = new CollisionObj(this.pProxySprite);
            Debug.Assert(this.poCollObj != null);
            this.bMarkForDeath = false;
        }
Ejemplo n.º 28
0
        public void UpdatePos(ProxySprite pProxy)
        {
            this.poCollisionRect.x = pProxy.x;
            this.poCollisionRect.y = pProxy.y;

            this.pCollsionBoxSprite.SetScreenRect(
                this.poCollisionRect.x,
                this.poCollisionRect.y, this.poCollisionRect.width, this.poCollisionRect.height);

            this.pCollsionBoxSprite.Update();
        }
Ejemplo n.º 29
0
        //----------------------------------------------------------------------------------
        // Set Methods
        //----------------------------------------------------------------------------------

        public void Set(GameObject.Name gameName, GameSprite.Name spriteName, float px = 0.0f, float py = 0.0f)
        {
            this.name = gameName;
            this.x    = px;
            this.y    = py;

            this.pProxySprite = ProxySpriteManager.Add(spriteName);
            this.poCollObj    = new CollisionObj(this.pProxySprite);
            Debug.Assert(this.poCollObj != null);
            this.bMarkForDeath = false;
        }
Ejemplo n.º 30
0
        //protected GameObject(GameObject.Name gameName)
        //{
        //    this.x = 0.0f;
        //    this.y = 0.0f;
        //    this.name = gameName;
        //    moveDirection = 1;
        //    this.pProxySprite = null;
        //}

        protected GameObject(GameObject.Name gameName, GameSprite.Name spriteName)
        {
            this.name          = gameName;
            this.bMarkForDeath = false;
            this.x             = 0.0f;
            this.y             = 0.0f;

            this.pProxySprite = ProxySpriteMan.Add(spriteName);
            this.poColObj     = new ColObject(this.pProxySprite);
            Debug.Assert(this.poColObj != null);
        }
Ejemplo n.º 31
0
 public override void notify()
 {
     ProxySprite prox;
     if (subj.GameObj1 is Alien)
     {
         prox = new ProxySprite(SpriteEnum.Splat, Index.Index_Null, subj.GameObj1.getX(), subj.GameObj1.getY());
     }
     else
     {
         prox = new ProxySprite(SpriteEnum.Splat, Index.Index_Null, subj.GameObj2.getX(), subj.GameObj2.getY());
     }
     SpriteBatchManager.attachToGroup(prox, BatchGroup.BatchType.Explosions);
     TimeEventManager.add(.5f, new RemoveSplat(prox));
 }
Ejemplo n.º 32
0
        public PlayerShip(float x, float y)
            : base(Name.Player, SpriteEnum.Player, Index.Index_Null, new Azul.Color(0, 1.0f, 0), new Azul.Color(0, 1, 0), x, y)
        {
            sprite = new ProxySprite(SpriteEnum.Player, Index.Index_Null, x, y);
            canMoveLeft = true;
            canMoveRight = true;
            states = new PlayerState[3];

            PlayerState start = new StartState();
            PlayerState ready = new ReadyState();
            PlayerState noShoot = new NoShootState();
            states[(int)PlayerStates.Start] = start;
            states[(int)PlayerStates.Ready] = ready;
            states[(int)PlayerStates.NoShoot] = noShoot;
            playerState = ready;
        }
Ejemplo n.º 33
0
 public override void notify()
 {
     if (subj.GameObj1 is TopWall || subj.GameObj1 is BottomWall)
     {
         ProxySprite p = new ProxySprite(SpriteEnum.Explosion, Index.Index_Null, subj.GameObj2.getX(), subj.GameObj2.getY());
         SpriteBatchManager.attachToGroup(p, BatchGroup.BatchType.Explosions);
         TimeEventManager.add(1f, new RemoveExplosion(p));
     }
     else if (subj.GameObj2 is TopWall || subj.GameObj2 is BottomWall)
     {
         ProxySprite p = new ProxySprite(SpriteEnum.Explosion, Index.Index_Null, subj.GameObj1.getX(), subj.GameObj1.getY());
         SpriteBatchManager.attachToGroup(p, BatchGroup.BatchType.Explosions);
         TimeEventManager.add(1f, new RemoveExplosion(p));
     }
     else
     {
         ProxySprite p = new ProxySprite(SpriteEnum.Explosion, Index.Index_Null, subj.GameObj1.getX(), subj.GameObj1.getY());
         SpriteBatchManager.attachToGroup(p, BatchGroup.BatchType.Explosions);
         TimeEventManager.add(1f, new RemoveExplosion(p));
     }
 }
Ejemplo n.º 34
0
 public RemoveExplosion(ProxySprite s)
 {
     spr = s;
 }
Ejemplo n.º 35
0
 public RemoveSplat(ProxySprite p)
 {
     proxy = p;
 }
Ejemplo n.º 36
0
 public override void updateBehavior(ProxySprite sprite)
 {
 }
Ejemplo n.º 37
0
 public HUDStrategy(ProxySprite s)
 {
     spr = s;
 }
Ejemplo n.º 38
0
 public abstract void updateBehavior(ProxySprite sprite);
Ejemplo n.º 39
0
 public Alien(GameObject.Name goName, SpriteEnum sprName, Index index, float x, float y)
     : base(goName, sprName, index, new Azul.Color(1f, 1f, 1f), new Azul.Color(1.0f, 0.0f, 0.0f), x, y)
 {
     sprite = new ProxySprite(sprName, index, x, y);
 }
Ejemplo n.º 40
0
 public override void updateBehavior(ProxySprite sprite)
 {
     float sx = sprite.getScaleX();
     sprite.setScale(sx * -1f, sprite.getScaleY());
 }
Ejemplo n.º 41
0
 public override void updateBehavior(ProxySprite sprite)
 {
     float sy = sprite.getScaleY();
     sprite.setScale(sprite.getScaleX(), sy * -1f);
 }