Beispiel #1
0
    void OnCollisionEnter(Collision collision)
    {
        PowerPelet pp   = collision.gameObject.GetComponent <PowerPelet>();
        Ghost      g    = collision.gameObject.GetComponent <Ghost>();
        LeftWall   wall = collision.gameObject.GetComponent <LeftWall>();

        if (pp)
        {
            speedMultiplier = 1.5f;
            StartCoroutine(ResetSpeedMultiplier());
            pp.gameObject.SetActive(false);
            Destroy(pp);
            AudioSource.PlayClipAtPoint(powerPeletSound, transform.position);
        }

        if (wall)
        {
            if (transform.position.z >= 1.0f || transform.position.z <= 1.0f) // if in bottom half or bottom half
            {
                transform.position = new Vector3(-63.3f, transform.position.y, transform.position.z);
            }
        }

        if (g)
        {
            /* g.gameObject.SetActive(false);
             * Destroy(g);*/
            transform.position = new Vector3(-30.8f, transform.position.y, 35.97f);
            movementSpeed      = 0;
            Debug.Log("collide with ghost");
        }
    }
Beispiel #2
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);
            }
        }
    }
Beispiel #3
0
 public void Draw(SpriteBatch spriteBatch)
 {
     UpperWall?.Draw(spriteBatch);
     LowerWall?.Draw(spriteBatch);
     LeftWall?.Draw(spriteBatch);
     RightWall?.Draw(spriteBatch);
 }
Beispiel #4
0
 public void Draw()
 {
     TopWall.Draw();
     BottomWall.Draw();
     LeftWall.Draw();
     RightWall.Draw();
     Terrain.Draw();
 }
Beispiel #5
0
 private void ChangeLeftWallsColor()
 {
     LeftWall[] array  = UnityEngine.Object.FindObjectsOfType <LeftWall>();
     LeftWall[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         LeftWall leftWall = array2[i];
         leftWall.transform.parent.gameObject.GetComponent <SpriteRenderer>().color = LeftWall.currentColor;
     }
 }
        private bool Move()
        {
            if (Character.CurrentState == Character.State.Jumping)
            {
                return(false);
            }
            if (Character.GroundCheck.Evaluate())
            {
                // We are on the ground!
                if (MoveInInputDirection())
                {
                    return(true);
                }
                float speed = Speed.GetDescendingValue();
                if (speed != 0f)
                {
                    MovementExecution.AddPosition(new Vector2((speed * (int)previousDirection) * Time.fixedDeltaTime, 0f));
                }
            }
            else if (Type == MovementType.GroundAndAir)
            {
                // We are in the air!
                switch (Character.Input.Dir)
                {
                case CharacterInput.Direction.Right:
                    if (RightWall.Evaluate())
                    {
                        return(false);
                    }
                    Character.CurrentState = Character.State.Moving;

                    /*
                     * // Reset speed if we were already moving in the opposite direction!
                     * if (Character.Rigidbody.velocity.x < 0f)
                     *  Speed.Reset();*/
                    Character.Rigidbody.velocity = new Vector2(Speed.GetAscendingValue(), Character.Rigidbody.velocity.y);
                    return(true);

                case CharacterInput.Direction.Left:
                    if (LeftWall.Evaluate())
                    {
                        return(false);
                    }
                    Character.CurrentState = Character.State.Moving;

                    /*
                     * // Reset speed if we were already moving in the opposite direction!
                     * if (Character.Rigidbody.velocity.x > 0f)
                     *  Speed.Reset();*/
                    Character.Rigidbody.velocity = new Vector2(-Speed.GetAscendingValue(), Character.Rigidbody.velocity.y);
                    return(true);

                default:
                    Character.CurrentState       = Character.State.Idle;
                    Character.Rigidbody.velocity = new Vector2(Speed.GetDescendingValue() * (int)previousDirection, Character.Rigidbody.velocity.y);
                    return(true);
                }
            }
            else
            {
                Character.CurrentState = Character.State.Idle;
            }
            return(false);
        }
Beispiel #7
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);
        }
        /// <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();
        }