CompareTag() public method

public CompareTag ( string tag ) : bool
tag string
return bool
Example #1
0
 static public int CompareTag(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
         System.String         a1;
         checkType(l, 2, out a1);
         var ret = self.CompareTag(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int CompareTag(IntPtr l)
 {
     try {
         UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
         System.String         a1;
         checkType(l, 2, out a1);
         var ret = self.CompareTag(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #3
0
 static public int CompareTag(IntPtr l)
 {
     try{
         UnityEngine.Component self = (UnityEngine.Component)checkSelf(l);
         System.String         a1;
         checkType(l, 2, out a1);
         System.Boolean ret = self.CompareTag(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static int QPYX_CompareTag_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.Component QPYX_obj_YXQP = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L_YXQP, 1);
         string QPYX_arg0_YXQP = ToLua.CheckString(L_YXQP, 2);
         bool   QPYX_o_YXQP    = QPYX_obj_YXQP.CompareTag(QPYX_arg0_YXQP);
         LuaDLL.lua_pushboolean(L_YXQP, QPYX_o_YXQP);
         return(1);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Example #5
0
 static int CompareTag(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject(L, 1, typeof(UnityEngine.Component));
         string arg0 = ToLua.CheckString(L, 2);
         bool   o    = obj.CompareTag(arg0);
         LuaDLL.lua_pushboolean(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #6
0
 public static int CompareTag_wrap(long L)
 {
     try
     {
         long nThisPtr             = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Component obj = get_obj(nThisPtr);
         string arg0    = FCLibHelper.fc_get_string_a(L, 0);
         bool   ret     = obj.CompareTag(arg0);
         long   ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCLibHelper.fc_set_value_bool(ret_ptr, ret);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
Example #7
0
    static int CompareTag(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Component.CompareTag");
#endif
        try
        {
            ToLua.CheckArgsCount(L, 2);
            UnityEngine.Component obj = (UnityEngine.Component)ToLua.CheckObject <UnityEngine.Component>(L, 1);
            string arg0 = ToLua.CheckString(L, 2);
            bool   o    = obj.CompareTag(arg0);
            LuaDLL.lua_pushboolean(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #8
0
  void OnTriggerStay(Component component) {
    if (component.CompareTag("LevelPoint")) {
      GameManager.LevelCompleted = true;

      anim.SetBool("Attacking", false);
      anim.SetBool("Walking", true);

      if (transform.position.x < component.gameObject.transform.position.x) {
        GetComponent<Rigidbody>().velocity = new Vector3(0f, 1f, 0f);
        float step = 2f * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, component.gameObject.transform.position, step);
      } else {
        GetComponent<Rigidbody>().velocity = new Vector3(0f, 5f, 0f);
      }
    }
  }
Example #9
0
  void OnTriggerEnter(Component component) {
    if (component.CompareTag("CheckPoint")) {
      LastCheckPoint = component.gameObject;
      component.gameObject.SetActive(false);
    }

    if (component.CompareTag("ActionPoint")) {
      component.gameObject.SetActive(false);
    }

    if (component.CompareTag("BadTouch") || (component.CompareTag("Enemy") && !Attacking)) {
      Kill();
    }

    if (component.CompareTag("Fallable")) {
      GetComponent<Collider>().isTrigger = false;
      component.GetComponent<Fallable>().Fall();
    }

    if (component.CompareTag("Breakable")) {
      component.GetComponent<Breakable>().Break();
    }
  }
Example #10
0
 public static bool AreEnemies(Component c1, Component c2)
 {
     return !c1.CompareTag(c2.tag);
 }
Example #11
0
 void OnTriggerEnter(Component component) {
   if (component.CompareTag("Player") && Player.Attacking) {
     Break();
   }
 }
Example #12
0
 public bool Contains(Component component)
 {
     return (!component ? false : component.CompareTag(GameConstant.Tag.Info[this.tagNumber].tag));
 }
Example #13
0
 public override object FindDependency(Component comp, FieldInfo field)
 {
     if (SearchParents) {
         comp = comp.transform.root;
     }
     if (IsContainerType(field)) {
         List<GameObject> deps = new List<GameObject>();
         if (comp.CompareTag(Tag)) {
             deps.Add(comp.gameObject);
         }
         FindDependenciesInternal(comp.gameObject, deps);
         return CreateArrayOrList(field, deps);
     }
     if (comp.CompareTag(Tag)) {
         return ExtractComponent(comp.gameObject, field.FieldType);
     }
     GameObject dep = FindDependencyInternal(comp.gameObject);
     return ExtractComponent(dep, field.FieldType);
 }