Beispiel #1
0
        protected void VincularAOutroObjeto(Objeto objeto)
        {
            if (ObjetoVinculado != null)
            {
                throw new Exception($"O objeto de representação {RepresentacaoVisual} e ID {ID} já está vinculado ao objeto de representação {ObjetoVinculado.RepresentacaoVisual} e ID {ObjetoVinculado.ID}!");
            }

            if (objeto.PosicaoX != PosicaoX || objeto.PosicaoY != PosicaoY)
            {
                throw new Exception("Os dois objetos devem estar na mesma posicao para poderem serem vinculados!");
            }

            ObjetoVinculado = objeto;
            if (objeto.ObjetoVinculado == null)
            {
                objeto.VincularAOutroObjeto(this);
                moverObjetoVinculado = new Thread(ObjetoVinculado.Mover);
                moverObjetoVinculado.Start();
            }
        }
Beispiel #2
0
 private void VoltarParaOLocalInicial()
 {
     Objetivo = this;
     IrAteObjetivo(true);
     Objetivo = null;
 }
Beispiel #3
0
 private void DevolverObjetoParaLocalInicial()
 {
     Objetivo = ObjetoVinculado;
     IrAteObjetivo(true, true);
 }
Beispiel #4
0
 private void VoltarComObjetoParaOGPontoDeEntrega()
 {
     Objetivo = BancoDeDados.PontoDeEntrega;
     IrAteObjetivo(utilizarCorredores: true);
 }