Exemplo n.º 1
0
        public override void Initialize()
        {
            base.Initialize();

            Body.Mass = 65f;

            followingBehaviour = GetComponent <FollowingBehavior <BoarState> >();
            fleeingBehaviour   = GetComponentByName <FleeingBehavior <BoarState> >("fleeing");
            hitBehaviour       = GetComponentByName <HitBehavior <BoarState> >("beinghit");
            aiComponent.WithTrigger(FleeingTrigger).WithTrigger(FollowingTrigger);
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();

            Body.Mass = 3f;

            cohesionBehaviour   = GetComponent <CohesionBehavior <ChickenState> >();
            separationBehaviour = GetComponent <SeparationBehavior <ChickenState> >();
            velocityBehaviour   = GetComponent <VelocityMatchBehavior <ChickenState> >();

            followingBehaviour    = GetComponent <FollowingBehavior <ChickenState> >();
            fleeingBehaviour      = GetComponent <FleeingBehavior <ChickenState> >();
            playerFleeingBehavior = GetComponent <PlayerFleeingBehavior <ChickenState> >();
            aiComponent.WithTrigger(FleeingTrigger).WithTrigger(FollowingTrigger).WithTrigger(PlayerFleeingTrigger);

            cohesionBehaviour.TargetPositions   = proximitySensor.SensedEntities.Select((e) => e.Body.Position);
            separationBehaviour.TargetPositions = proximitySensor.SensedEntities.Select((e) => e.Body.Position);
            velocityBehaviour.TargetVelocities  = proximitySensor.SensedEntities.Select((e) => e.Body.LinearVelocity);
        }