Exemplo n.º 1
0
 public ChaserController()
 {
     _targettingModule = new TargettingModule();
     _wanderingModule  = new WanderingModule();
     ConfigureDefault();
     _state = SelfTypeCreatorFactory <State> .Create <ChasingState>();
 }
Exemplo n.º 2
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)));
    }
Exemplo n.º 3
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);
    }
Exemplo n.º 4
0
 public SlashController()
 {
     _targettingModule                     = new TargettingModule();
     _targettingModule.SeekRadius          = 2;
     _targettingModule.CheckEntityCallback = (callingEntity, entityBeingChecked) => {
         if (entityBeingChecked.IsDead)
         {
             return(false);
         }
         if (!Behaviours.CheckIfEntityInSight(callingEntity, entityBeingChecked))
         {
             return(false);
         }
         return(entityBeingChecked.Type == Entity.EntityType.Player);
     };
 }
Exemplo n.º 5
0
 public void CopyConfigToModule(TargettingModule otherModule)
 {
     otherModule.SeekRadius          = SeekRadius;
     otherModule.CheckEntityCallback = CheckEntityCallback;
 }
Exemplo n.º 6
0
 public abstract void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule);