private void OnTriggerEnter2D(Collider2D collision) { //Debug.Log(collision.name); if (collision.name == "Goal") { TriggerGoal(); } else if (collision.name.Contains("Snowflake")) { Snowflake snowflake = collision.gameObject.GetComponent <Snowflake>(); TriggerSnowflake(snowflake.Color()); } }
private void OnTriggerEnter2D(Collider2D collision) { //Debug.Log(collision.name); if (collision.name == "Goal") { TriggerGoal(); } else if (collision.name.Contains("Snowflake")) { Snowflake snowflake = collision.gameObject.GetComponent <Snowflake>(); TriggerSnowflake(snowflake.Color()); } else if (collision.name == "FluffysPenguinDetector") { fluffy.gameObject.GetComponent <Fluffy>().FollowMe(); Destroy(collision); } }