TrigEvent(GameObject other) { // if collid with body, according to https://www.youtube.com/watch?v=35lpSHgvibU if (other.CompareTag("Body")) { ArenaNode OtherNode = Utils.GetBottomLevelArenaNodeInGameObject(other); ArenaNode ThisNode = Utils.GetBottomLevelArenaNodeInGameObject(gameObject); List <int> ThisNodeCoordinate = ThisNode.GetCoordinate_ParentToChild(); List <int> OtherNodeCoordinate = OtherNode.GetCoordinate_ParentToChild(); if (!Utils.IsListEqual(ThisNodeCoordinate, OtherNodeCoordinate, Mathf.Min(ThisNodeCoordinate.Count, OtherNodeCoordinate.Count))) { ThisNode.Kill(); } } } // TrigEvent
TrigEvent(GameObject other) { if (TrigTags.Contains(other.tag)) { OtherNode = Utils.GetBottomLevelArenaNodeInGameObject(other); ThisNode = Utils.GetBottomLevelArenaNodeInGameObject(gameObject); ArenaNode SubjectNode; if (SubjectType == SubjectTypes.This) { SubjectNode = ThisNode; } else { SubjectNode = OtherNode; } if (SubjectNode == null) { return; } if (IsMatchNodeCoordinate) { if ((ThisNode == null) || (OtherNode == null)) { return; } else { List <int> ThisNodeCoordinate = ThisNode.GetCoordinate_ParentToChild(); List <int> OtherNodeCoordinate = OtherNode.GetCoordinate_ParentToChild(); if (!Utils.IsListEqual(ThisNodeCoordinate, OtherNodeCoordinate, Mathf.Min(ThisNodeCoordinate.Count, OtherNodeCoordinate.Count))) { return; } } } if (IsKill) { BeforeTrigKill(); SubjectNode.Kill(); } foreach (string Attribute_ in IncrementAttributes.Keys) { if (float.Parse(IncrementAttributes[Attribute_]) != 0f) { float Scale_ = 1f; if (CompareTag("Eatable")) { Scale_ = transform.localScale.y; } SubjectNode.IncrementAttribute(Attribute_, float.Parse(IncrementAttributes[Attribute_]) * Scale_); } } if (IsCarried) { ToFollow = other; RelativePosition = transform.position - ToFollow.transform.position; } } } // TrigEvent