void OnTriggerEnter2D(Collider2D other) { Debug.Log(other.tag); if (other.tag == "Sacrifice") { sacCon = other.GetComponent <SacrificeCon>(); gameCon.score += Mathf.FloorToInt(sacCon.scoreValue * gameCon.scoreMultiplyer); if (gameCon.cthuluMood + sacCon.moodValue <= 100) { gameCon.cthuluMood += sacCon.moodValue; } else { gameCon.cthuluMood = 100; } gameCon.scoreMultiplyer += gameCon.multiplyerIncrement; position = other.attachedRigidbody.position; position.z = -150; Instantiate(milk, position, rotation); if (!splashSource.isPlaying) { splashSource.Play(); } Destroy(other.gameObject); } }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Sacrifice") { SacrificeCon sacCon = other.GetComponent <SacrificeCon>(); Destroy(other.gameObject); if (gameCon.cthuluMood + sacCon.moodValue <= 100) { gameCon.cthuluMood += sacCon.moodValue * 2; } else { gameCon.cthuluMood = 100; } } }
void OnTriggerEnter2D(Collider2D other) { Debug.Log(other.tag); if (other.tag == "Sacrifice") { sacCon = other.GetComponent<SacrificeCon>(); gameCon.score += Mathf.FloorToInt(sacCon.scoreValue * gameCon.scoreMultiplyer); if (gameCon.cthuluMood + sacCon.moodValue <= 100) gameCon.cthuluMood += sacCon.moodValue; else gameCon.cthuluMood = 100; gameCon.scoreMultiplyer += gameCon.multiplyerIncrement; position = other.attachedRigidbody.position; position.z = -150; Instantiate (milk, position, rotation); if (!splashSource.isPlaying) { splashSource.Play (); } Destroy(other.gameObject); } }