void OnTriggerEnter(Collider col) { Multitag multiTagObject = col.gameObject.GetComponentInChildren <Multitag>(); if (multiTagObject != null) { bool isTagCollieder = col.gameObject.GetComponentInChildren <Multitag>().containsTagInList(bulletPC.tagsTrigger); if (gameObject != null) { Destroy(gameObject); } if (Time.time > startTime + startMagneticEffect && col.gameObject.GetComponent <Multitag>().ContainsTag("Player")) { Destroy(gameObject); } if (isTagCollieder && col.gameObject.GetComponentInChildren <LifeController>() != null) { LifeController targetLifeC = col.gameObject.GetComponentInChildren <LifeController>(); targetLifeC.TakeDamage(bulletPC.attack); Destroy(gameObject); } } }
private IEnumerator test() { while (this.enabled) { x = UnityEngine.Random.Range(0, 3); y = UnityEngine.Random.Range(0, 3); var array = new string[] { 'x' + x.ToString(), 'y' + y.ToString() }; Stopwatch stop = Stopwatch.StartNew(); var result = Multitag.FindGameObjectsWithTags(array, disjunctive).ToList(); // ToList to force execution stop.Stop(); var perf = "x: " + array[0] + ", y: " + array[1] + ", search time: " + stop.Elapsed.ToString(); print(perf); text.text = perf; foreach (var obj in Cubes) { obj.GetComponent <MeshRenderer>().enabled = false; } foreach (var obj in result) { obj.GetComponent <MeshRenderer>().enabled = true; } yield return(new WaitForSeconds(delay)); } }
void OnTriggerEnter(Collider col) { Multitag multiTagObject = col.gameObject.GetComponent <Multitag>(); if (multiTagObject != null && !collisionObjects.Contains(col.gameObject)) { collisionObjects.Add(col.gameObject); bool isTagCollieder = col.gameObject.GetComponent <Multitag>().containsTagInList(SwordSc.tagsTrigger); if (isTagCollieder && col.gameObject.GetComponentInChildren <LifeController>() != null) { LifeController targetLifeC = col.gameObject.GetComponentInChildren <LifeController>(); targetLifeC.TakeDamage(SwordSc.attack); } } }