public override void FinishUpdate(GameActor gameActor)
        {
            senseSet.Clear();

            if (gameActor.ThingBeingHeldByThisActor != null)
            {
                senseSet.Add(gameActor.ThingBeingHeldByThisActor, Vector3.Zero, 0f);
            }

            // Eating things also triggers the "got" sensor.
            senseSet.Add(gameActor.EatenSet);
        }
 public override void ThingUpdate(GameActor gameActor, GameThing gameThing, Vector3 direction, float range)
 {
     if (gameActor.ReadyToProcessEOP || gameThing.ReadyToProcessEOP)
     {
         senseSet.Add(gameThing, direction, range);
     }
 }
Esempio n. 3
0
        }   // end of StartUpdate()

        public override void ThingUpdate(GameActor gameActor, GameThing gameThing, Vector3 direction, float range)
        {
            // For each device check if the object is withing its sense space
            // and add it to the set if it is
            for (int indexDevice = 0; indexDevice < gameActor.ScanDevices.Count; ++indexDevice)
            {
                ScanDevice device = gameActor.ScanDevices[indexDevice];

                if (range < device.Range)
                {
                    float dot = Vector3.Dot(direction, device.WorldSpaceNormal);
                    if (dot > device.ArcCosine)
                    {
                        // Add object to scan set.
                        senseSet.Add(gameThing, direction, range);
                    }
                }
            }
        }   // end of ThingUpdate()
Esempio n. 4
0
        public override void ThingUpdate(GameActor gameActor, GameThing gameThing, Vector3 direction, float range)
        {
            CruiseMissile missile = gameThing as CruiseMissile;

            // don't test missiles we have launched
            if ((missile == null || missile.Launcher != gameActor) &&
                (gameThing.ActorHoldingThis != gameActor))
            {
                float hearingRange = gameActor.HearingRange;

                if (range < hearingRange)
                {
                    senseSet.Add(gameThing, direction, range);
                }
            }
            if (senseSet.Count == 0)
            {
                senseSet.Clear();
            }
        }
Esempio n. 5
0
        public override void FinishUpdate(GameActor gameActor)
        {
            if (terrainSensor != null)
            {
                //if (TouchEdit.HitInfo.TerrainHit)
                {
                    terrainSensor.OverrideSenseMaterial = TouchEdit.HitInfo.TerrainMaterial;
                }

                terrainSensor.FinishUpdate(gameActor);
            }
            else
            {
                if (TouchEdit.HitInfo.HaveActor)
                {
                    GameActor touchdActor = TouchEdit.HitInfo.ActorHit;

                    Vector3 actorCenter = Vector3.Transform(
                        gameActor.BoundingSphere.Center,
                        gameActor.Movement.LocalMatrix);

                    Vector3 thingCenter = Vector3.Transform(
                        touchdActor.BoundingSphere.Center,
                        touchdActor.Movement.LocalMatrix);

                    Vector3 direction = thingCenter - actorCenter;

                    float range = direction.Length();
                    if (range > 0.0f)
                    {
                        direction *= 1.0f / range; // Normalize.
                    }

                    SensorTarget target = SensorTargetSpares.Alloc();
                    target.Init(touchdActor, direction, range);
                    senseSet.AddOrFree(target);
                }

                senseSet.Add(NullActor.Instance, Vector3.Zero, float.MaxValue);
            }
        }
Esempio n. 6
0
        public override void ThingUpdate(GameActor gameActor, GameThing gameThing, Vector3 direction, float range)
        {
            if (gameThing.Classification.audioVolume != Classification.AudioVolume.Silent &&
                gameThing.Classification.audioVolume != Classification.AudioVolume.NotApplicable)
            {
                float normalizedRange = range;

                if (gameThing.Classification.audioVolume == Classification.AudioVolume.Loud)
                {
                    normalizedRange *= 0.66f;
                }
                else if (gameThing.Classification.audioVolume == Classification.AudioVolume.Soft)
                {
                    normalizedRange *= 1.33f;
                }
                // for each device check if the object is withing its sense space
                // and add it to the set if it is
                for (int indexDevice = 0; indexDevice < gameActor.HearingDevices.Count; ++indexDevice)
                {
                    HearingDevice device = gameActor.HearingDevices[indexDevice];

                    if (normalizedRange < device.range)
                    {
                        // calc device heading in world space
                        Vector3 deviceHeading = Vector3.TransformNormal(device.normal, gameActor.Movement.LocalMatrix);

                        // check the arc angle
                        float dot          = Vector3.Dot(direction, deviceHeading);
                        float angle        = (float)Math.Acos(dot);
                        float deviceRadius = device.arc / 2.0f;
                        if (angle < deviceRadius)
                        {
                            heardSet.Add(gameThing, direction, normalizedRange);
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        }   // end of StartUpdate()

        public override void ThingUpdate(GameActor gameActor, GameThing gameThing, Vector3 direction, float range)
        {
            // Add object to sight set.  Note, the line of sight visibility
            // test will be done as a seperate filter.
            sightSet.Add(gameThing, direction, range);
        }   // end of ThingUpdate()
 public override void FinishUpdate(GameActor gameActor)
 {
     senseSet.Add(gameActor.MissileHitSet);
 }