Example #1
0
 private void ReceiveCollision(CollisionEventData data)
 {
     if (!_wanderingModule.IsControllingVelocity)
     {
         return;
     }
     _wanderingModule.SetSeedDirection(data.MainEntity.Velocity);
     _wanderingModule.RecalculateVelocity(data.MainEntity.Velocity.magnitude);
 }
Example #2
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);
    }