示例#1
0
    private void UpdateObstacleTraits(MovingObstacle obstacle)
    {
        var spawn          = groundGenerator.GetSpawnLocation();
        var movingObstacle = obstacle.GetComponent <MovingObstacle>();
        var pos            = spawn.transform.position;

        //movingObstacle.transform.SetPositionAndRotation(spawn.transform.position, Quaternion.identity);
        //movingObstacle.gameObject.transform.position = spawn.transform.position;
        //movingObstacle.transform.position = new Vector3(0,0,0);
        movingObstacle.transform.position = pos;
        movingObstacle.Direction          = spawn.DestinationDirection;
        //Debug.Log($"{movingObstacle.Direction} {movingObstacle.transform.position}");
        movingObstacle.UpdateTraits();
    }
示例#2
0
 void Update()
 {
     scoreText.GetComponent <Text>().text     = "Score: " + score;
     highScoreText.GetComponent <Text>().text = "High Score: " + highScore;
     if (didCount == false && GetComponent <PlayerDeath>().dead == true)
     {
         StartCoroutine(scoreCounter());
         didCount = true;
     }
     if (score >= 10 && score < 30)
     {
         player.GetComponent <PlayerMovement>().maxSpeed = 21;
         Debug.Log("increased max speed to 21");
     }
     if (score >= 20 && score < 40)
     {
         foreach (GameObject MovingObstacle in movingObstacles)
         {
             MovingObstacle.GetComponent <ObstacleMovement>().moveSpeed = 4;
         }
     }
     if (score >= 30 && score < 50)
     {
         player.GetComponent <PlayerMovement>().maxSpeed = 22;
     }
     if (score >= 40 && score < 50)
     {
         foreach (GameObject MovingObstacle in movingObstacles)
         {
             MovingObstacle.GetComponent <ObstacleMovement>().moveSpeed = 6;
         }
     }
     if (score >= 50 && score < 70)
     {
         foreach (GameObject MovingObstacle in movingObstacles)
         {
             MovingObstacle.GetComponent <ObstacleMovement>().moveSpeed = 8;
         }
     }
     if (score >= 70)
     {
         player.GetComponent <PlayerMovement>().maxSpeed = 23;
     }
 }