// create a SpriteBox MLink node and return protected override MLink createConcreteNode() { SpriteBox spriteBox = new SpriteBox(); // different Debug.Assert(spriteBox != null); return(spriteBox); }
protected override void DerivedDestroyNode(DLink pLink) { SpriteBox pSpriteBox = (SpriteBox)pLink; pSpriteBox.SetLineColor(null); pSpriteBox.SetAzulSpriteBox(null); }
public SpriteBaseRef Attach(SpriteBox pNode) { Debug.Assert(this.pSBRefManager != null); SpriteBaseRef pSBRef = this.pSBRefManager.Attach(pNode); return(pSBRef); }
public static SpriteBox Add(SpriteBaseName name, Azul.Rect azulRect) { SpriteBoxManager spriteBoxMan = SpriteBoxManager.GetInstance(); SpriteBox spriteBox = (SpriteBox)spriteBoxMan.BaseAdd(); spriteBox.Set(name, azulRect.x, azulRect.y, azulRect.width, azulRect.height); return(spriteBox); }
protected override DLink DerivedCreateNode() { DLink pNode = new SpriteBox(); Debug.Assert(pNode != null); return(pNode); }
protected override void DumpNode(DLink node) { Debug.Assert(node != null); SpriteBox pSpriteBox = (SpriteBox)node; Debug.WriteLine(String.Format("\t\tSpriteBox:({0})", pSpriteBox.GetHashCode())); Debug.WriteLine(String.Format("\t\tLineColor:({0},{1},{2})", pSpriteBox.pLineColor.red, pSpriteBox.pLineColor.green, pSpriteBox.pLineColor.blue)); Debug.WriteLine(String.Format("\t\tstatus:{0}", pSpriteBox.status)); }
public static SpriteBox Find(SpriteBaseName name) { SpriteBoxManager sbMan = SpriteBoxManager.GetInstance(); SpriteBox sb = (SpriteBox)sbMan.BaseFind(new SpriteBox { name = name }); return(sb); }
public void Detach(SpriteBox pNode) { Debug.Assert(pNode != null); this.pSpriteBaseRefCompare.SetSpriteBase(pNode); DLink pFoundNode = this.BaseFind(this.pSpriteBaseRefCompare); Debug.Assert(pFoundNode != null); this.BaseRemove(pFoundNode); }
public static void Remove(SpriteBox pNode) { SpriteBoxManager pMan = SpriteBoxManager.PrivGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.BaseRemove(pNode); }
public void setSpriteBox(SpriteBox.SpriteBoxName spriteBox, SpriteBatchNodeManager mSbManager) { SpriteBox sprBox = (SpriteBox)SpriteBoxManager.find(spriteBox); Debug.Assert(sprBox != null); Debug.Assert(mSbManager != null); this.cSpriteBase = sprBox; this.cSBNodeMan = mSbManager; }
public SpriteBaseRef Attach(SpriteBox pNode) { SpriteBaseRef pSBNode = (SpriteBaseRef)this.BaseAdd(); Debug.Assert(pSBNode != null); // Initialize SpriteBaseRef pSBNode.Set(pNode); return(pSBNode); }
public CollisionObject(ProxySprite proxySprite) { // we'll pass in proxySprites to generate collision boxes around Debug.Assert(proxySprite != null); Sprite pSprite = proxySprite.pSprite; Debug.Assert(pSprite != null); this.pCollisionRect = new CollisionRect(pSprite.GetScreenRect()); //Debug.WriteLine("ProxySprite Rect for {0}:({1},{2}),w:{3},h:{4}", proxySprite.pSprite.name, proxySprite.x, proxySprite.y, proxySprite.pSprite.pScreenRect.width, proxySprite.pSprite.pScreenRect.height); //Debug.WriteLine("CollisionRect for {0}:({1},{2}),w:{3},h:{4}", proxySprite.pSprite.name, this.pCollisionRect.x, this.pCollisionRect.y, this.pCollisionRect.width, this.pCollisionRect.height); this.pCollisionSpriteBox = SpriteBoxManager.Add(SpriteBaseName.Box, this.pCollisionRect); Debug.Assert(this.pCollisionSpriteBox != null); this.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor; }
public static SpriteBox Find(SpriteBox.Name name) { SpriteBoxManager pMan = SpriteBoxManager.PrivGetInstance(); Debug.Assert(pMan != null); // Use compare node to compare to search nodes pMan.pSpriteBoxCompare.SetName(name); SpriteBox pData = (SpriteBox)pMan.BaseFind(pMan.pSpriteBoxCompare); return(pData); }
//---------------------------------------------------------------------- // Methods //---------------------------------------------------------------------- public virtual void Update() { Debug.Assert(this.pSpriteProxy != null); this.pSpriteProxy.SetX(this.x); this.pSpriteProxy.SetY(this.y); Debug.Assert(this.pCollisionObject != null); this.pCollisionObject.UpdatePos(this.x, this.y); SpriteBox pCollisionSpriteBox = this.pCollisionObject.GetCollisionSpriteBox(); Debug.Assert(pCollisionSpriteBox != null); pCollisionSpriteBox.Update(); }
public static SpriteBox Add(SpriteBox.Name name, float x, float y, float width, float height, Azul.Color color) { SpriteBoxManager pMan = SpriteBoxManager.PrivGetInstance(); Debug.Assert(pMan != null); SpriteBox pSpriteBox = (SpriteBox)pMan.BaseAdd(); Debug.Assert(pSpriteBox != null); // Initialize the date pSpriteBox.Set(name, x, y, width, height, color); return(pSpriteBox); }
public static SpriteBox add(SpriteBox.SpriteBoxName sbName, Azul.Rect sbRect) { SpriteBoxManager spriteBoxMInstance = SpriteBoxManager.getSingletonInstance(); Debug.Assert(spriteBoxMInstance != null); SpriteBox nodeAdded = (SpriteBox)spriteBoxMInstance.genericAdd(); Debug.Assert(nodeAdded != null); //set the attributes of the SpriteBox node nodeAdded.setAll(sbName, sbRect); return(nodeAdded); }
protected override bool Compare(DLink dLink1, DLink dLink2) { bool result = false; Debug.Assert(dLink1 != null); Debug.Assert(dLink2 != null); SpriteBox pSpriteBox1 = (SpriteBox)dLink1; SpriteBox pSpriteBox2 = (SpriteBox)dLink2; if (pSpriteBox1.name == pSpriteBox2.name) { result = true; } return(result); }
protected override bool compareConcreteNode(ref MLink targetNode, ref MLink currNode) { Debug.Assert(targetNode != null); Debug.Assert(currNode != null); bool result = false; SpriteBox targetSb = (SpriteBox)targetNode; SpriteBox currSb = (SpriteBox)currNode; if (targetSb.cSpriteBoxName.Equals(currSb.cSpriteBoxName)) { result = true; } return(result); }
public static SpriteBox find(SpriteBox.SpriteBoxName sbName) { SpriteBoxManager spriteBoxMInstance = SpriteBoxManager.getSingletonInstance(); Debug.Assert(spriteBoxMInstance != null); SpriteBox pseudoSb = new SpriteBox(); pseudoSb.cSpriteBoxName = sbName; Debug.Assert(spriteBoxMInstance != null); SpriteBox targetSb = (SpriteBox)spriteBoxMInstance.genericFind(pseudoSb); return(targetSb); }
// Extract the rectangle co ordinates of the sprite in the proxy sprite // Set those to the sprite box. public CollisionObject(ProxySprite mProxySprite) { Debug.Assert(mProxySprite != null); //Create a BoxSprite Sprite mSprite = mProxySprite.rcSprite; Debug.Assert(mSprite != null); cSpriteBox = SpriteBoxManager.add(SpriteBox.SpriteBoxName.Box, mSprite.screenRect); Debug.Assert(this.cSpriteBox != null); // Set the Collision Rectangle this.cCollisionRectangle = new CollisionRectangle(cSpriteBox.cSpriteBoxRect); Debug.Assert(this.cCollisionRectangle != null); // this.cSpriteBox.setColor(1, 1, 1); // this.cSpriteBox.setColor(Unit.spriteBoxColor); }
//---------------------------------------------------------------------- // Override Abstract methods //---------------------------------------------------------------------- protected override bool DerivedCompare(DLink pLinkA, DLink pLinkB) { // This is used in baseFind() Debug.Assert(pLinkA != null); Debug.Assert(pLinkB != null); SpriteBox pDataA = (SpriteBox)pLinkA; SpriteBox pDataB = (SpriteBox)pLinkB; Boolean status = false; if (pDataA.GetName() == pDataB.GetName()) { status = true; } return(status); }
public CollisionObject(SpriteProxy pSpriteProxy) { Debug.Assert(pSpriteProxy != null); // Create Collision Rect // Use the reference sprite to set size and shape Sprite pSprite = pSpriteProxy.GetSprite(); Debug.Assert(pSprite != null); // Origin is in the UPPER RIGHT this.pCollisionRect = new CollisionRect(pSprite.GetScreenRect()); Debug.Assert(this.pCollisionRect != null); // Create the sprite this.pCollisionSprite = SpriteBoxManager.Add(SpriteBox.Name.Box, this.pCollisionRect.x, this.pCollisionRect.y, this.pCollisionRect.width, this.pCollisionRect.height); Debug.Assert(this.pCollisionSprite != null); this.pCollisionSprite.SetLineColor(1.0f, 0.0f, 0.0f); }
//---------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------- private SpriteBoxManager(int reserveNum = 3, int reserveGrow = 1) : base(reserveNum, reserveGrow) { this.pSpriteBoxCompare = new SpriteBox(); }
public void Detach(SpriteBox pNode) { Debug.Assert(pNode != null); this.pSBRefManager.Detach(pNode); }