Exemple #1
0
        public ContextTurret()
        {
            ContextBehaviors.Add(Navigation = new NavigateToPoint(this)
            {
                BehaviorWeight = 0.00f
            });
            ContextBehaviors.Add(Efficiency = new Efficiency(this)
            {
                BehaviorWeight = 1f, MaximumAngle = MathF.PI / 4
            });
            ContextBehaviors.Add(Dodge0 = new Dodge(this)
            {
                LookAheadMS = 250, BehaviorWeight = 2
            });
            ContextBehaviors.Add(Dodge1 = new Dodge(this)
            {
                LookAheadMS = 500, BehaviorWeight = 2
            });
            ContextBehaviors.Add(Dodge2 = new Dodge(this)
            {
                LookAheadMS = 1000, BehaviorWeight = 2
            });
            ContextBehaviors.Add(Separation = new Separation(this)
            {
                LookAheadMS = 500, BehaviorWeight = 0f
            });
            ContextBehaviors.Add(StayInBounds = new StayInBounds(this)
            {
                LookAheadMS = 1000, BehaviorWeight = 1f
            });

            Navigation.TargetPoint = new Vector2(0, 0);
            Steps = 16;
        }
Exemple #2
0
    /// <summary>
    /// function called when the obj is created by the MooseManager in order to set all variables
    /// </summary>
    /// <param name="_cohW"></param>
    /// <param name="_sepW"></param>
    /// <param name="_aliW"></param>
    /// <param name="_sibW"></param>
    public void StartBehaviours(Bounds _movingBounds, float _padding, GameObject _predator)
    {
        cohesionInternal             = GetComponent <Cohesion>();
        cohesionInternal.weight      = coehVal.x;
        separationInternal           = GetComponent <Separation>();
        separationInternal.weight    = separVal.x;
        alignmentInternal            = GetComponent <Alignment>();
        alignmentInternal.weight     = aligVal.x;
        stayInBoundsInternal         = GetComponent <StayInBounds>();
        stayInBoundsInternal.weight  = stayInBVal.x;
        stayInBoundsInternal.bounds  = _movingBounds;
        stayInBoundsInternal.padding = _padding;
        constantSpeedInternal        = GetComponent <ConstantSpeed>();
        constantSpeedInternal.speed  = speed.x;
        fleeInternal        = GetComponent <Flee>();
        fleeInternal.evader = _predator.GetComponent <Vehicle>();



        GetComponent <Vehicle>().behaviours.Add(cohesionInternal);
        GetComponent <Vehicle>().behaviours.Add(separationInternal);
        GetComponent <Vehicle>().behaviours.Add(alignmentInternal);
        GetComponent <Vehicle>().behaviours.Add(stayInBoundsInternal);
        GetComponent <Vehicle>().behaviours.Add(constantSpeedInternal);
        GetComponent <Vehicle>().behaviours.Add(fleeInternal);

        fsm = GetComponent <FSM>();
        fsm.LoadState <FSMMooseWander>();
        fsm.LoadState <FSMMooseCauntion>();
        fsm.LoadState <FSMMooseRun>();
        fsm.ActivateState <FSMMooseWander>();
    }
Exemple #3
0
        public MadBot()
        {
            FleetTargeting     = new FleetTargeting(this);
            AbandonedTargeting = new AbandonedTargeting(this);
            FishTargeting      = new FishTargeting(this);
            ContextBehaviors.Add(Navigation = new NavigateToPoint(this)
            {
                BehaviorWeight = 1.0f
            });
            // Behaviors.Add(Efficiency = new Efficiency(this) { BehaviorWeight = 0.0f });
            // Behaviors.Add(Dodge0 = new Dodge(this) { LookAheadMS = 100, BehaviorWeight = 2 });
            // Behaviors.Add(Dodge1 = new Dodge(this) { LookAheadMS = 200, BehaviorWeight = 2 });
            // Behaviors.Add(Dodge2 = new Dodge(this) { LookAheadMS = 300, BehaviorWeight = 2 });
            for (int m = 000; m < 2000; m += 50)
            {
                ContextBehaviors.Add(new DogeWow(this)
                {
                    LookAheadMS = m + 50, BehaviorWeight = 1
                });
            }
            ContextBehaviors.Add(Separation = new Separation(this)
            {
                LookAheadMS = 500, BehaviorWeight = 2.0f
            });
            ContextBehaviors.Add(StayInBounds = new StayInBounds(this)
            {
                LookAheadMS = 1000, BehaviorWeight = 10f
            });

            Sensors.Add(SensorCTF = new SensorCTF(this));

            Navigation.TargetPoint = new Vector2(0, 0);
            Steps = 16;
        }
Exemple #4
0
        public CTFBot()
        {
            ContextBehaviors.Add(Navigation = new NavigateToPoint(this)
            {
                BehaviorWeight = 0.1f
            });
            ContextBehaviors.Add(Efficiency = new Efficiency(this)
            {
                BehaviorWeight = 0.1f
            });
            ContextBehaviors.Add(Dodge0 = new Dodge(this)
            {
                LookAheadMS = 250, BehaviorWeight = 2
            });
            ContextBehaviors.Add(Dodge1 = new Dodge(this)
            {
                LookAheadMS = 500, BehaviorWeight = 2
            });
            ContextBehaviors.Add(Dodge2 = new Dodge(this)
            {
                LookAheadMS = 1000, BehaviorWeight = 2
            });
            ContextBehaviors.Add(Separation = new Separation(this)
            {
                LookAheadMS = 500, BehaviorWeight = 0f
            });
            ContextBehaviors.Add(StayInBounds = new StayInBounds(this)
            {
                LookAheadMS = 200, BehaviorWeight = 0.3f
            });

            Sensors.Add(SensorCTF = new SensorCTF(this));

            Navigation.TargetPoint = Vector2.Zero;
            Steps = 16;
        }
 public override void DoInitialSubAbility(Ability ab)
 {
     stayInBounds = ab.Owner.GetComponent <StayInBounds>();
     stayInBounds?.SetStayInBounds(false);
     EndSubAbility();
 }
Exemple #6
0
 public void OnTriggerEnter2D(Collider2D col)
 {
     stayInBounds = col.GetComponent <StayInBounds>();
     stayInBounds?.SetUpBounds(boundaryCollider);
 }