// Start is called before the first frame update void Start() { theFallingController = FindObjectOfType <FallingController>(); myRigidbody = GetComponent <Rigidbody2D>(); theRenderer = GetComponent <SpriteRenderer>(); scale = transform.localScale.x; }
// Start is called before the first frame update void Start() { roofSlowPos = FindObjectOfType <RoofSlow>(); theFallingController = FindObjectOfType <FallingController>(); whatElementInArrayX = rnd.Next(1, theFallingController.locationX.Length - 1); gameObject.transform.position = new Vector3(theFallingController.locationX[whatElementInArrayX].transform.position.x, gameObject.transform.position.y, 0); InvokeRepeating("changeY", 0f, 0.05f); //transform.Rotate(0, 0, rnd.Next(0,4) * 90); //changeColliderX = true; //changeColliderY = true; }
// Start is called before the first frame update void Start() { theFallingController = FindObjectOfType <FallingController>(); height.text = "Height: " + (Mathf.Round(theFallingController.highestPoint + 4) * 10).ToString(); coins.text = "Coins: " + (theFallingController.coins * 100).ToString(); theScore = (int)(Mathf.Round(theFallingController.highestPoint + 4) * 10) + theFallingController.coins * 100; score.text = "Score: " + (theScore).ToString(); if (theScore > PlayerPrefs.GetInt("HighScore")) { PlayerPrefs.SetInt("HighScore", theScore); } }
// Start is called before the first frame update void Start() { theFallingController = FindObjectOfType <FallingController>(); time.text = "Time: " + Mathf.Round(1 / Mathf.Round(theFallingController.endTime) * 150000).ToString(); height.text = "Height: " + (Mathf.Round(theFallingController.highestPoint + 4) * 50).ToString(); coins.text = "Coins: " + (theFallingController.coins * 100).ToString(); theScore = (int)((Mathf.Round(theFallingController.highestPoint + 4) * 10) + theFallingController.coins * 100 + Mathf.Round(1 / Mathf.Round(theFallingController.endTime) * 150000)); score.text = "Score: " + theScore.ToString(); onScreenScore.text = "Score: \r\n" + theScore.ToString(); if (theScore > PlayerPrefs.GetInt("HighScore")) { PlayerPrefs.SetInt("HighScore", theScore); } }
// Start is called before the first frame update void Start() { theFallingController = FindObjectOfType <FallingController>(); }
public void SetParent(FallingController falcon) { fallingControl = falcon; }
private void generateObstacle() { if (enemy.position.x > lastObstaclePosition + compoWidth / 2 || lastObstaclePosition < 0) { int prefabType = lastPrefab; while (prefabType == lastPrefab) { prefabType = Random.Range(0, obstaclePrefabs.Length); } lastPrefab = prefabType; GameObject obstacle = Instantiate(obstaclePrefabs[prefabType]); obstacle.transform.position = new Vector3(lastObstaclePosition + compoWidth, obstacle.transform.position.y, 0); for (int i = 0; i < obstacle.transform.childCount; i++) { Transform child = obstacle.transform.GetChild(i); FallingController fallingCtrl = child.gameObject.GetComponent <FallingController>(); if (fallingCtrl != null) { fallingCtrl.player = player; } DeleteAwayFromTarget awayTarget = child.gameObject.GetComponent <DeleteAwayFromTarget>(); if (awayTarget != null) { awayTarget.target = player; } if (child.tag == "Platform") { for (int j = 0; j < child.childCount; j++) { Transform subChild = child.GetChild(j); PlatformController platformCtrl = subChild.gameObject.GetComponent <PlatformController>(); if (platformCtrl != null) { platformCtrl.player = player; } } } } lastObstaclePosition = obstacle.transform.position.x; //generatePowerUps(obstacle.transform.position); } //if (obstacle.tag == "Platform") //{ // int morePlatforms = Random.Range(0, 5); // for (int i = 0; i < morePlatforms; i++) // { // obstacle = Instantiate(obstaclePrefabs[prefabType]); // obstacle.transform.position = new Vector3(player.position.x + 20 + (i + 1) * 12, Random.Range(minPlatformY, maxPlatformY), 0); // lastGeneratedPlatformX = obstacle.transform.position.x; // if (Random.Range(0, 1) < 0.5f) // { // generatePowerUps(new Vector3(obstacle.transform.position.x, obstacle.transform.position.y + 1, 0)); // } // } // lastGeneratedPlatformX = obstacle.transform.position.x; //} //} }