// Use this for initialization
    void Start()
    {
        steeringBasics = GetComponent<SteeringBasics>();
        offsetPursuit = GetComponent<OffsetPursuit>();
        separation = GetComponent<Separation>();

        sensor = transform.Find("SeparationSensor").GetComponent<NearSensor>();
    }
Exemplo n.º 2
0
    void Start()
    {
        steeringBasics = GetComponent <SteeringBasics>();
        offsetPursuit  = GetComponent <OffsetPursuit>();
        separation     = GetComponent <Separation>();

        sensor = transform.Find("SeparationSensor").GetComponent <NearSensor>();
    }
Exemplo n.º 3
0
 public static Separation GetInstance()
 {
     if (instance == null)
     {
         instance = new Separation();
     }
     return(instance);
 }
Exemplo n.º 4
0
    void Start()
    {
        Separation separate = new Separation();

        separate.character = this;
        GameObject[] goBirds = GameObject.FindGameObjectsWithTag("bird");
        kBirds = new Kinematic[goBirds.Length - 1];
        int j = 0;

        for (int i = 0; i < goBirds.Length - 1; i++)
        {
            if (goBirds[i] == this)
            {
                continue;
            }
            kBirds[j++] = goBirds[i].GetComponent <Kinematic>();
        }
        separate.targets = kBirds;
        Arrive cohere = new Arrive();

        cohere.character = this;
        cohere.target    = myCohereTarget;
        LookWhereGoing myRotateType = new LookWhereGoing();

        myRotateType.character = this;

        mySteering                       = new BlendedSteering();
        mySteering.behaviors             = new BehaviorAndWeight[3];
        mySteering.behaviors[0]          = new BehaviorAndWeight();
        mySteering.behaviors[0].behavior = separate;
        mySteering.behaviors[0].weight   = 1f;
        mySteering.behaviors[1]          = new BehaviorAndWeight();
        mySteering.behaviors[1].behavior = cohere;
        mySteering.behaviors[1].weight   = 1f;
        mySteering.behaviors[2]          = new BehaviorAndWeight();
        mySteering.behaviors[2].behavior = myRotateType;
        mySteering.behaviors[2].weight   = 1f;

        ObstacleAvoidance myAvoid = new ObstacleAvoidance();

        myAvoid.character = this;
        myAvoid.target    = myCohereTarget;
        myAvoid.flee      = true;
        BlendedSteering myHighPrioritySteering = new BlendedSteering();

        myHighPrioritySteering.behaviors             = new BehaviorAndWeight[1];
        myHighPrioritySteering.behaviors[0]          = new BehaviorAndWeight();
        myHighPrioritySteering.behaviors[0].behavior = myAvoid;
        myHighPrioritySteering.behaviors[0].weight   = 1f;

        myAdvancedSteering           = new PrioritySteering();
        myAdvancedSteering.groups    = new BlendedSteering[2];
        myAdvancedSteering.groups[0] = new BlendedSteering();
        myAdvancedSteering.groups[0] = myHighPrioritySteering;
        myAdvancedSteering.groups[1] = new BlendedSteering();
        myAdvancedSteering.groups[1] = mySteering;
    }
Exemplo n.º 5
0
        public void Setup()
        {
            _separationConsoleLogger = Substitute.For <ISeparationConsoleLogger>();
            _separationXmlLogging    = Substitute.For <ISeparationXmlLogging>();
            _transponderReceiver     = Substitute.For <ITransponderReceiver>();
            _airspace = new Airspace(new Coordinates()
            {
                X = 10000, Y = 10000
            }, new Coordinates()
            {
                X = 90000, Y = 90000
            },
                                     500, 20000);
            _trackLogging               = Substitute.For <ITrackLogging>();
            _degreesCalculator          = new DegreesCalculatorWithoutDecimals();
            _velocityCalculator         = new VelocityCalculator();
            _airspaceMovementMonitoring =
                new AirspaceMovementMonitoring(_airspace, _velocityCalculator, _degreesCalculator, _trackLogging);
            _airspaceMonitoring        = new AirspaceMonitoring(_airspace, _airspaceMovementMonitoring);
            _transponderDataConversion = new TransponderDataConversion(_airspaceMonitoring);
            _separation       = new Separation(_separationXmlLogging, _separationConsoleLogger);
            _driver           = new TransponderDataReceiver(_transponderReceiver, _transponderDataConversion, _separation, _airspace);
            _planesInAirspace = new Dictionary <string, List <Track> >();

            _track1 = new Track()
            {
                Altitude = 10000,
                Position = new Coordinates()
                {
                    X = 12000,
                    Y = 12000
                },
                Tag       = "ABC987",
                TimeStamp = new DateTime(2013, 02, 20, 12, 15, 50, 840),
            };
            _track3 = new Track()
            {
                Altitude = 10000,
                Position = new Coordinates()
                {
                    X = 12000,
                    Y = 12000
                },
                Tag       = "ABC986",
                TimeStamp = new DateTime(2013, 02, 20, 12, 15, 50, 840),
            };


            _tracks1 = new List <Track>();
            _tracks1.Add(_track1);

            _airspace.PlanesInAirspace.Add("ABC987", _tracks1);
            _tracks2 = new List <Track>();
            _tracks2.Add(_track3);

            _airspace.PlanesInAirspace.Add("ABC986", _tracks2);
        }
Exemplo n.º 6
0
    // Start is called before the first frame update
    protected override void Start()
    {
        myRotateType           = new LookWhereYoureGoing();
        myRotateType.character = this;
        myRotateType.target    = target;

        myMoveType           = new Separation();
        myMoveType.character = this;
        myMoveType.targets   = targets;
    }
Exemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     separation = this.GetComponent <Separation>();
     arrive     = this.GetComponent <Arrive>();
     //align = this.GetComponent<Align>();
     velocityMatching = this.GetComponent <VelocityMatch>();
     velocityOutput   = new SteeringOutput();
     avoidance        = this.GetComponent <ObstacleAvoidance>();
     //m_droneGO.GetComponent<Rigidbody>().AddForce(new Vector3(Random.Range(0,50), Random.Range(0, 50), Random.Range(0, 50)),ForceMode.VelocityChange);
 }
    // Start is called before the first frame update
    void Start()
    {
        myMoveType           = new Separation();
        myMoveType.character = this;
        myMoveType.targets   = myTargets;

        myAlignRotateType           = new Align();
        myAlignRotateType.character = this;
        myAlignRotateType.target    = myTarget;
    }
Exemplo n.º 9
0
    // Start is called before the first frame update
    void Start()
    {
        myMoveType           = new Separation();
        myMoveType.character = this;
        myMoveType.targets   = targets;

        myRotateType           = new LookWhereGoing();
        myRotateType.character = this;
        myRotateType.target    = myTarget;
    }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        steeringBasics = GetComponent <SteeringBasics>();
        wander         = GetComponent <Wander2>();
        cohesion       = GetComponent <Cohesion>();
        separation     = GetComponent <Separation>();
        velocityMatch  = GetComponent <VelocityMatch>();

        sensor = transform.Find("Sensor").GetComponent <NearSensor>();
    }
Exemplo n.º 11
0
    //OJO! En el steering que sea que vaya a llamar de forma estática a esta función, se deberán ejecutar las dos siguientes lineas
    //   wanderOrientation += Flocking.UpdateWanderOrientation(wanderOrientation, wanderRate)
    //   wanderForce = Wander.GetSteering(npc, wanderForce, wanderCooldown, wanderRate, wanderOrientation, wanderCircleOffset, wanderCircleRadius, maxAccel, timeToTarget, visibleRays)
    //  Es por eso que trabajar con flocking de manera estática está desaconsejado
    public static Steering GetSteering(Agent npc, float groupArea, float decayCoefficient, float maxAccel, bool visibleRays, float timeToTarget, float wanderCooldown, float wanderRate, float wanderOrientation, float wanderCircleOffset, float wanderCircleRadius, Steering wanderForce, float cohesionPriority, float separationPriority, float alignmentPriority, float wanderPriority)
    {
        Steering steering = new Steering();

        steering.linear += Separation.GetSteering(npc, groupArea, decayCoefficient, maxAccel, visibleRays).linear *separationPriority;
        steering.linear += Cohesion.GetSteering(npc, groupArea, decayCoefficient, maxAccel, visibleRays).linear *cohesionPriority;
        steering.angular = Alignment.GetSteering(npc, groupArea, npc.interiorAngle, npc.exteriorAngle, timeToTarget, false).angular *alignmentPriority;
        steering        += Steering.ApplyPriority(wanderForce, wanderPriority);
        return(steering);
    }
Exemplo n.º 12
0
    void Awake( )
    {
        _boids      = new List <Boid>( );
        _alignment  = new Alignment( );
        _cohesion   = new Cohesion( );
        _separation = new Separation( );

        extractXmlValues(readDataStorageXml("dataStorage.xml"));
        //get the values of the flocking rules from the uiManager.
    }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        steeringBasics = GetComponent<SteeringBasics>();
        wander = GetComponent<Wander2>();
        cohesion = GetComponent<Cohesion>();
        separation = GetComponent<Separation>();
        velocityMatch = GetComponent<VelocityMatch>();

        sensor = transform.Find("Sensor").GetComponent<NearSensor>();
    }
 void Awake()
 {
     boids      = new List <Boid>();
     alignment  = new Alignment();
     cohesion   = new Cohesion();
     separation = new Separation();
     waypoint   = new FollowWaypoints();
     eatFood    = new EatFood();
     flee       = new Flee();
 }
Exemplo n.º 15
0
 public void Setup()
 {
     _atmLogEvent          = Substitute.For <IATMLogEvent>();
     _separation           = new Separation(_atmLogEvent);
     _trackEnteredAirspace = new TrackEnteredAirspace(_atmLogEvent);
     _trackLeftAirspace    = new TrackLeftAirspace(_atmLogEvent);
     _atmEventHandler      = new ATMEventHandler(new List <ATMWarning> {
         _separation
     }, new List <ATMNotification> {
         _trackEnteredAirspace, _trackLeftAirspace
     });
 }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     aligned    = new Align();
     looky      = new Look_Where_Going();
     facing     = new Face();
     pathFollow = new Path_Follow();
     seeking    = new Seek_And_Flee();
     separate   = new Separation();
     pursuing   = new Pursue();
     avoid      = new CollisionAvoidance();
     obstacles  = new Obstacle_Avoidance();
 }
Exemplo n.º 17
0
        public async Task <string> AddNewSeparation([FromBody] Separation separation)
        {
            var result = await _context.AddNewSeparationAsync(separation);

            if (result)
            {
                return(JsonConvert.SerializeObject(new { result }, ControllersServices.JsonSettings));
            }
            else
            {
                return(ControllersServices.ErrorMessage("Trouble with adding new Separation"));
            }
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;
            Console.SetWindowSize(200, 60);

            var trackFactory = new TrackFactory(TransponderReceiverFactory.CreateTransponderDataReceiver());
            var airspace     = new Airspace(trackFactory);
            var separation   = new Separation(airspace);

            new Output(trackFactory, airspace, separation);

            Console.ReadKey();
        }
        private IEnumerable <ISteeringEntity> CheckNearestFunc(Separation arg)
        {
            var entities = Core.Scene.Entities.EntitiesWithTag(123);
            var self     = arg.Entity;

            foreach (var entity in entities)
            {
                if (entity != self && Vector2.Distance(entity.Position, self.Position) <= arg.SeparationRadius)
                {
                    yield return(entity as ISteeringEntity);
                }
            }
        }
Exemplo n.º 20
0
        public void SubstractSeparationTest(double ra1, double dec1, double ra2, double dec2, double expectedRA, double expectedDec)
        {
            var coordinates = new Coordinates(ra1, dec1, Epoch.J2000, Coordinates.RAType.Degrees);
            var separation  = new Separation()
            {
                RA = Angle.ByDegree(ra2), Dec = Angle.ByDegree(dec2)
            };

            var sut = coordinates - separation;

            sut.RADegrees.Should().Be(expectedRA);
            sut.Dec.Should().Be(expectedDec);
        }
Exemplo n.º 21
0
    public static Steering GetSteering(Agent target, Agent npc, Vector3 behind, float slowingRadius, float maxAccel, float threshold, float decayCoefficient, bool visibleRays, float arrivePriority, float separationPriority, float evadePriority)
    {
        Steering steering = new Steering();

        steering.linear += Arrive.GetSteering(behind, npc, slowingRadius, maxAccel).linear *arrivePriority;
        steering.linear += Separation.GetSteering(npc, threshold, decayCoefficient, maxAccel, visibleRays).linear *separationPriority;
        if (OnLeaderSight(target, npc))
        {
            steering.linear += Evade.GetSteering(target, npc, maxAccel, Vector3.Distance(target.position, npc.position) * maxAccel, true).linear *evadePriority;
        }

        return(steering);
    }
Exemplo n.º 22
0
    void Start()
    {
        // Separate from other birds
        Separation separate = new Separation();

        separate.character = this;
        GameObject[] goBirds = GameObject.FindGameObjectsWithTag("bird");
        kBirds = new GameObject[goBirds.Length - 1];
        int j = 0;

        for (int i = 0; i < goBirds.Length - 1; i++)
        {
            if (goBirds[i] == this)
            {
                continue;
            }
            kBirds[j++] = goBirds[i];
        }
        separate.targets = kBirds;

        // Cohere to center of mass - ez mode
        Seek cohere = new Seek();

        cohere.character = this;
        cohere.target    = myCohereTarget;

        Pursue pursue = new Pursue();

        pursue.character = this;
        pursue.target    = myTarget;

        // look where center of mass is going - ez mode
        LookWhereGoing myRotateType = new LookWhereGoing();

        myRotateType.character = this;

        mySteering                       = new BlendedSteering();
        mySteering.behaviors             = new BehaviorAndWeight[4];
        mySteering.behaviors[0]          = new BehaviorAndWeight();
        mySteering.behaviors[0].behavior = separate;
        mySteering.behaviors[0].weight   = .2f;
        mySteering.behaviors[1]          = new BehaviorAndWeight();
        mySteering.behaviors[1].behavior = cohere;
        mySteering.behaviors[1].weight   = .3f;
        mySteering.behaviors[2]          = new BehaviorAndWeight();
        mySteering.behaviors[2].behavior = pursue;
        mySteering.behaviors[2].weight   = .5f;
        mySteering.behaviors[3]          = new BehaviorAndWeight();
        mySteering.behaviors[3].behavior = myRotateType;
        mySteering.behaviors[3].weight   = 1f;
    }
        public void EventHandler_Logging_SeparationNotActiveRaisedWithNotActive()
        {
            File.WriteAllText(@"ATMLogger.txt", "Cleared");
            var separation = new Separation();
            var atmEventHandler = new ATMEventHandler(new List<ATMWarning> { separation }, new List<ATMNotification> { _trackEnteredAirspace, _trackLeftAirspace });
            atmEventHandler.Handle(new List<IATMTransponderData> {new ATMTransponderData("F12",17650, 29874, 5000, "2015"),
                new ATMTransponderData("F15",17650, 29874, 5070, "2015")});
            atmEventHandler.Handle(new List<IATMTransponderData> {new ATMTransponderData("F12",17650, 29874, 5000, "2015"),
                new ATMTransponderData("F15",17150, 29274, 5700, "2015")});

            var fileConsistOurString = (File.ReadLines(@"ATMLogger.txt").Last()).Contains("Deactivated");

            Assert.True(fileConsistOurString);
        }
        public void EventHandler_Logging_CheckFileExists_ReturnTrue()
        {
            if (File.Exists("ATMLogger.txt"))
                File.Delete("ATMLogger.txt");
            var separation = new Separation();

            var atmEventHandler = new ATMEventHandler(new List<ATMWarning> { separation }, new List<ATMNotification> { _trackEnteredAirspace, _trackLeftAirspace });
            atmEventHandler.Handle(new List<IATMTransponderData> {new ATMTransponderData("F12",17650, 29874, 5000, "2015"),
                new ATMTransponderData("F15",17150, 29274, 5070, "2015")});
            atmEventHandler.Handle(new List<IATMTransponderData> {new ATMTransponderData("F12",17650, 29874, 5000, "2015"),
                new ATMTransponderData("F15",17150, 29274, 5200, "2015")});
            var fileExists = (File.Exists("ATMLogger.txt"));
            Assert.That(fileExists, Is.EqualTo(true));
        }
Exemplo n.º 25
0
        public void ToCivilStatusCodeType_P_ActiveSeparation_RegPartner(
            [Values('p', 'P')] char maritalStatus)
        {
            var personTotal = new PersonTotalStub()
            {
                MaritalStatus = maritalStatus
            };
            var separation = new Separation()
            {
                EndDate = null
            };
            var result = personTotal.ToCivilStatusCodeType(separation);

            Assert.AreEqual(CivilStatusKodeType.Separeret, result);
        }
Exemplo n.º 26
0
 public PushState(GameObject inv, List <Transition> trans)
 {
     //Store path following script from gameobject
     invocant      = inv;
     transitions   = trans;
     name          = "push";
     pathFollowing = invocant.GetComponent <GraphPathFollowing>();
     pathFollowing.astar_target = null;       //Set to null just in case
     changeCreationTime         = true;
     fear         = GameObject.Find("Monster_Fear").GetComponent <Agent>();
     separation   = GameObject.Find("Monster_Fear").GetComponent <Separation>();
     initialSpeed = fear.maxSpeed;
     message      = GameObject.Find("Evil Laugh");
     pushTime     = 4f;
 }
Exemplo n.º 27
0
        public void ToCivilStatusCodeType_G_InActiveSeparation_Married(
            [Values('g', 'G')] char maritalStatus)
        {
            var personTotal = new PersonTotalStub()
            {
                MaritalStatus = maritalStatus
            };
            var separation = new Separation()
            {
                EndDate = DateTime.Today
            };
            var result = personTotal.ToCivilStatusCodeType(separation);

            Assert.AreEqual(CivilStatusKodeType.Gift, result);
        }
Exemplo n.º 28
0
        public CivilStatusKodeType ToCivilStatusCodeType(Separation latestSeparation)
        {
            if (this.MaritalStatus.HasValue)
            {
                switch (this.MaritalStatus.ToString().ToUpper()[0])
                {
                case Schemas.Part.MaritalStatus.Unmarried:
                    return(CivilStatusKodeType.Ugift);

                case Schemas.Part.MaritalStatus.Married:
                    if (latestSeparation != null && !latestSeparation.EndDate.HasValue)
                    {
                        return(CivilStatusKodeType.Separeret);
                    }
                    else
                    {
                        return(CivilStatusKodeType.Gift);
                    }

                case Schemas.Part.MaritalStatus.Divorced:
                    return(CivilStatusKodeType.Skilt);

                case Schemas.Part.MaritalStatus.Widow:
                    return(CivilStatusKodeType.Enke);

                case Schemas.Part.MaritalStatus.RegisteredPartnership:
                    if (latestSeparation != null && !latestSeparation.EndDate.HasValue)
                    {
                        return(CivilStatusKodeType.Separeret);
                    }
                    else
                    {
                        return(CivilStatusKodeType.RegistreretPartner);
                    }

                case Schemas.Part.MaritalStatus.AbolitionOfRegisteredPartnership:
                    return(CivilStatusKodeType.OphaevetPartnerskab);

                case Schemas.Part.MaritalStatus.LongestLivingPartner:
                    return(CivilStatusKodeType.Laengstlevende);

                // TODO : Get value from latest marital status before this record. Also, match with other data sources like DPR
                case Schemas.Part.MaritalStatus.Deceased:
                    return(CivilStatusKodeType.Ugift);
                }
            }
            throw new NotSupportedException("Unknown marital status");
        }
Exemplo n.º 29
0
    // Use this for initialization
    void Start()
    {
        arrive     = new Arrival();
        aligned    = new Align();
        looky      = new Look_Where_Going();
        facing     = new Face();
        pathFollow = new Path_Follow();
        seeking    = new Seek_And_Flee();
        separate   = new Separation();
        pursuing   = new Pursue();
        avoid      = new CollisionAvoidance();
        obstacles  = new Obstacle_Avoidance();
        flocking   = new Blended_Steering();

        behaviors = new BehaviorAndWeight[4];
    }
Exemplo n.º 30
0
        public void Setup()
        {
            _uut            = new Separation(_atmLogEvent = Substitute.For <IATMLogEvent>());
            data1           = Substitute.For <IATMTransponderData>();
            data1.Tag       = "F12";
            data1.Timestamp = "20121103190132619";
            var coordinate = Substitute.For <IATMCoordinate>();

            coordinate.X     = 84;
            coordinate.Y     = 23;
            coordinate.Z     = 45;
            data1.Coordinate = coordinate;
            data2            = Substitute.For <IATMTransponderData>();
            data2.Tag        = "F15";
            data2.Timestamp  = "20121103190132621";
        }
Exemplo n.º 31
0
 // Update is called once per frame
 void Update()
 {
     velocity += Cohesion.getAffect(this, allBoids) * BoidConfig.Instance.cohesionStrength;
     velocity += Separation.getAffect(this, allBoids) * BoidConfig.Instance.separationStrength;
     velocity += Alignment.getAffect(this, allBoids) * BoidConfig.Instance.alignmentStrength;
     if (velocity.magnitude > BoidConfig.Instance.maxSpeed)
     {
         velocity = Vector3.Normalize(velocity) * BoidConfig.Instance.maxSpeed;
     }
     else if (velocity.magnitude < BoidConfig.Instance.minSpeed)
     {
         velocity = Vector3.Normalize(velocity) * BoidConfig.Instance.minSpeed;
     }
     transform.position += velocity * Time.deltaTime;
     transform.rotation  = Quaternion.LookRotation(velocity);
 }
Exemplo n.º 32
0
    void SeparationBehavior()
    {
        UpdatePositionRotation();

        Separation separation = new Separation();

        separation.character = this;
        separation.targets.Add(target);
        SteeringOutput separationSteering = separation.getSteering();

        if (separationSteering != null)
        {
            linearVelocity  += separationSteering.linear * Time.deltaTime;
            angularVelocity += separationSteering.angular * Time.deltaTime;
        }
    }
Exemplo n.º 33
0
 public override IEnumerator Enter(Machine owner, Brain controller)
 {
     mainMachine = owner;
     myBrain = controller;
     Legs myLegs = myBrain.legs;
     separation = new Separation(controller.allObjects);
     separation.Init(myLegs);
     random = new RandomWalk(1f, 1, 20);
     random.Init (myLegs);
     avoidWalls = new BoxAvoidance(controller.boxes, 3);
     avoidWalls.Init (myLegs);
     avoidWalls.setWeight(100);
     myLegs.addSteeringBehaviour(separation);
     myLegs.addSteeringBehaviour(random);
     myLegs.addSteeringBehaviour(avoidWalls);
     yield return null;
 }
Exemplo n.º 34
0
    // Start is called before the first frame update
    protected virtual void Start()
    {
        mySeek           = new Seek();
        mySeek.character = this;
        mySeek.target    = target;
        myFlee           = new Flee();
        myFlee.character = this;
        myFlee.target    = target;

        myArrv           = new Arrive();
        myArrv.character = this;
        myArrv.target    = target;

        myAlgn           = new Align();
        myAlgn.character = this;
        myAlgn.target    = target;

        myFace           = new Face();
        myFace.character = this;
        myFace.target    = target;

        myLWYG           = new LookWhereGoing();
        myLWYG.character = this;
        myLWYG.target    = target;

        myFPth           = new FollowPathDemo();
        myFPth.character = this;
        myFPth.path      = waypointList;

        mySepr           = new Separation();
        mySepr.character = this;

        myPrsu           = new Pursue();
        myPrsu.character = this;
        myPrsu.target    = target;

        myClAv           = new CollAvoid();
        myClAv.character = this;
        myClAv.targets   = collAvoidTargets;

        myObAv           = new ObstAvoid();
        myObAv.character = this;

        controlledSteeringUpdate = new SteeringOutput();
    }
Exemplo n.º 35
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public Behaviors()
 {
     Alignment = new Alignment();
     Arrive = new Arrive();
     Cohesion = new Cohesion();
     Evade = new Evade();
     Flee = new Flee();
     Hide = new Hide();
     Interpose = new Interpose();
     ObstacleAvoidance = new ObstacleAvoidance();
     OffsetPursuit = new OffsetPursuit();
     PathFollowing = new PathFollowing();
     Pursuit = new Pursuit();
     Seek = new Seek();
     Separation = new Separation();
     WallAvoidance = new WallAvoidance();
     Wander = new Wander();
 }
Exemplo n.º 36
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public Behaviors()
 {
     Alignment         = new Alignment();
     Arrive            = new Arrive();
     Cohesion          = new Cohesion();
     Evade             = new Evade();
     Flee              = new Flee();
     Hide              = new Hide();
     Interpose         = new Interpose();
     ObstacleAvoidance = new ObstacleAvoidance();
     OffsetPursuit     = new OffsetPursuit();
     PathFollowing     = new PathFollowing();
     Pursuit           = new Pursuit();
     Seek              = new Seek();
     Separation        = new Separation();
     WallAvoidance     = new WallAvoidance();
     Wander            = new Wander();
 }
Exemplo n.º 37
0
    Steering getDefaultSteering(Entry e, FormationManager generalManager, Flock flock)
    {
        var pattSteering = new PatternSteering(e.bird, generalManager);
        var separation = new Separation(e.bird, flock, 5.0f, -1f);
        separation.aknnApproxVal = 1.0;
        var obstacleAvoidance = new ObstacleAvoidance(e.bird, 20f, new string[]{"Ground"});

        var blended = new BlendedSteering[3];

        blended[0] = new BlendedSteering(e.bird, new BehaviorAndWeight(obstacleAvoidance, 1f));
        blended[1] = new BlendedSteering(e.bird, new BehaviorAndWeight(separation, 1f));
        blended[2] = new BlendedSteering(e.bird, new BehaviorAndWeight(pattSteering, 1f));

        return new PrioritySteering(1f, blended);
    }
Exemplo n.º 38
0
    Steering getDefaultSteering(Entry e, Flock flock)
    {
        var separation = new Separation(e.bird, flock, _separationDistance, -0.5f);
        var cohesion = new Cohesion(e.bird, flock, _cohesionDistance, -0.5f);
        var velMatch = new VelocityMatch(e.bird, flock, _velocityMatchDistance, -0.5f);

        var anchorCohesion = new Cohesion(e.bird, anchorFlock, float.MaxValue, -1f); // move towards the anchor
        var anchorSeparation = new Separation(e.bird, anchorFlock, 25f, -1f);
        var anchorVelocityMatch = new VelocityMatch(e.bird, anchorFlock, float.MaxValue, -1f);

        separation.aknnApproxVal = _separationAknnVal;
        cohesion.aknnApproxVal = _cohesionAknnVal;
        velMatch.aknnApproxVal = _velocityMatchAknnVal;

        separation.maxNeighborhoodSize = separationK;
        cohesion.maxNeighborhoodSize = cohesionK;
        velMatch.maxNeighborhoodSize = velocityMatchK;

        var obstacleAvoidance = new ObstacleAvoidance(e.bird, 20f, new string[]{"Ground"});

        var blended = new BlendedSteering[2];

        blended[0] = new BlendedSteering(e.bird, new BehaviorAndWeight(obstacleAvoidance, 1f));
        blended[1] = new BlendedSteering(e.bird, new BehaviorAndWeight(separation, _separationWeight), // 0
                                                 new BehaviorAndWeight(cohesion, _cohesionWeight), // 1
                                                 new BehaviorAndWeight(velMatch, _velocityMatchWeight), // 2
                                                 new BehaviorAndWeight(anchorCohesion, _cohesionToAnchorWeight), // 3
                                                 new BehaviorAndWeight(anchorSeparation, _separationFromAnchorWeight), // 4
                                                 new BehaviorAndWeight(anchorVelocityMatch, _velMatchToAnchorWeight) // 5
                                         );

        return new PrioritySteering(1f, blended);
    }
 public void Setup()
 {
     _uut = new Separation(_atmLogEvent = Substitute.For<IATMLogEvent>());
     data1 = Substitute.For<IATMTransponderData>();
     data1.Tag = "F12";
     data1.Timestamp = "20121103190132619";
     var coordinate = Substitute.For<IATMCoordinate>();
     coordinate.X = 84;
     coordinate.Y = 23;
     coordinate.Z = 45;
     data1.Coordinate = coordinate;
     data2 = Substitute.For<IATMTransponderData>();
     data2.Tag = "F15";
     data2.Timestamp = "20121103190132621";
 }
 public void Setup()
 {
     _atmLogEvent = Substitute.For<IATMLogEvent>();
     _separation = new Separation(_atmLogEvent);
     _trackEnteredAirspace = new TrackEnteredAirspace(_atmLogEvent);
     _trackLeftAirspace = new TrackLeftAirspace(_atmLogEvent);
     _atmEventHandler = new ATMEventHandler(new List<ATMWarning> { _separation }, new List<ATMNotification> { _trackEnteredAirspace, _trackLeftAirspace });
 }
Exemplo n.º 41
0
    Steering getDefaultSteering(Entry e)
    {
        e.bird.maxSpeed = 7.5f;

        (e.bird as Starling).transform.Find("Sphere").gameObject.SetActive(true);

        var obstacleAvoidance = new ObstacleAvoidance(e.bird, 20f, new string[]{"Ground"});
        var separation = new Separation(e.bird, flock, 5f, 0f);
        var cohesion = new Cohesion(e.bird, flock, 75f, 0f); cohesion.aknnApproxVal = 25f; cohesion.maxNeighborhoodSize = 15;
        var velMatch = new VelocityMatch(e.bird, flock, 20f, 0.0f); velMatch.aknnApproxVal = 50f;

        var bbox = new Bounds(new Vector3(1162, 113, 770), new Vector3(500, 150, 500));
        var wander = new SteeringBehaviors.Wander(e.bird, e.bird.maxSpeed, 30f, 50f, bbox);
        wander.theta = UnityEngine.Random.Range(0f, 360f);

        var blended = new BlendedSteering[3];

        blended[0] = new BlendedSteering(e.bird, new BehaviorAndWeight(obstacleAvoidance, 1f));
        blended[1] = new BlendedSteering(e.bird,
                                         new BehaviorAndWeight(separation, 1f));
        blended[2] = new BlendedSteering(e.bird, new BehaviorAndWeight(wander, 0.85f), // 0
                                                 new BehaviorAndWeight(cohesion, 0.90f),
                                                 new BehaviorAndWeight(velMatch, 0.50f));

        return new PrioritySteering(1f, blended);
    }
Exemplo n.º 42
0
    Steering getDefaultSteering2(Entry e)
    {
        e.bird.maxSpeed = 30f;

        (e.bird as Starling).transform.Find("Sphere").gameObject.SetActive(false);

        var separation = new Separation(e.bird, flock, 5f, -0.5f);
        var cohesion = new Cohesion(e.bird, flock, 30f, -0.5f);
        var velMatch = new VelocityMatch(e.bird, flock, 20f, -0.5f);

        var seek = new Cohesion(e.bird, anchorFlock, float.MaxValue, -1f); // move towards the anchor
        var flee = new Separation(e.bird, anchorFlock, 10f, -1f); // move towards the anchor

        separation.aknnApproxVal = 1.0;
        cohesion.aknnApproxVal = 1.0;
        velMatch.aknnApproxVal = 25.0;

        separation.maxNeighborhoodSize = 5;
        cohesion.maxNeighborhoodSize = 10;
        velMatch.maxNeighborhoodSize = 5;

        var obstacleAvoidance = new ObstacleAvoidance(e.bird, 20f, new string[]{"Ground"});

        var blended = new BlendedSteering[2];

        blended[0] = new BlendedSteering(e.bird, new BehaviorAndWeight(obstacleAvoidance, 1f));
        blended[1] = new BlendedSteering(e.bird, new BehaviorAndWeight(separation, 2f), // 0
                                         new BehaviorAndWeight(cohesion, 1f), // 1
                                         new BehaviorAndWeight(velMatch, 0.5f), // 2
                                         new BehaviorAndWeight(seek, 1.25f), // 3
                                         new BehaviorAndWeight(flee, 2f)
                                         );

        return new PrioritySteering(1f, blended);
    }
Exemplo n.º 43
0
 void Start()
 {
     separation = new Separation(flock.Flock);
 }