Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     pickup         = this.GetComponent <PickUp>();
     blockCreation0 = GameObject.Find("BlockGenerator0").GetComponent <BlockCreation>();
     blockCreation1 = GameObject.Find("BlockGenerator1").GetComponent <BlockCreation>();
     logicManager   = GameObject.Find("LogicManager").GetComponent <LogicManager>();
     binaryManager  = GameObject.Find("BinaryManager").GetComponent <BinaryManager>();
 }
Ejemplo n.º 2
0
    private void Awake()
    {
        Controls      = GetComponent <Controls>();
        BlockCreation = GetComponent <BlockCreation>();

        PowerSliderFill.minValue = startForceMin;
        PowerSliderFill.maxValue = startForceMax;
    }
Ejemplo n.º 3
0
        public void AddingEntity(StreamReader reader)
        {
            var    line   = reader.ReadLine();
            var    values = line.Split(',');
            Tile   tile   = new Tile();
            string n      = values[0];
            int    x      = Convert.ToInt32(values[1]);
            int    y      = Convert.ToInt32(values[2]);

            tile.Position = Grid.Position(x, y);
            string itemName = "";
            string pipeName = "";
            int    itemNum  = 0;

            if (values.Length > 3 && !string.IsNullOrEmpty(values[3]))
            {
                itemName = values[3];
                itemNum  = Convert.ToInt32(values[4]);
            }
            if (values.Length > 7 && !string.IsNullOrEmpty(values[7]))
            {
                pipeName      = values[5];
                _pipePosition = new Vector2(Convert.ToInt32(values[6]), Convert.ToInt32(values[7]));
            }
            else if (values.Length > 5 && !string.IsNullOrEmpty(values[5]))
            {
                pipeName      = values[3];
                _pipePosition = new Vector2(Convert.ToInt32(values[4]), Convert.ToInt32(values[5]));
            }

            if (n.Equals("Mario"))
            {
                Mario = new MarioEntity(tile.Position, Sounds);
                movingEntities.Add(Mario);
            }
            else if (n.Equals("EnemyPipe"))
            {
                tile.Entity = new EnemyPipeEntity(tile.Position, tiles, movingEntities);
            }
            else if (n.Equals("Pole"))
            {
                tile.Entity = FlagFactory.BuildSprite(tile.Position);
            }
            else if (n.Equals("Boo"))
            {
                tile.Entity = BooFactory.BuildSprite(Mario, tile.Position);
            }
            else if (Enum.TryParse(n, out ItemCreation.ItemType itemType))
            {
                tile.Entity = ItemCreation.BuildItemEntity(itemType, tile.Position, Sounds);
            }
            else if (Enum.TryParse(n, out EnemyFactory.EnemyType enemyType))
            {
                tile.Entity = EnemyFactory.BuildEnemySprite(enemyType, tile.Position, Mario);
                movingEntities.Add(tile.Entity);
            }
            else if (Enum.TryParse(n, out BlockCreation.SceneBlock sceneBlock))
            {
                tile.Entity = BlockCreation.BuildSceneBlock(sceneBlock, tile.Position);
            }
            else if (Enum.TryParse(n, out BlockCreation.Blocks blockType))
            {
                tile.Entity = BlockCreation.BuildBlockEntity(blockType, tile.Position, Sounds);
                if ((tile.Entity is QuestionBlockEntity || tile.Entity is BrickBlockEntity) &&
                    (Enum.TryParse(itemName, out ItemCreation.ItemType item)))   //adding item to question block entity
                {
                    for (int i = 0; i < itemNum; i++)
                    {
                        Entity one = ItemCreation.BuildItemEntity(item, tile.Position, Sounds);
                        tile.Entity.AddItem(one, tiles, movingEntities, Mario);
                    }
                }
                else if (tile.Entity is BridgeBlockEntity && Enum.TryParse(itemName, out ItemCreation.ItemType axe))
                {
                    Entity _axe   = ItemCreation.BuildItemEntity(axe, new Vector2(tile.Position.X + 32, tile.Position.Y - 64), Sounds);
                    Tile   theAxe = new Tile {
                        Entity = _axe
                    };
                    tiles.Add(theAxe);
                    (tile.Entity as BridgeBlockEntity).AxeLink(_axe as AxeEntity);
                    for (int i = 0; i < itemNum; i++)//adding bridge blocks
                    {
                        Entity one = BlockCreation.BuildBlockEntity(BlockCreation.Blocks.BridgeBlock, new Vector2(tile.Position.X - i * 32, tile.Position.Y), Sounds);
                        (one as BridgeBlockEntity).AxeLink(_axe as AxeEntity);
                        tile.Entity.AddItem(one, tiles, movingEntities, Mario);
                    }
                }
                else if (tile.Entity is PipeBlockEntity && Enum.TryParse(itemName, out EnemyFactory.EnemyType enemy) && Enum.TryParse(pipeName, out BlockCreation.Blocks block))
                {
                    Entity plant = EnemyFactory.BuildEnemySprite(enemy, tile.Position, Mario);
                    tile.Entity.AddItem(plant, tiles, movingEntities, Mario);
                    _first        = tile.Entity as PipeBlockEntity;
                    _pipePosition = Grid.Position((int)_pipePosition.X, (int)_pipePosition.Y);
                    Entity second = BlockCreation.BuildBlockEntity(block, _pipePosition, Sounds);
                    Tile   two    = new Tile {
                        Entity = second
                    };
                    _first.SetWarpDestination(second as PipeBlockEntity, Mario);
                    tiles.Add(two);
                    Grid.AddtoGrid(second);
                }
                else if (tile.Entity is PipeBlockEntity && Enum.TryParse(pipeName, out BlockCreation.Blocks pipe))
                {
                    _first        = tile.Entity as PipeBlockEntity;
                    _pipePosition = Grid.Position((int)_pipePosition.X, (int)_pipePosition.Y);
                    Entity second = BlockCreation.BuildBlockEntity(pipe, _pipePosition, Sounds);
                    Tile   two    = new Tile {
                        Entity = second
                    };
                    _first.SetWarpDestination(second as PipeBlockEntity, Mario);
                    tiles.Add(two);
                    Grid.AddtoGrid(second);
                }
            }

            if (tile.Entity != null)
            {
                tiles.Add(tile);
                //Grid.AddtoGrid(tile.Entity);
            }
        }
Ejemplo n.º 4
0
    private void Awake()
    {
        BlockCreation = GetComponent <BlockCreation>();

        TimeSliderFill.maxValue = BlockCreation.framesBeforeNextThrowMax;
    }
Ejemplo n.º 5
0
 private void Awake()
 {
     PowerSlider   = GetComponent <PowerSlider>();
     BlockCreation = GetComponent <BlockCreation>();
 }