public void onTriggerExitLight(Collider2D other) { //Debug.Log("Light Exit: " + other.name + " " + other.tag); runningAwayTimeout = 1.0f; CeilingLight lightsystem = other.GetComponentInParent <CeilingLight>(); lightsystem.MonsterProwing(false); }
public void onTriggerEnterLight(Collider2D other) { //Debug.Log("Light Enter: " + other.name + " " + other.tag); deadReckoning = false; pathing.enabled = true; runningFromLight = true; CeilingLight lightsystem = other.GetComponentInParent <CeilingLight>(); lightsystem.MonsterProwing(true); lightAwayDirection = (gameObject.transform.position - other.transform.position).normalized; pathing.speed = 0; }
private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.tag == "Player") { if (currTarget < target.Length - 1) { currTarget = lastTarget; } } else if (collision.gameObject.tag == "Light" && collision.isActiveAndEnabled) { CeilingLight lightsystem = collision.GetComponentInParent <CeilingLight>(); lightsystem.MonsterProwing(false); } }
private void OnTriggerEnter2D(Collider2D other) { if (prevCollider == null || prevCollider.gameObject.name != other.gameObject.name) { prevCollider = other; if (other.gameObject.tag == "Player") { lastTarget = currTarget; currTarget = 0; } else if (other.gameObject.tag == "Waypoint" && other.gameObject == target[currTarget].gameObject) { if (trailback > 0) { if (trailback == 1) { lastTarget = currTarget; currTarget += 2; if (currTarget >= target.Length) { currTarget = 1; } } else { lastTarget = currTarget; currTarget--; if (currTarget == 0) { currTarget = target.Length - 1; } } trailback--; } else { StartCoroutine(Wait()); } } else if (other.gameObject.tag == "Light") { Light otherlit = other.gameObject.GetComponent <Light>(); if (otherlit.enabled) { CeilingLight lightsystem = other.GetComponentInParent <CeilingLight>(); lightsystem.MonsterProwing(true); if (currTarget == lastTarget) { currTarget = Random.Range(1, target.Length - 1); } else { currTarget = lastTarget; } } } else if (other.gameObject.tag == "Untagged") { return; } else if (other.gameObject.tag != "Objects" && other.gameObject.tag != "Waypoint") { Debug.Log("Unknown " + other.gameObject.tag); lastTarget = lastTarget - 1; if (lastTarget == 0) { lastTarget = target.Length - 1; } currTarget -= 1; trailback = 2; } } }