Exemplo n.º 1
0
        public override CommandStub GenerateCommand(GameQuery_Command commandQuery)
        {
            Entity target    = commandQuery.ArenaState.Player;
            var    targetPos = target.TryGetPosition();

            if (this.lastPath == null || !this.EnemyOnPath(targetPos))
            {
                this.lastPath = Action_MoveTowardsEnemy.GeneratePath(commandQuery, targetPos);
            }
            return(this.MoveEventForPath(commandQuery, this.lastPath));
        }
Exemplo n.º 2
0
        private CommandStub MoveEventForPath(GameQuery_Command commandQuery, RogueSharp.Path path)
        {
            var commandPos = commandQuery.CommandEntity.TryGetPosition();
            var nextCell   = path.CurrentStep;

            if (path.CurrentStep != path.End)
            {
                path.StepForward();
            }

            return(new CommandStub_MoveSingle(commandQuery.CommandEntity.EntityID, nextCell.X - commandPos.X,
                                              nextCell.Y - commandPos.Y));
        }
Exemplo n.º 3
0
        public override CommandStub GenerateCommand(GameQuery_Command commandQuery)
        {
            Entity target    = commandQuery.FloorState.Player;
            var    targetPos = target.TryGetPosition();

            // TODO: Lol wtf
            if (commandQuery.CommandEntity.TryGetPosition().Z != targetPos.Z)
            {
                return(new CommandStub_Delay(commandQuery.CommandEntity.EntityID, Config.ONE));
            }

            if (this.lastPath == null || !this.EnemyOnPath(targetPos))
            {
                this.lastPath = Action_MoveTowardsEnemy.GeneratePath(commandQuery, targetPos);
            }
            return(this.MoveEventForPath(commandQuery, this.lastPath));
        }