// Todo: // Figure out that player.GetColor().Equals(ground.GetColor()); private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { SimplePlatformController2 player = other.GetComponent <SimplePlatformController2>(); if (player.GetColor().Equals("Blue") && player) { player.grounded = false; ground.GetComponent <BoxCollider2D>().isTrigger = true; } } }
private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { SimplePlatformController2 player = other.gameObject.GetComponent <SimplePlatformController2>(); if (player.GetColor().Equals("Red")) { Invoke("Fall", fallDelay); } //else if(player.GetColor().Equals("Blue")) //{ // player.grounded = false; // bc2d.isTrigger = true; //} //else //{ // Debug.Log("Else block Reached in Redground class"); //} } }
private void Awake() { player = playerObject.GetComponent <SimplePlatformController2>(); }