public State NewState(string name) { // New State with NO Image or Animation // Resize the list RCore.ListUp <State>(ref stateList); stateList[Array.IndexOf(stateList, null)] = new State(name); return(stateList[stateList.Length - 1]); }
public static Sprite NewSprite(int Xpos, int Ypos) { // Resize the list RCore.ListUp <Sprite>(ref spriteList); // Replace next null occurrence with a new instance of Sprite. spriteList[Array.IndexOf(spriteList, null)] = new Sprite(new Position(Xpos, Ypos, screen), screen); // Return a reference to the Sprite we just created so we can issue commands from the top level. return(spriteList[spriteList.Length - 1]); }
public State NewAnimationState(string animationSource, string name) { // New State with Animation // Resize the animationList and add a new instance of Animation RCore.ListUp <Animation>(ref animationList); animationList[Array.IndexOf(animationList, null)] = new Animation(animationSource); // Resize the stateList and add a new instance of State RCore.ListUp <State>(ref stateList); stateList[Array.IndexOf(stateList, null)] = new State(animationList[animationList.Length - 1], name); // Return a reference of the State instance to the top level return(stateList[stateList.Length - 1]); }
public State NewImageState(string imageSource, string name) { // New State with Image // Resize the imageList and add a new instance of Image RCore.ListUp <Image>(ref imageList); imageList[Array.IndexOf(imageList, null)] = new Image(imageSource); // Resize the stateList and add a new instance of State RCore.ListUp <State>(ref stateList); stateList[Array.IndexOf(stateList, null)] = new State(imageList[imageList.Length - 1], name); // Return a reference of the State instance to the top level return(stateList[stateList.Length - 1]); }