示例#1
0
    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);
    }
示例#2
0
 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>();
 }
示例#3
0
    void Start()
    {
        pathFollower = GetComponent <PathFollower>();
        carSensor    = GetComponentInChildren <TriggerSensor>();
        indicator    = GetComponentInChildren <TextMesh>();

        carSensor.OnLostDetection.AddListener(OnLost);
    }
示例#4
0
        public override void OnStart()
        {
            sensorGO = m_SensorSource.Value;
            sensor   = sensorGO.GetComponent <TriggerSensor>();

            if (sensor == null)
            {
                Debug.Log("Sensor not found");
                return;
            }
        }
示例#5
0
 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 ");
         }
     }
 }
示例#6
0
    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;
    }
示例#7
0
    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);
        }
    }
示例#8
0
 public override void OnStart()
 {
     sensor = m_selfObject.Value.GetComponent <TriggerSensor>();
 }
 private void Update()
 {
     TriggerSensor sensor = GetComponent <TriggerSensor>();
 }