Exemple #1
0
    void Move()
    {
        Vector3 position = Vector3.zero;

        if (direction == Direction.UP)
        {
            Dado bodyToMove = tail.Dequeue();
            bodyToMove.pixel.transform.position = tail.last.dado.pixel.transform.position + Vector3.up * 0.16f;
            tail.Enqueue(bodyToMove);
        }
        else if (direction == Direction.DOWN)
        {
            Dado bodyToMove = tail.Dequeue();
            bodyToMove.pixel.transform.position = tail.last.dado.pixel.transform.position + Vector3.down * 0.16f;
            tail.Enqueue(bodyToMove);
        }
        else if (direction == Direction.LEFT)
        {
            Dado bodyToMove = tail.Dequeue();
            bodyToMove.pixel.transform.position = tail.last.dado.pixel.transform.position + Vector3.left * 0.16f;
            tail.Enqueue(bodyToMove);
        }
        else if (direction == Direction.RIGHT)
        {
            Dado bodyToMove = tail.Dequeue();
            bodyToMove.pixel.transform.position = tail.last.dado.pixel.transform.position + Vector3.right * 0.16f;
            tail.Enqueue(bodyToMove);
        }
    }
Exemple #2
0
        public async Task Adicionar(ExecucaoDeAudio execucaoDeAudio)
        {
            if (StatusDaFila == EnumeradorDeStatusDaFila.Parada)
            {
                StatusDaFila = EnumeradorDeStatusDaFila.Executando;
                try
                {
                    await AoExecutarMusica?.Invoke(execucaoDeAudio);
                }
                catch
                {
                    await execucaoDeAudio.CommandContext.Message.DeleteOwnReactionAsync(DiscordEmoji.FromName(execucaoDeAudio.CommandContext.Client, ":arrows_counterclockwise:"));

                    await execucaoDeAudio.CommandContext.Message.CreateReactionAsync(DiscordEmoji.FromName(execucaoDeAudio.CommandContext.Client, ":thumbsdown:"));

                    Fila.Clear();
                    StatusDaFila = EnumeradorDeStatusDaFila.Parada;
                    await execucaoDeAudio.CommandContext.Message.RespondAsync(content : "Erro ao executar o comando, a fila de audios foi limpa");
                }
            }
            else
            {
                Fila.Enqueue(execucaoDeAudio);
            }
        }
Exemple #3
0
    void Start()
    {
        Dado sentinel = new Dado(Head[0]);

        tail = new Fila(sentinel);
        Vector2 pos = Head[0].transform.position;

        pos.x += 0.16f;
        GameObject pos1       = Instantiate(tailPrefab, pos, Quaternion.identity);
        Dado       auxiliary1 = new Dado(pos1);

        pos.x += 0.16f;
        GameObject pos2       = Instantiate(tailPrefab, pos, Quaternion.identity);
        Dado       auxiliary2 = new Dado(pos2);

        tail.Enqueue(auxiliary1);
        tail.Enqueue(auxiliary2);
        InvokeRepeating("Move", frameRate, frameRate);
    }
Exemple #4
0
 public void Inserir(Programa programa)
 {
     Fila.Enqueue(programa);
 }