void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { gameLevelManager.AddCoin(CoinValue); Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { levelManager.AddCoin(coinValue); transform.gameObject.SetActive(false); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { theLevelmanger.AddCoin(coinValue); //Destroy (gameObject); gameObject.SetActive(false); } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.CompareTag("Player")) { levelmanager.AddCoin(); levelmanager.coinCount--; Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { Debug.Log("金币" + Time.time.ToString()); manager.AddCoin(); Destroy(gameObject); Debug.Log("金币" + Time.time.ToString()); } }
void OnTriggerEnter2D(Collider2D other) { time2 = Time.time; if (other.tag == "Player" && time2 - time1 >= WaitBetweenBounce) { //t_LevelManager.soundSource.PlayOneShot (t_LevelManager.bumpSound); if (isActive) { m_Animator.SetTrigger("bounce"); if (timesToSpawn > 0) { if (isPowerupBlock) // spawn mushroom or fireflower depending on Mario's size { t_LevelManager.MarioPowerUp(); //Destroy(gameObject); /* * if (t_LevelManager.marioSize == 0) { * objectToSpawn = bigMushroom; * } else { * objectToSpawn = fireFlower; * } */ } if (isSelfDestroy) { t_LevelManager.MarioDies(); } if (isInvertGravity) { t_LevelManager.MarioInvertGravity(); } if (isRevertGravity) { t_LevelManager.MarioNormalGravity(); } if (isSlowDown) { t_LevelManager.MarioSlowDown(); } if (isSmallButFast) { t_LevelManager.MarioSmallButFast(); } if (isCoinOnly) { t_LevelManager.AddCoin(); } //Instantiate (objectToSpawn, transform.position + spawnPositionOffset, Quaternion.identity); timesToSpawn--; if (timesToSpawn == 0) { m_Animator.SetTrigger("deactivated"); isActive = false; } if (isInvertGravity) { Destroy(gameObject); } } } time1 = Time.time; } }
// Use this for initialization void Start() { t_LevelManager = FindObjectOfType <LevelManager> (); t_LevelManager.AddCoin(transform.position + Vector3.down); }