Example #1
0
    // 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;
            }
        }
    }
Example #2
0
 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");
         //}
     }
 }
Example #3
0
 private void Awake()
 {
     player = playerObject.GetComponent <SimplePlatformController2>();
 }