예제 #1
0
        protected override void DerivedWash(DLink pDLink)
        {
            Debug.Assert(pDLink != null);
            ProxySprite pNode = (ProxySprite)pDLink;

            pNode.Wash();
        }
예제 #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);
        }
예제 #3
0
        public static void Remove(ProxySprite pProxy)
        {
            Debug.Assert(pMan != null);
            Debug.Assert(pProxy != null);

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

            this.poNodeCompare = new ProxySprite();
        }
예제 #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();
        }
예제 #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;
 }
예제 #9
0
        protected override void DerivedDumpNode(DLink pDLink)
        {
            Debug.Assert(pDLink != null);
            ProxySprite pNode = (ProxySprite)pDLink;

            pNode.DumpProxy();
        }
예제 #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();
        }
예제 #12
0
        protected override MLink createConcreteNode()
        {
            ProxySprite proxySprite = new ProxySprite(); // different

            Debug.Assert(proxySprite != null);
            return(proxySprite);
        }
예제 #13
0
        protected override void derivedPrint(DLink pLink)
        {
            Debug.Assert(pLink != null);
            ProxySprite pSprite = (ProxySprite)pLink;

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

            pNode.Set(name);
            return pNode;
        }
예제 #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;
        }
예제 #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);
        }
예제 #18
0
        public static void Remove(ProxySprite pNode)
        {
            ProxySpriteManager pMan = ProxySpriteManager.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemoveNode(pNode);
        }
예제 #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);
        }
예제 #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);
 }
예제 #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();
        }
예제 #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;
 }
예제 #24
0
파일: BombLeaf.cs 프로젝트: xfanw/Game
 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);
 }
예제 #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);
        }
예제 #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);
        }
예제 #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;
        }
예제 #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();
        }
예제 #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;
        }
예제 #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);
        }
예제 #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));
 }
예제 #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;
        }
예제 #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));
     }
 }
예제 #34
0
 public RemoveExplosion(ProxySprite s)
 {
     spr = s;
 }
예제 #35
0
 public RemoveSplat(ProxySprite p)
 {
     proxy = p;
 }
예제 #36
0
 public override void updateBehavior(ProxySprite sprite)
 {
 }
예제 #37
0
 public HUDStrategy(ProxySprite s)
 {
     spr = s;
 }
예제 #38
0
 public abstract void updateBehavior(ProxySprite sprite);
예제 #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);
 }
예제 #40
0
 public override void updateBehavior(ProxySprite sprite)
 {
     float sx = sprite.getScaleX();
     sprite.setScale(sx * -1f, sprite.getScaleY());
 }
예제 #41
0
 public override void updateBehavior(ProxySprite sprite)
 {
     float sy = sprite.getScaleY();
     sprite.setScale(sprite.getScaleX(), sy * -1f);
 }