コード例 #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (activatePoint.position.y < transform.position.y)
        {
            GameObject LeftWall;
            LeftWall                    = theOjectPool.GetWallObject();
            transform.position          = new Vector3(LeftWallPos, transform.position.y - 15f, 0f);
            LeftWall.transform.position = transform.position;
            //newWall.transform.rotation = transform.rotation;
            LeftWall.gameObject.layer = 8;
            LeftWall.tag = "wall";
            LeftWall.SetActive(true);


            GameObject RightWall;
            RightWall                    = theOjectPool.GetWallObject();
            transform.position           = new Vector3(RightWallPos, transform.position.y, 0f);
            RightWall.transform.position = transform.position;
            RightWall.layer              = 8;
            RightWall.tag                = "wall";
            RightWall.SetActive(true);


            if (ObstacleSpawn())
            {
                GameObject obstacle = theOjectPool.GetObstacleObject();

                transform.position = new Vector3(ObstaclePos, transform.position.y, 0f);

                obstacle.transform.position = transform.position;
                obstacle.transform.rotation = transform.rotation;
                obstacle.SetActive(true);
            }
        }
    }
コード例 #2
0
ファイル: Terrarium.cs プロジェクト: SGDaniels08/Puthids
 public void Draw()
 {
     TopWall.Draw();
     BottomWall.Draw();
     LeftWall.Draw();
     RightWall.Draw();
     Terrain.Draw();
 }
コード例 #3
0
ファイル: RightWall.cs プロジェクト: NakulSingh30/Tap-It-Up
 private void ChangeRightWallsColor()
 {
     RightWall[] array  = UnityEngine.Object.FindObjectsOfType <RightWall>();
     RightWall[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         RightWall rightWall = array2[i];
         rightWall.transform.parent.gameObject.GetComponent <SpriteRenderer>().color = RightWall.currentColor;
     }
 }
コード例 #4
0
    // Update is called once per frame
    void FixedUpdate()
    {
        RaycastHit hit;
        Ray        ray = new Ray(Camera.main.transform.position, (go_Player.transform.position - Camera.main.transform.position));

        LeftWall.SetActive(true);
        RightWall.SetActive(true);
        BottomWall.SetActive(true);
        TopWall.SetActive(true);


        if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask, QueryTriggerInteraction.Collide))
        {
            hit.transform.gameObject.SetActive(false);
        }
    }
コード例 #5
0
        public static void Write(CounterSettings settings)
        {
            var tiles = new HashSet <Tile>();

            var seed = new Seed(settings);

            tiles.UnionWith(seed.Tiles);

            var rightWall = new RightWall(settings);

            tiles.UnionWith(rightWall.Tiles);

            var leftWall = new LeftWall(settings);

            tiles.UnionWith(leftWall.Tiles);

            var rightTurn = new RightTurn(settings);

            tiles.UnionWith(rightTurn.Tiles);

            var rightPreReaderRightCarry = new PreReaderRight(settings, true);

            tiles.UnionWith(rightPreReaderRightCarry.Tiles);

            var rightPreReaderRightNoCarry = new PreReaderRight(settings, false);

            tiles.UnionWith(rightPreReaderRightNoCarry.Tiles);

            var leftPreReaderFirst = new PreReaderLeft(settings, true);

            tiles.UnionWith(leftPreReaderFirst.Tiles);


            var leftPreReaderNth = new PreReaderLeft(settings, false);

            tiles.UnionWith(leftPreReaderNth.Tiles);


            var readerTiles = AddReaders(settings.BinaryDigitPatterns, settings.BaseK);

            tiles.UnionWith(readerTiles);

            var hookTiles = AddHooks(settings.BinaryDigitPatterns);

            tiles.UnionWith(hookTiles);

            var writerTiles = AddWriters(settings.BinaryDigitPatterns, Convert.ToInt32(settings.StoppingValue));

            tiles.UnionWith(writerTiles);

            tiles.UnionWith(GetAllGadgets());

            var tileSetName = $"base-{settings.BaseK}-counter-to-{settings.StoppingValue}";
            var options     = new TdpOptions(tileSetName, seed.Start.Name);



            var path = Utils.GetPath();

            tiles = tiles.DistinctBy(t => t.Name).ToHashSet();

            WriteOptions($"{path}{tileSetName}.tdp", options);

            WriteDefinitions($"{path}{tileSetName}.tds", tiles);
        }
コード例 #6
0
ファイル: Layer.cs プロジェクト: jihaehan/YoutubeRPG
        public void LoadContent(Vector2 tileDimensions)
        {
            Image.LoadContent();
            if (Water.Path != String.Empty)
            {
                Water.LoadContent();
            }
            Vector2 position = -tileDimensions; //tileDimensions - new Vector2(128,128)

            foreach (string row in Tile.Row)
            {
                string[] split = row.Split(']');
                position.X  = -tileDimensions.X;
                position.Y += tileDimensions.Y;
                rowLength   = split.Length - 1;
                foreach (string s in split)
                {
                    if (s != String.Empty)
                    {
                        position.X += tileDimensions.X;
                        tilesCount.Add(TileCollision.Passive);

                        if (!s.Contains("x"))
                        {
                            Tile tile = new Tile();

                            string str    = s.Replace("[", String.Empty);
                            int    value1 = int.Parse(str.Substring(0, str.IndexOf(':')));
                            int    value2 = int.Parse(str.Substring(str.IndexOf(':') + 1));

                            //Set TileTypes
                            if (SolidTiles.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.Solid;
                            }
                            else if (RightWall.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.RightWall;
                            }
                            else if (TopWall.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.TopWall;
                            }
                            else if (BottomWall.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.BottomWall;
                            }
                            else if (BottomDoor.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.BottomDoor;
                            }
                            else if (SEWallCorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.SEWallCorner;
                            }
                            else if (SWWallCorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.SWWallCorner;
                            }
                            else if (NEWallCorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.NEWallCorner;
                            }
                            else if (NWWallCorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.NWWallCorner;
                            }
                            else if (RightHalf.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.RightHalf;
                            }
                            else if (LeftHalf.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.LeftHalf;
                            }
                            else if (SECorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.SECorner;
                            }
                            else if (SWCorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.SWCorner;
                            }
                            else if (NECorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.NECorner;
                            }
                            else if (NWCorner.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.NWCorner;
                            }
                            else if (BattleTiles.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.Battle;
                            }
                            else if (WaterTiles.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                tilesCount[tilesCount.Count() - 1] = TileCollision.Water;
                                Water.IsActive = true;
                            }
                            else if (NpcTiles.Contains("[" + value1.ToString() + ":" + value2.ToString() + "-"))
                            {
                                string[] p    = NpcTiles.Split(']');
                                string   name = String.Empty;
                                foreach (string pstr in p)
                                {
                                    if (pstr.Contains("[" + value1.ToString() + ":" + value2.ToString() + "-"))
                                    {
                                        name = pstr.Substring(pstr.IndexOf('-') + 1);
                                        tilesCount[tilesCount.Count() - 1] = TileCollision.NPC;
                                        Vector2 npcLocation = new Vector2((int)Math.Floor(position.X / tileDimensions.X),
                                                                          (int)Math.Floor(position.Y / tileDimensions.Y));
                                        npcTiles.Add(npcLocation, name);
                                        npcName.Add(name, npcLocation);
                                    }
                                }
                            }
                            else if (PortalTiles.Contains("[" + value1.ToString() + ":" + value2.ToString() + "-"))
                            {
                                string[] p      = PortalTiles.Split(']');
                                string   value3 = String.Empty;
                                foreach (string pstr in p)
                                {
                                    if (pstr.Contains("[" + value1.ToString() + ":" + value2.ToString() + "-"))
                                    {
                                        value3 = pstr.Substring(pstr.IndexOf('-') + 1);
                                        tilesCount[tilesCount.Count() - 1] = TileCollision.Portal;
                                        portalTiles.Add(new Vector2((int)Math.Floor(position.X / tileDimensions.X),
                                                                    (int)Math.Floor(position.Y / tileDimensions.Y)), value3);
                                    }
                                }
                            }

                            tile.LoadContent(position, new Rectangle(
                                                 (int)(value1 * tileDimensions.X), (int)(value2 * tileDimensions.Y),
                                                 (int)tileDimensions.X, (int)tileDimensions.Y), tilesCount[tilesCount.Count() - 1]);


                            if (OverlayTiles.Contains("[" + value1.ToString() + ":" + value2.ToString() + "]"))
                            {
                                overlayTiles.Add(tile);
                            }
                            else
                            {
                                underlayTiles.Add(tile);
                            }

                            tileLength = tile.SourceRect.Width;
                        }
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (Content == null)
                Content = new ContentManager(ScreenManager.Game.Services, "Content");

            //gameFont = Content.Load<SpriteFont>("gamefont");
            Football.LoadContent(Content);
            football.CalculateScale(); // need to call this after loading content.
            Stats.LoadContent(Content);
            background = Content.Load<Texture2D>("soccer field");

            // load high scores
            HighScoreScreen.LoadHighscore();

            // Bonus Object Load Content
            WindBonusObject.LoadContent(Content);
            RingBonusObject.LoadContent(Content);
            DoubleBonusObject.LoadContent(Content);
            TimeBonusObject.LoadContent(Content);
            //ringTexture = Content.Load<Texture2D>("ring");
            PatternStars.LoadContent(Content);
            //loading walls
            Wall leftWall = new LeftWall(null, this);
            Wall rightWall = new RightWall(null, this);
            Wall topWall = new TopWall(null, this);
            Wall bottomWall = new BottomWall(null, this);
            walls = new List<Wall>();
            walls.Add(leftWall); walls.Add(rightWall); walls.Add(topWall); walls.Add(bottomWall);

            InitializeBonusObjects();
            foreach (BonusObject bo in bonusObjects)
            {
                bo.CalculateScale();
            }

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            //Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }