//private void OnCollisionEnter2D(Collision2D collision) //{ // if (collision.collider.tag == "GroundSurface" || // collision.collider.tag == "Player") // canJump = true; //} private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == myColor.ToString()) { atExit = true; } if (collision.tag == "Teleporter") { this.transform.position = collision.GetComponent <Teleporter>().destination.transform.position; } }
private static string GetOwnedAddress(int level, CharacterColor color) { switch (level) { case 0: return($"Assets/Tileset/property-owned-{color.ToString().ToLower()}.asset"); case 1: // fall through case 2: return($"Assets/Tileset/property-level-{level + 1}-{color.ToString().ToLower()}.asset"); } return(DEFAULT_ADDRESS); // use as error asset for now }
private void SetCharacterColor(CharacterColor characterColor) { _characterColor = characterColor; Material mat = Resources.Load <Material>("Materials/" + _characterColor.ToString()); foreach (var renderer in _body.GetComponentsInChildren <Renderer>()) { renderer.material = mat; } }