public static void SavePanelChildren( GameObject savedObj , ref List<SceneData.SceneNodeData> nodelist , ref ISpriteFactory spriteFact ) { nodelist.Clear(); // savedObj <== named "SavedLayer" GameObject and this is not serialized. int count = savedObj.transform.GetChildCount(); if( count > 0 ){ for(int i=0;i<count;i++){ GameObject childObj = savedObj.transform.GetChild( i ).gameObject; SaveDataRecursively( childObj ,ref nodelist , ref spriteFact ); } } // TEST . TEXT BOX POSITION SAVE. /* SceneData.SceneNodeData dat = new SceneData.SceneNodeData(); GameObject _TEXTBOX = GameObject.Find( "TextBox" ); if( _TEXTBOX != null ){ dat.nodeType = SceneNodeType.NODE; nodelist.Add( dat ); spriteFact.SaveData( ref dat , _TEXTBOX ); } else{ ViNoDebugger.LogError( "TextBox Not Found !" ); } //*/ }
public ThrowingStar(Vector2 location, bool left) { factory = new SpriteFactory(); sprite = factory.build(SpriteFactory.sprites.throwingStar); position = location; this.left = left; }
public RightFallingTeno(Teno teno, Game1 game) { this.game = game; factory = new SpriteFactory(); Sprite = factory.build(SpriteFactory.sprites.rightJumpFallTeno); this.teno = teno; }
public LeftJumpingTeno(Teno teno, Game1 game) { this.game = game; factory = new SpriteFactory(); Sprite = factory.build(SpriteFactory.sprites.leftJumpUpTeno); this.teno = teno; }
protected override void Create(ISpriteFactory spriteFactory, DataSource dataSource) { sprite = spriteFactory.Create(RenderMap.TILE_WIDTH, RenderMap.TILE_RENDER_MAX_HEIGHT, 0, 0, false, false); sprite.Visible = true; UpdateAppearance(); }
public static void SaveViNoSceneNodes( ref List<SceneData.SceneNodeData> nodelist , ISpriteFactory fact ) { ViNoSceneNode[] sceneNodesData = GameObject.FindObjectsOfType( typeof( ViNoSceneNode ) ) as ViNoSceneNode[]; if( sceneNodesData != null ){ for( int i=0;i<sceneNodesData.Length;i++){ GameObject sceneNode = sceneNodesData[ i ].gameObject; if( sceneNodesData[ i ].singleNodeData != null ){ SceneData.SceneNodeData data = sceneNodesData[ i ].singleNodeData; nodelist.Add( data ); fact.SaveData( ref data , sceneNode ); } /* else{ if( sceneNodesData[ i ].scrNodeData.nodesData != null ){ int len = sceneNodesData[ i ].scrNodeData.nodesData.Length; for( int k=0;k<len;k++){ SceneData.SceneNodeData data = sceneNodesData[ i ].scrNodeData.nodesData[ k ]; nodelist.Add( data ); GameObject obj = GameObject.Find( data.name );//sceneNode.gameObject.transform.FindChild( data.name ).gameObject; fact.SaveData( ref data , obj ); } } } //*/ } } }
public BackgroundHolder() { factory = new SpriteFactory(); OverworldSprite = factory.build(SpriteFactory.sprites.overworldBackground); UndergroundSprite = factory.build(SpriteFactory.sprites.undergroundBackground); OverworldHillsSprite = factory.build(SpriteFactory.sprites.overworldHillsBackground); CurrentSprite = OverworldSprite; }
public Fireball(Vector2 location, bool left) { factory = new SpriteFactory(); sprite = factory.build(SpriteFactory.sprites.fireball); position = location; this.left = left; SoundManager.fireball.Play(); }
public RenderFlag(Flag flag, IRenderLayer renderLayer, ISpriteFactory spriteFactory, DataSource dataSource) : base(renderLayer, spriteFactory, dataSource) { this.flag = flag; this.spriteFactory = spriteFactory; Initialize(); InitOffsets(dataSource); }
public RenderRoadSegment(Map map, MapPos position, Direction direction, IRenderLayer renderLayer, ISpriteFactory spriteFactory, DataSource dataSource) : base(renderLayer, spriteFactory, dataSource) { this.map = map; this.position = position; this.direction = direction; Initialize(); }
public RenderMapObject(Map.Object objectType, IRenderLayer renderLayer, ISpriteFactory spriteFactory, DataSource dataSource) : base(renderLayer, spriteFactory, dataSource) { this.objectType = objectType; this.dataSource = dataSource; Initialize(); InitOffsets(dataSource); }
protected override void Create(ISpriteFactory spriteFactory, DataSource dataSource) { uint spriteIndex = (uint)objectType - 8; var spriteInfo = dataSource.GetSpriteInfo(Data.Resource.MapObject, spriteIndex); var shadowInfo = dataSource.GetSpriteInfo(Data.Resource.MapShadow, spriteIndex); sprite = spriteFactory.Create(spriteInfo.Width, spriteInfo.Height, 0, 0, false, false); shadowSprite = spriteFactory.Create(shadowInfo.Width, shadowInfo.Height, 0, 0, false, false); }
public LevelFactory(ITileTypeFactory tileTypeFactory, IDisplay display, ISpriteFactory spriteFactory, IGameLogicValidator gameLogicValidator, IGameEngine gameEngine, IPlayerInput playerInput, ISpriteBehaviour pacmanBehaviour, ISpriteBehaviour ghostBehaviour) { _tileTypeFactory = tileTypeFactory; _display = display; _spriteFactory = spriteFactory; _gameLogicValidator = gameLogicValidator; _gameEngine = gameEngine; _playerInput = playerInput; _pacmanBehaviour = pacmanBehaviour; _ghostBehaviour = ghostBehaviour; }
readonly List <SpriteInfo> characterSpritesNew = new List <SpriteInfo>(); // shared by all texts public TextRenderer(IRenderView renderView) { spriteFactory = renderView.SpriteFactory; layerLegacy = renderView.GetLayer(Layer.Gui); layerNewFont = renderView.GetLayer(Layer.GuiFont); // original size is 8x8 pixels characterSizeLegacy = new Size(8, 8); // new font uses a different size characterSizeNew = new Size(Global.UIFontCharacterWidth, Global.UIFontCharacterHeight); }
public Player2D(Game game, IRenderLayer layer, Player player, RenderMap2D map, ISpriteFactory spriteFactory, Position startPosition, IMapManager mapManager) : base(game, layer, TextureAtlasManager.Instance.GetOrCreate(Layer.Characters), spriteFactory, game.GetPlayerAnimationInfo, map, startPosition, game.GetPlayerPaletteIndex, game.GetPlayerDrawOffset) { this.game = game; this.player = player; this.mapManager = mapManager; }
public LevelBuilder(Level currentLevel) { level = currentLevel; factory = new SpriteFactory(); tileFactory = new TileFactory(); grassFactory = new GrassFactory(); ledgeFactory = new LedgeFactory(); buildingFactory = new BuildingFactory(); enemyFactory = new EnemyFactory(); // trees tileDictionary.Add("W", TileFactory.TileType.treeTile); // pokecenter parts tileDictionary.Add("3", TileFactory.TileType.pokeEndCornerLeft); tileDictionary.Add("6", TileFactory.TileType.pokeEndCornerRight); tileDictionary.Add("1", TileFactory.TileType.pokeEndCounterLeft); tileDictionary.Add("8", TileFactory.TileType.pokeEndCounterRight); tileDictionary.Add("4", TileFactory.TileType.pokeHorizontal); tileDictionary.Add("5", TileFactory.TileType.pokeMiddleSection); tileDictionary.Add("2", TileFactory.TileType.pokeVerticalLeft); tileDictionary.Add("7", TileFactory.TileType.pokeVerticalRight); tileDictionary.Add("0", TileFactory.TileType.pokeFloorSpot); tileDictionary.Add("t", TileFactory.TileType.pokeTree); tileDictionary.Add("y", TileFactory.TileType.pokeBookShelf); tileDictionary.Add("u", TileFactory.TileType.pokeComputer); tileDictionary.Add("i", TileFactory.TileType.pokeStairsDown); tileDictionary.Add("o", TileFactory.TileType.pokeChairs); tileDictionary.Add("q", TileFactory.TileType.pokeFloorPrint); // grass grassDictionary.Add("G", GrassFactory.GrassType.shortGrass); // ledges ledgeDictionary.Add("M", LedgeFactory.LedgeType.ledgeMiddle); ledgeDictionary.Add("R", LedgeFactory.LedgeType.ledgeRightEnd); ledgeDictionary.Add("L", LedgeFactory.LedgeType.ledgeLeftEnd); // buildings buildingDictionary.Add("I", BuildingFactory.BuildingType.pokeCenterLeft); buildingDictionary.Add("O", BuildingFactory.BuildingType.pokeCenterRight); // npcs enemyDictionary.Add("E", EnemyFactory.EnemyType.rival); enemyDictionary.Add("Q", EnemyFactory.EnemyType.girl); // exits exitDictionary.Add("B", SpriteFactory.sprites.exit); // random tileDictionary.Add("p", TileFactory.TileType.sign); }
public Spike(Vector2 location, bool up) { factory = new SpriteFactory(); if (up) { sprite = factory.build(SpriteFactory.sprites.upSpike); } else { sprite = factory.build(SpriteFactory.sprites.downSpike); } position = location; }
public static void SaveDataRecursively( GameObject savedObj , ref List<SceneData.SceneNodeData> nodelist , ref ISpriteFactory spriteFact ) { SceneData.SceneNodeData data = new SceneData.SceneNodeData(); nodelist.Add( data ); spriteFact.SaveData( ref data , savedObj ); int count = savedObj.transform.GetChildCount(); if( count > 0 ){ for(int i=0;i<count;i++){ GameObject childObj = savedObj.transform.GetChild( i ).gameObject; SaveDataRecursively( childObj ,ref nodelist , ref spriteFact ); } } }
public RenderingEngine(RenderWindow window, ISpriteFactory spriteFactory) { _spriteFactory = spriteFactory; Window = window; _chaserSprite = _spriteFactory.CreateSprite(GameStateSingleton.Instance.State.Chaser); _playerSprite = _spriteFactory.CreateSprite(GameStateSingleton.Instance.State.Player); var iterator = GameStateSingleton.Instance.State.Map.TerrainObjects.CreateIterator(); for (var item = iterator.CurrentItem; iterator.Next() != null; iterator.Next()) { _terrainObjects.Add(_spriteFactory.CreateSprite(item)); } }
public LevelBuilder(Level level) { this.level = level; factory = new SpriteFactory(); blockFactory = new BlockFactory(); enemyFactory = new EnemyFactory(); pipeFactory = new PipeFactory(); collectableFactory = new CollectableFactory(); itemDictionary.Add("F", CollectableFactory.CollectableType.fireFlower); itemDictionary.Add("C", CollectableFactory.CollectableType.coin); itemDictionary.Add("SM", CollectableFactory.CollectableType.superMushroom); itemDictionary.Add("1U", CollectableFactory.CollectableType.oneUp); itemDictionary.Add("*", CollectableFactory.CollectableType.star); itemDictionary.Add("N", CollectableFactory.CollectableType.ninja); backgroundDictionary.Add("bush1", SpriteFactory.sprites.bush1); backgroundDictionary.Add("bush2", SpriteFactory.sprites.bush2); backgroundDictionary.Add("bush3", SpriteFactory.sprites.bush3); backgroundDictionary.Add("exit", SpriteFactory.sprites.exit); backgroundDictionary.Add("ca", SpriteFactory.sprites.castle); pipeDictionary.Add("upi", PipeFactory.PipeFacing.up); pipeDictionary.Add("lpi", PipeFactory.PipeFacing.left); pipeDictionary.Add("dpi", PipeFactory.PipeFacing.down); enemyDictionary.Add("K", EnemyFactory.EnemyType.Koopa); enemyDictionary.Add("Tdin", EnemyFactory.EnemyType.Dino); enemyDictionary.Add("Bill", EnemyFactory.EnemyType.Bill); blockDictionary.Add("X", BlockFactory.BlockType.used); blockDictionary.Add("?", BlockFactory.BlockType.question); blockDictionary.Add("!", BlockFactory.BlockType.exclamation); blockDictionary.Add("B", BlockFactory.BlockType.brick); blockDictionary.Add("g", BlockFactory.BlockType.ground); blockDictionary.Add("Pi", BlockFactory.BlockType.brokenPipe); blockDictionary.Add("ug", BlockFactory.BlockType.undergroundFloor); blockDictionary.Add("ur", BlockFactory.BlockType.undergroundRoof); blockDictionary.Add("ul", BlockFactory.BlockType.undergroundLeftWall); blockDictionary.Add("ult", BlockFactory.BlockType.undergroundLeftTop); blockDictionary.Add("ulb", BlockFactory.BlockType.undergroundLeftBottom); blockDictionary.Add("uri", BlockFactory.BlockType.undergroundRightWall); blockDictionary.Add("urt", BlockFactory.BlockType.undergroundRightTop); blockDictionary.Add("urb", BlockFactory.BlockType.undergroundRightBottom); blockDictionary.Add("l", BlockFactory.BlockType.leftEdge); blockDictionary.Add("r", BlockFactory.BlockType.rightEdge); blockDictionary.Add("?SM", BlockFactory.BlockType.quesMush); blockDictionary.Add("?C", BlockFactory.BlockType.quesCoin); blockDictionary.Add("?1U", BlockFactory.BlockType.ques1up); blockDictionary.Add("?*", BlockFactory.BlockType.quesStar); blockDictionary.Add("?F", BlockFactory.BlockType.quesFlower); blockDictionary.Add("?N", BlockFactory.BlockType.quesNinja); }
public Level(ITileTypeFactory tileTypeFactory, IMaze maze, IDisplay display, ISpriteFactory spriteFactory, IGameLogicValidator gameLogicValidator, IGameEngine gameEngine, IPlayerInput playerInput, ISpriteBehaviour pacmanBehaviour, ISpriteBehaviour ghostBehaviour) { GameLogicValidator = gameLogicValidator; GameEngine = gameEngine; _tileTypeFactory = tileTypeFactory; _gameMaze = maze; _display = display; _playerInput = playerInput; Pacman = spriteFactory.CreateSprite(1, 1, pacmanBehaviour); Ghosts.Add(spriteFactory.CreateSprite(9, 9, ghostBehaviour)); Ghosts.Add(spriteFactory.CreateSprite(9, 10, ghostBehaviour)); _allSprites.Add(Pacman); _allSprites.AddRange(Ghosts); HasWon = false; LivesLeft = 3; }
public BackgroundHolder(Game1 game) { this.game = game; factory = new SpriteFactory(); H1Sprite = factory.build(SpriteFactory.sprites.H1Background); H2Sprite = factory.build(SpriteFactory.sprites.H2Background); H3Sprite = factory.build(SpriteFactory.sprites.H3Background); H6Sprite = factory.build(SpriteFactory.sprites.H6Background); if (game.level.levelCurrent == "MapLevel1") { CurrentSprite = H1Sprite; } else { CurrentSprite = H2Sprite; } }
public LevelBuilder(Level level, Game1 game) { this.game = game; this.level = level; factory = new SpriteFactory(); blockFactory = new BlockFactory(); enemyFactory = new EnemyFactory(); collectableFactory = new CollectableFactory(game); // item là những gì thu lượm được itemDictionary.Add("st", CollectableFactory.CollectableType.coin); // background là nhừng gì không ảnh hưởng tới cái khác backgroundDictonary.Add("b1", SpriteFactory.sprites.bush1); backgroundDictonary.Add("G1", SpriteFactory.sprites.grass1); backgroundDictonary.Add("G2", SpriteFactory.sprites.grass2); backgroundDictonary.Add("t", SpriteFactory.sprites.tree); backgroundDictonary.Add("ex", SpriteFactory.sprites.exit); // enemy enemyDictionary.Add("gt", EnemyFactory.EnemyType.GiaiTich); enemyDictionary.Add("ly2", EnemyFactory.EnemyType.Ly2); enemyDictionary.Add("OOP", EnemyFactory.EnemyType.OOP); enemyDictionary.Add("SXTK", EnemyFactory.EnemyType.SXTK); enemyDictionary.Add("PPT", EnemyFactory.EnemyType.PPT); enemyDictionary.Add("HDC", EnemyFactory.EnemyType.HoaDC); // blockDictionary là những khối trong game như đá, cây, hộp blockDictionary.Add("G", BlockFactory.BlockType.gai); blockDictionary.Add("c1", BlockFactory.BlockType.catus1); blockDictionary.Add("c2", BlockFactory.BlockType.catus2); blockDictionary.Add("M1", BlockFactory.BlockType.mushroom1); blockDictionary.Add("M2", BlockFactory.BlockType.mushroom2); blockDictionary.Add("S1", BlockFactory.BlockType.stone1); blockDictionary.Add("S2", BlockFactory.BlockType.stone2); blockDictionary.Add("S3", BlockFactory.BlockType.stone3); blockDictionary.Add("S4", BlockFactory.BlockType.stone4); blockDictionary.Add("SB", BlockFactory.BlockType.stoneblock); blockDictionary.Add("cr", BlockFactory.BlockType.crate); blockDictionary.Add("se", BlockFactory.BlockType.sea); blockDictionary.Add("g", BlockFactory.BlockType.ground); //blockDictionary.Add("ulb", BlockFactory.BlockType.undergroundLeftBottom); //blockDictionary.Add("urb", BlockFactory.BlockType.undergroundRightBottom); }
public MiscObject(Vector2 startPos, ContentManager content, string type) { _opacity = 1.0f; isVisible = true; deleteThis = false; HiddenObject = null; WarpDestination = null; inRange = false; isTouching = false; _type = type; _mario = null; _hiddenObj = null; _spriteFactory = new MiscSpriteFactory(content); _sprite = _spriteFactory.build(type); _hitbox = GetHitbox(type, startPos); _position = startPos; _velocity = new Vector2(0); _acceleration = new Vector2(0); _objectsToNotCollide = new List <AbsObject>(); _objectsToAdd = new List <AbsObject>(); }
public ItemObject(Vector2 startingPosition, ContentManager content, AudioManager audio, string state) { _opacity = 1.0f; _objectsToAdd = new List <AbsObject>(); deleteThis = false; isVisible = true; sp = startingPosition; _position = startingPosition; factory = new ItemSpriteFactory(content); _hitbox = new BoundingBox(new Vector3(startingPosition.X, startingPosition.Y, 0), new Vector3(startingPosition.X + 16, startingPosition.Y + 16, 0)); this.content = content; this.audio = audio; _velocity = new Vector2(0); if (state != "coin" && state != "speed" && state != "jump" && state != "propeller") { _acceleration = new Vector2(0, 0.05f); } _sprite = factory.build(state); State = state; _objectsToNotCollide = new List <AbsObject>(); }
public RenderMap(uint numColumns, uint numRows, Map map, ITriangleFactory triangleFactory, ISpriteFactory spriteFactory, ITextureAtlas textureAtlasTiles, ITextureAtlas textureAtlasWaves, DataSource dataSource) { CoordinateSpace = new CoordinateSpace(map, this); columnRowFactor = (map.Size % 2 == 0) ? 4 : 2; ScrollX = 0; ScrollY = 0; this.numColumns = numColumns; this.numRows = numRows; this.map = map; this.textureAtlasTiles = textureAtlasTiles; this.textureAtlasWaves = textureAtlasWaves; // store map sprite offsets for (uint i = 0; i < 81; ++i) { var spriteInfo = dataSource.GetSpriteInfo(Data.Resource.MapMaskUp, i); if (spriteInfo != null) { maskOffsets.Add(i, new Position(spriteInfo.OffsetX, spriteInfo.OffsetY)); } spriteInfo = dataSource.GetSpriteInfo(Data.Resource.MapMaskDown, i); if (spriteInfo != null) { maskOffsets.Add(81u + i, new Position(spriteInfo.OffsetX, spriteInfo.OffsetY)); } } uint numTriangles = (numColumns + ADDITIONAL_X_TILES) * (numRows + ADDITIONAL_Y_TILES) * 2u; triangles = new List <ITriangle>((int)numTriangles); waves = new List <IMaskedSprite>((int)numTriangles / 2); for (uint column = 0; column < numColumns + ADDITIONAL_X_TILES; ++column) { for (int i = 0; i < 2; ++i) // up and down row { for (uint row = 0; row < numRows + ADDITIONAL_Y_TILES; ++row) { // the triangles are created with the max mask height of 41. // also see comments in TextureAtlasManager.AddAll for further details. var triangle = triangleFactory.Create(TILE_WIDTH, TILE_RENDER_MAX_HEIGHT, 0, 0); triangle.X = (int)(column * TILE_WIDTH) - TILE_WIDTH / 2 + i * TILE_WIDTH / 2; triangle.Y = (int)(row * TILE_HEIGHT); triangle.Visible = true; triangles.Add(triangle); } } } for (uint column = 0; column < numColumns + ADDITIONAL_X_TILES; ++column) { for (uint row = 0; row < numRows + ADDITIONAL_Y_TILES; ++row) { var wave = spriteFactory.Create(48, 19, 0, 0, true, false) as IMaskedSprite; wave.X = (int)(column * TILE_WIDTH) - TILE_WIDTH / 2; wave.Y = (int)(row * TILE_HEIGHT); wave.Visible = false; waves.Add(wave); } } UpdatePosition(); }
public HouseBlockState() { factory = new SpriteFactory(); sprite = factory.build(SpriteFactory.sprites.house1); }
public GroundBlockState() { factory = new SpriteFactory(); this.sprite = factory.build(SpriteFactory.sprites.ground); }
public LedgeTileState(SpriteFactory.sprites sprite) { factory = new SpriteFactory(); this.sprite = factory.builder(sprite); }
public RightFallingBigMS(Mario mario) { factory = new SpriteFactory(); Sprite = factory.build(SpriteFactory.sprites.rightFallingMarioBig); this.mario = mario; }
public InvisibleBlockState() { factory = new SpriteFactory(); sprite = new NullSprite(); }
public GenericBlockState(SpriteFactory.sprites sprite) { factory = new SpriteFactory(); this.sprite = factory.build(sprite); }
public LeftLy2State() { factory = new SpriteFactory(); sprite = factory.build(SpriteFactory.sprites.leftLy2); }