void InitTriggers() { var collisions = GetComponentsInChildren <TriggerSensor>(); foreach (var collision in collisions) { switch (collision.name) { case "OrderCollision": orderCollision = collision; break; case "GetItemCollision": getItemCollision = collision; break; case "GlobalCollision": globalCollision = collision; break; } } orderCollision.OnDetected.AddListener(OnOrderCollision); getItemCollision.OnDetected.AddListener(OnGetItemCollision); globalCollision.OnDetected.AddListener(OnGlobalCollision); globalCollision.OnLostDetection.AddListener(OutGlobalCollision); }
void Awake() { m_animator = GetComponentInChildren <Animator>(); m_rigidbody = GetComponent <Rigidbody2D>(); forwordSensor = transform.Find("ForwordTriggerSensor").GetComponent <TriggerSensor>(); backSensor = transform.Find("BackTriggerSensor").GetComponent <TriggerSensor>(); groundSensor = transform.Find("GroundTriggerSensor").GetComponent <TriggerSensor>(); }
void Start() { pathFollower = GetComponent <PathFollower>(); carSensor = GetComponentInChildren <TriggerSensor>(); indicator = GetComponentInChildren <TextMesh>(); carSensor.OnLostDetection.AddListener(OnLost); }
public override void OnStart() { sensorGO = m_SensorSource.Value; sensor = sensorGO.GetComponent <TriggerSensor>(); if (sensor == null) { Debug.Log("Sensor not found"); return; } }
public override void UpdateCollider() { triggerSensor = skillControllerObj.GetComponent <TriggerSensor>(); //+triggerSensor.DetectedObjects.GetEnumerator(). iteratedTime += Time.deltaTime; if (iteratedTime >= triggerFrequency) { iteratedTime = 0; IEnumerator <GameObject> detectedEnemies = triggerSensor.DetectedObjects.GetEnumerator(); while (detectedEnemies.MoveNext()) { GameObject enemy = detectedEnemies.Current; SprayHit(enemy); Debug.Log("Update Collider "); } } }
public override void SkillSetup() { MeshCollider meshCollider = skillControllerObj.GetComponent <MeshCollider>(); triggerSensor = skillControllerObj.GetComponent <TriggerSensor>(); FOVCollider fovCollider = skillControllerObj.GetComponent <FOVCollider>(); fovCollider.Length = maxDistance; fovCollider.FOVAngle = sprayAngleWidth; fovCollider.ElevationAngle = sprayAngleHeight; triggerSensor.EnableTagFilter = true; triggerSensor.AllowedTags = colliderTags.ToArray(); triggerSensor.DetectionMode = SensorMode.RigidBodies; fovCollider.enabled = true; triggerSensor.enabled = true; meshCollider.enabled = true; }
public void Setup(LocalBlackboard localBlackboard, AttackRoot attackRoot) { _localBlackboard = localBlackboard; myCollider = _localBlackboard.healthCollider; _attackRoot = attackRoot; if (hitBox.TryGetComponent(out TriggerSensor temp)) { _triggerSensor = temp; _triggerSensor.Setup(this); } else { Debug.LogError(gameObject.name + " is missing a trigger sensor on it's hitbox. Add one or suffer the consequences O_O! ...x_x"); } if (TryGetComponent(out DamageOverTime temp2)) { _damageOverTime = temp2; _damageOverTime.Setup(_attackRoot); } }
public override void OnStart() { sensor = m_selfObject.Value.GetComponent <TriggerSensor>(); }
private void Update() { TriggerSensor sensor = GetComponent <TriggerSensor>(); }