/* VIRTUAL FUNCTIONS */
 //this function decides how the enemy detects the player, either scientist or swarm
 //sets
 public virtual void Awareness()
 {
     float mult = 1f;
     if(EnableLight && !Light.GetComponent<RoomLight>().turnedOn)
     {
         mult = sightDampen;
     }
     if (ScientistInSight(sightRange * mult, sightAngle))
     {
         currTarget = AttackTarget.scientist;
         currTargetPos = getScientistCenterPos();
         Debug.DrawRay(Scientist.S.transform.position, Vector3.up * 3f, Color.green);
     }
     else if(SwarmInSight(sightRange * mult, sightAngle))
     {
         currTarget = AttackTarget.swarm;
         currTargetPos = Swarm.S.transform.position;
         Debug.DrawRay(Swarm.S.transform.position, Vector3.up * 3f, Color.green);
     }
     else
     {
         currTarget = AttackTarget.none;
         currTargetPos = Vector3.zero;
     }
 }
Example #2
0
        static public bool checkAttackState(AttackTarget stateID, uint state)
        {
            if ((uint)stateID < uint.MaxValue)
            {
                return ((state & (uint)stateID) > 0);
            }

            return false;
        }
Example #3
0
 void Start()
 {
     enemiesInRange = new List<EnemyHealth> ();
     weapon = GetComponent<AttackTarget> ();
 }
Example #4
0
 static public void clearState(AttackTarget stateID, uint state)
 {
     if ((uint)stateID < uint.MaxValue)
     {
         state &= (byte)(~((byte)(1 << ((int)stateID % 8))));
     }
 }