Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class BlueCollider : MonoBehaviour {
  6.     Collider2D m_Collider;
  7.  
  8.     public float width;
  9.  
  10.     void Start()
  11.     {
  12.         //Fetch the GameObject's Collider (make sure it has a Collider component)
  13.         m_Collider = GetComponent<Collider2D>();
  14.         width = GetComponent<BoxCollider2D>().size.x;
  15.     }
  16.  
  17.     void Update()
  18.     {
  19.         if (PlayerController.playerColor== 3)
  20.         {
  21.             //m_Collider.enabled = false;
  22.             m_Collider.isTrigger = true;
  23.  
  24.         }
  25.         else
  26.         {
  27.             //m_Collider.enabled = true;
  28.             m_Collider.isTrigger = false;
  29.  
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement