Esempio n. 1
0
    public override void OnUpdate()
    {
        if (Time.timeSinceLevelLoad > m_nextCheck)
        {
            if (ZoneName == "noZone")
            {
                return; //TODO, check for No Zone.
            }
            bool IfSeenInZone = ZoneManager.IsHaveObject(MasterAI.GetComponent <AITaskManager>(), ZoneName);

            if (IfSeenInZone && !InvertIfSeenInZoneCondition)
            {
                Zone z = ZoneManager.GetZone(ZoneName);
                if (z != null)
                {
                    TargetTask.SetTargetObj(z.gameObject);
                    TriggerTransition();
                }
            }
            if (!IfSeenInZone && InvertIfSeenInZoneCondition)
            {
                Zone z = ZoneManager.GetZone(ZoneName);
                if (z != null)
                {
                    TargetTask.SetTargetObj(z.gameObject);
                    TriggerTransition();
                }
            }
            m_nextCheck += CHECK_INTERVAL;
        }
    }
Esempio n. 2
0
 public override void OnSight(Observable o)
 {
     if (false)
     {
         if (IfSeenInZone != "NONE")
         {
             bool  inZone = ZoneManager.IsPointInZone(o.transform.position, IfSeenInZone);
             float d      = Vector2.Distance(new Vector2(MasterAI.transform.position.x, MasterAI.transform.position.z),
                                             new Vector2(o.transform.position.x, o.transform.position.z));
             if (DistanceCriteria == TransitionDistanceCriteria.WITHIN_DISTANCE_OF && d < WithinDistance ||
                 DistanceCriteria == TransitionDistanceCriteria.OUTSIDE_DISTANCE_OF && d > WithinDistance)
             {
                 return;
             }
             if (inZone && !TriggerIfInZone)
             {
                 return;
             }
             if (!inZone && TriggerIfInZone)
             {
                 return;
             }
         }
         TargetTask.SetTargetObj(o.gameObject);
         TriggerTransition();
     }
 }
Esempio n. 3
0
 public override void OnSight(Observable o)
 {
     Debug.Log("On sight of : " + o);
     if (o.GetComponent<FactionHolder>() == null ||
         (IgnoreNeutral || o.GetComponent<FactionHolder>().Faction == FactionType.NEUTRAL))
         return;
     if (MasterAI.GetComponent<FactionHolder>().CanAttack(o.GetComponent<FactionHolder>().Faction))
     {
         Debug.Log("Faction is: " + o.GetComponent<FactionHolder>().Faction);
         float d = Vector2.Distance(new Vector2(MasterAI.transform.position.x, MasterAI.transform.position.z),
             new Vector2(o.transform.position.x, o.transform.position.z));
         if (IfSeenInZone != "NONE" && 
             (DistanceCriteria == TransitionDistanceCriteria.WITHIN_DISTANCE_OF && d < WithinDistance ||
             DistanceCriteria == TransitionDistanceCriteria.OUTSIDE_DISTANCE_OF && d > WithinDistance))
         {
             bool inZone = ZoneManager.IsPointInZone(o.transform.position, IfSeenInZone);
             if (inZone && InvertInZoneCondition)
             {
                 return;
             }
             if (!inZone && InvertInZoneCondition)
             {
                 return;
             }
         }
         TargetTask.SetTargetObj(o.gameObject);
         TriggerTransition();
     }
 }
Esempio n. 4
0
 public override void OnItemGet(Item i)
 {
     base.OnItemGet(i);
     if (i.name == PrefabOfItem.name)
     {
         TargetTask.SetTargetObj(i.gameObject);
         TriggerTransition();
     }
 }
Esempio n. 5
0
 public override void OnHit(HitInfo hb)
 {
     base.OnHit(hb);
     if (hb.Damage > DamageThreashould)
     {
         TargetTask.SetTargetObj(hb.mHitbox.gameObject);
         TriggerTransition();
     }
 }
Esempio n. 6
0
 public override void OnSight(Observable o)
 {
     if (o.GetComponent <Attackable> () &&
         MasterAI.GetComponent <Attackable> ().CanAttack(
             o.GetComponent <Attackable> ().Faction))
     {
         TargetTask.SetTargetObj(o.gameObject);
         //Debug.Log ("Triggering Transition");
         TriggerTransition();
     }
 }
Esempio n. 7
0
 public override void OnSight(Observable o)
 {
     if (o.GetComponent <LogicalObject>() && o.GetComponent <LogicalObject>().Label == ObjectSeen)
     {
         if (IfSeenInZone != "NONE")
         {
             bool inZone = ZoneManager.IsPointInZone(o.transform.position, IfSeenInZone);
             if (inZone && !TriggerIfInZone)
             {
                 return;
             }
             if (!inZone && TriggerIfInZone)
             {
                 return;
             }
         }
         TargetTask.SetTargetObj(o.gameObject);
         TriggerTransition();
     }
 }
Esempio n. 8
0
 public override void OnSight(Observable o)
 {
     Debug.Log("On sight of : " + o);
     if (o.GetComponent <Attackable>() && o.GetComponent <Attackable>().Faction == TriggeringFaction)
     {
         Debug.Log("Faction is: " + TriggeringFaction);
         if (IfSeenInZone != "NONE")
         {
             bool inZone = ZoneManager.IsPointInZone(o.transform.position, IfSeenInZone);
             if (inZone && InvertInZoneCondition)
             {
                 return;
             }
             if (!inZone && InvertInZoneCondition)
             {
                 return;
             }
         }
         TargetTask.SetTargetObj(o.gameObject);
         TriggerTransition();
     }
 }
Esempio n. 9
0
    public override void OnSight(Observable o)
    {
        Debug.Log("On sight of : " + o);
        if (ValidObject(o))
        {
            Debug.Log("Faction is: " + TriggeringFaction);
            float d = Vector2.Distance(new Vector2(MasterAI.transform.position.x, MasterAI.transform.position.z),
                                       new Vector2(o.transform.position.x, o.transform.position.z));
            if (DistanceCriteria == TransitionDistanceCriteria.WITHIN_DISTANCE_OF && d < Distance ||
                DistanceCriteria == TransitionDistanceCriteria.OUTSIDE_DISTANCE_OF && d > Distance)
            {
                return;
            }

            if (TargetZoneCondition != ZoneCondition.DO_NOT_CHECK_FOR_ZONE)
            {
                bool inZone = ZoneManager.IsPointInZone(o.transform.position, ZoneName);
                if ((!inZone && TargetZoneCondition != ZoneCondition.IF_TARGET_IN_ZONE) ||
                    (inZone && TargetZoneCondition != ZoneCondition.IF_TARGET_OUT_OF_ZONE))
                {
                    return;
                }
            }
            if (MyZoneCondition != MyZoneCondition.DO_NOT_CHECK_FOR_ZONE)
            {
                bool inZone = ZoneManager.IsPointInZone(MasterAI.transform.position, MyZoneName);
                if ((!inZone && MyZoneCondition != MyZoneCondition.I_AM_IN_ZONE) ||
                    (inZone && MyZoneCondition != MyZoneCondition.I_AM_OUT_OF_ZONE))
                {
                    return;
                }
            }
            TargetTask.SetTargetObj(o.gameObject);
            TriggerTransition();
        }
    }