Ejemplo n.º 1
0
 public ChaserController()
 {
     _targettingModule = new TargettingModule();
     _wanderingModule  = new WanderingModule();
     ConfigureDefault();
     _state = SelfTypeCreatorFactory <State> .Create <ChasingState>();
 }
Ejemplo n.º 2
0
 public void CopyConfigToModule(WanderingModule otherModule)
 {
     otherModule.FramesUntilStop         = FramesUntilStop;
     otherModule.StillFramesAfterStop    = StillFramesAfterStop;
     otherModule.WanderingFramesVariance = WanderingFramesVariance;
     otherModule.StartingCounter         = StartingCounter;
 }
Ejemplo n.º 3
0
 public abstract void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule);
Ejemplo n.º 4
0
    public override void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule)
    {
        Action <Entity> cmd = (!targettingModule.Target?.IsDead ?? false) ? Behaviours.MoveToTargetIfInRangeAndSight(entity, targettingModule.Target, controller.ChaseDistance) : null;

        if (cmd == null)
        {
            wanderingModule.ForceVelocity(entity.Velocity);
            wanderingModule.SetSeedDirection(UnityEngine.Vector2.zero);
            wanderingModule.SetCycleStage(WanderingModule.CycleStage.StopPoint, -50);
            controller.SetNextState(new ChaserWanderingState());
            return;
        }
        controller.IssueCommand(cmd);
    }
Ejemplo n.º 5
0
    public override void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule)
    {
        Entity target = targettingModule.SeekAndSetTarget(entity);

        if (target != null)
        {
            wanderingModule.IsControllingVelocity = false;
            wanderingModule.ResetCycle();
            controller.SetNextState(new ChasingState());
            return;
        }
        controller.IssueCommand(wanderingModule.CycleAndGetCommand(controller.WanderSpeedMultiplier * entity.GetStat(GameInfo.Stats.MoveSpeed)));
    }