コード例 #1
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)));
    }
コード例 #2
0
ファイル: ChasingState.cs プロジェクト: IbraheemA/CircleGame
    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);
    }