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); ObjetoVinculado.ContinuarSeMovendo = true; moverObjetoVinculado.Start(); } }
private void VoltarParaOLocalInicial() { Objetivo = this; IrAteObjetivo(true); Objetivo = null; }
private void DevolverObjetoParaLocalInicial() { Objetivo = ObjetoVinculado; IrAteObjetivo(true, true); }
private void VoltarComObjetoParaOGPontoDeEntrega() { Objetivo = BancoDeDados.PontoDeEntrega; IrAteObjetivo(utilizarCorredores: true); }