void Start() { scorekp = GameObject.Find ("ScoreKeeper").GetComponent<scoreKeeper> (); float distance = this.transform.position.z - Camera.main.transform.position.z; Vector3 leftCam = Camera.main.ViewportToWorldPoint (new Vector3(0,0,distance)); Vector3 rightCam = Camera.main.ViewportToWorldPoint (new Vector3(1,1,distance)); min = leftCam; max = rightCam; }
void OnTriggerEnter(Collider otherCollider) { if (otherCollider == expectedCollider) { scoreKeeper scoreKeep = FindObjectOfType <scoreKeeper>(); scoreKeep.IncrementScore(scorePerHit); print("Second trigger triggered"); } }
void Start() { GetComponent <Rigidbody2D>().velocity = new Vector2(-14f, 0); p1Goal = GameObject.Find("P1Goal"); p2Goal = GameObject.Find("P2Goal"); p1Text = GameObject.Find("P1 Score").GetComponent <Text>(); totalP1Text = GameObject.Find("Total P1 Score").GetComponent <Text>(); p2Text = GameObject.Find("P2 Score").GetComponent <Text>(); totalP2Text = GameObject.Find("Total P2 Score").GetComponent <Text>(); ScoreKeeper = GameObject.Find("ScoreKeeper").GetComponent <scoreKeeper>(); }
// Use this for initialization void Start() { score = 0; scoreKeeper previousScore = FindObjectOfType <scoreKeeper> (); if (previousScore) { score = previousScore.score; Destroy(previousScore.gameObject); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { other.GetComponent <AudioSource>().Play(0); ScoreKeeper = other.gameObject.GetComponent <scoreKeeper>(); ScoreKeeper.addCoins(); Instantiate(prefabSFX, new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z), Quaternion.identity); coinUI.GetComponent <Animator>().Play("uiSpin", -1, 0f); Destroy(this.gameObject); } }
void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Player") { Debug.Log("Start"); scoreKeeper script = goScorer.GetComponent <scoreKeeper>(); GameObject parent = transform.parent.gameObject; script.Score(parent); Debug.Log("End"); } }
void Start() { keeper = FindObjectOfType <scoreKeeper>() ?? Instantiate(new scoreKeeper()); int highscore = getHighScore(); scoreText.text = $"score: {(int)keeper.score}"; if (keeper.score > highscore) { highscore = (int)keeper.score; saveHighScore(highscore); } highScoreText.text = $"high score: {highscore}"; }
void Start() { AddLayer(5); Debug.Log("start"); currentSpeed = initialFallSpeed; timePassed = 0; nextOffset = 0; multiplier = 1; keeper = FindObjectOfType <scoreKeeper>(); if (keeper == null) { var temp = Instantiate(new GameObject()); keeper = temp.AddComponent <scoreKeeper>(); } keeper.score = 0; }
// Use this for initialization void Start() { p1FinalText = GameObject.Find("P1 Final Score").GetComponent <Text>(); p2FinalText = GameObject.Find("P2 Final Score").GetComponent <Text>(); wonResult = GameObject.Find("Won").GetComponent <Text>(); ScoreKeeper = GameObject.Find("ScoreKeeper").GetComponent <scoreKeeper>(); p1FinalText.text += ScoreKeeper.Truep1Score.ToString(); p2FinalText.text += ScoreKeeper.Truep2Score.ToString(); if (ScoreKeeper.Truep1Score > ScoreKeeper.Truep2Score) { wonResult.text = "Player 1 is the winner"; } else if (ScoreKeeper.Truep2Score > ScoreKeeper.Truep1Score) { wonResult.text = "Player 2 is the winner"; } else if (ScoreKeeper.Truep1Score > ScoreKeeper.Truep2Score) { wonResult.text = "Draw"; } }
void OnCollisionEnter(Collision collision){ scoreKeeper scoreKeep = FindObjectOfType<scoreKeeper>(); scoreKeep.IncrementScore(scorePerHit); }
private void Start() { scoreKeeperScript = FindObjectOfType <scoreKeeper>(); }
// Use this for initialization void Start() { scoreText = GetComponent <Text> (); scoreDisplayed = FindObjectOfType <scoreKeeper>(); }
// Use this for initialization void Start() { playerRef = GameObject.Find("Player").GetComponent <scoreKeeper>(); }
private void Start() { scoreKeeperScript = FindObjectOfType <scoreKeeper>(); progressBar = gameObject.GetComponent <Image>(); }
void Start() { scoreKeeper = GameObject.FindObjectOfType <scoreKeeper>(); }
private void Start() { scoreKeeper = GameObject.Find("Score").GetComponent <scoreKeeper>(); }