Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        SightTouchAspect aspectRef = other.GetComponent <SightTouchAspect>();

        if (aspectRef != null)
        {
            if (aspectRef.aspect == Aspect.AspectName.GovForce ||
                aspectRef.aspect == Aspect.AspectName.Hitman ||
                aspectRef.aspect == Aspect.AspectName.Islander ||
                aspectRef.aspect == Aspect.AspectName.Herbworm)
            {
                this.gameObject.SetActive(false);
                other.gameObject.SetActive(false);
                if (showDebug)
                {
                    Debug.Log(other.gameObject);
                }
            }
        }
        else if (other.tag.ToLower() == "obstacle" || other.tag.ToLower() == "wall")
        {
            this.gameObject.SetActive(false);
            if (showDebug)
            {
                Debug.Log(other.gameObject);
            }
        }
    }
Ejemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        SightTouchAspect aspectobj = other.GetComponent <SightTouchAspect>();

        if (aspectobj != null)
        {
            if (aspectobj.aspect == Aspect.AspectName.GovForce)
            {
                //Check if object is in Smoke
                if (ObjectsInSmoke.Count > 0)
                {
                    for (int i = 0; i < ObjectsInSmoke.Count; i++)
                    {
                        if (ObjectsInSmoke[i].gameObject != aspectobj.gameObject)
                        {
                            aspectobj.gameObject.GetComponent <GovForceFSM>().isVisionOn = false;
                            ObjectsInSmoke.Add(aspectobj);
                        }
                    }
                }
                else
                {
                    aspectobj.gameObject.GetComponent <GovForceFSM>().isVisionOn = false;
                    ObjectsInSmoke.Add(aspectobj);
                }
            }
        }
    }
Ejemplo n.º 3
0
 public GameObject GetFirstVisibleObject(Transform _transform, params Aspect.AspectName[] _aspects)
 {
     FieldOfVision(_transform);
     for (int i = 0; i < visibleTargets.Count; i++)
     {
         SightTouchAspect targetAspect = visibleTargets[i].GetComponent <SightTouchAspect>();
         //Check if visible object has aspect script
         if (targetAspect != null)
         {
             for (int j = 0; j < _aspects.Length; j++)
             {
                 if (targetAspect.aspect == _aspects[j])
                 {
                     return(visibleTargets[i]);
                 }
             }
         }
     }
     return(null);
 }
Ejemplo n.º 4
0
    private void OnTriggerExit(Collider other)
    {
        SightTouchAspect aspectobj = other.GetComponent <SightTouchAspect>();

        if (aspectobj != null)
        {
            if (aspectobj.aspect == Aspect.AspectName.GovForce)
            {
                //Check if Object is out of smoke
                for (int i = 0; i < ObjectsInSmoke.Count; i++)
                {
                    if (ObjectsInSmoke[i].gameObject == aspectobj.gameObject)
                    {
                        aspectobj.gameObject.GetComponent <GovForceFSM>().isVisionOn = true;
                        ObjectsInSmoke.Remove(aspectobj);
                    }
                }
            }
        }
    }