protected override Personaje handleRequest(string request) { Esqueleto esqueleto = new Esqueleto("Esqueleto " + this.diferenciador); this.diferenciador += 1; return(esqueleto); }
// Use this for initialization void Start() { flecha = GetComponent <SpriteRenderer> (); esqueleto = FindObjectOfType(typeof(Esqueleto)) as Esqueleto; minotauro = FindObjectOfType(typeof(Minotauro)) as Minotauro; slime = FindObjectOfType(typeof(Slime)) as Slime; player = FindObjectOfType(typeof(Player)) as Player; }
private void Recrutamento(object sender, RoutedEventArgs e) { foreach (Castelo cast in JogadorAtual.Castelos) { //Acessa as casas cujo o jogador pode add persongens if (Map.casa[cast.Cordx, cast.Cordy].Personagem == null) {//chca se a casa esta vazia Personagem person = null; //Selecionar o personagem, usando o Radio Box switch (RecrutSelec) { case "Warrior": /* if (JogadorAtual.Gold < person.Custo_Gold) * { * radio.IsEnabled = false; * } * else * {*/ if (JogadorAtual.Aligment == "Order") { person = new Guerreiro(cast.Cordx, cast.Cordy); } else if (JogadorAtual.Aligment == "Chaos") { person = new Esqueleto(cast.Cordx, cast.Cordy); } // } break; case "Mage": if (JogadorAtual.Aligment == "Order") { person = new Mago(cast.Cordx, cast.Cordy); } else if (JogadorAtual.Aligment == "Chaos") { person = new Necromancer(cast.Cordx, cast.Cordy); } break; case "Archer": if (JogadorAtual.Aligment == "Order") { person = new Arqueiro(cast.Cordx, cast.Cordy); } else if (JogadorAtual.Aligment == "Chaos") { person = new Hunter(cast.Cordx, cast.Cordy); } break; } if (person != null) { if (JogadorAtual.Gold - person.Custo_Gold > 0) { JogadorAtual.Gold -= person.Custo_Gold; } else { person = null;//Checando se tem gold pra recrutar } } if (person != null) { person.CriarImagem();//Utiliza os metodos do Xaml (inicia o bitmap da imagem && coloca ele na imagem) person.PodeMover = false; person.Imagem.ContextFlyout = (FlyoutBase)this.Resources["PersonFly"]; FlyoutBase.SetAttachedFlyout(person.Imagem, (FlyoutBase)this.Resources["PersonFly"]); person.Imagem.Tapped += SelecionarPersonagem; person.Imagem.RightTapped += SelecionarPersonagemRightTapped; mapa.Children.Add(person.Imagem); //Adiciona no canvas Canvas.SetLeft(person.Imagem, cast.Cordx * 40); //posiciona Canvas.SetTop(person.Imagem, cast.Cordy * 40); Map.casa[cast.Cordx, cast.Cordy].Personagem = person; //add no back JogadorAtual.Personagens.Add(person); //add na lista do jogador break; } } } }
/*private void Explosion() * { * Instantiate(Blood, PuntoExplosion.transform.position, Quaternion.identity); * } */ private void OnTriggerEnter(Collider other) { Debug.Log("hit " + other.gameObject); if (other.gameObject.CompareTag("Enemy")) { // // Destroy(blood,2f); ID = other.GetComponent <Transform>(); int monster = EncuentraID(ID); switch (monster) { case 1: if (other.gameObject.GetComponentInParent <Ogro>().saludEnemigo > 1) { print("Ogro"); ogro = other.GetComponentInParent <Ogro>(); ogro.saludEnemigo -= 100f; print("Enemigo hit, salud:" + ogro.saludEnemigo.ToString()); ogro.barra_Salud.fillAmount = ogro.saludEnemigo / 100f; } { if (other.gameObject.GetComponentInParent <Ogro>().saludEnemigo <= 0) { Contador_Monedas.scoreValue += ogro.numMonedas; // this.GetComponent<SphereCollider>().enabled = false; other.GetComponentInParent <NavMeshControl>().enabled = false; other.GetComponentInParent <NavMeshAgent>().enabled = false; other.GetComponentInParent <Animator>().enabled = false; //Desactivo barra de salud ogro.barra_Salud.enabled = false; other.GetComponentInParent <DestroyRag>().isRagdoll = true; Destroy(other.gameObject); //Destroy(gameObject); } } break; case 2: if (other.gameObject.GetComponentInParent <Esqueleto>().saludEnemigo > 1) { print("Esqueleto"); Skeleton = other.GetComponentInParent <Esqueleto>(); Skeleton.saludEnemigo -= 100f; print("Enemigo hit, salud:" + Skeleton.saludEnemigo.ToString()); Skeleton.barra_Salud.fillAmount = Skeleton.saludEnemigo / 100f; } { if (other.gameObject.GetComponentInParent <Esqueleto>().saludEnemigo <= 0) { scoreValue += Skeleton.numMonedas; //this.GetComponent<SphereCollider>().enabled = false; other.GetComponentInParent <NavMeshControl>().enabled = false; other.GetComponentInParent <NavMeshAgent>().enabled = false; other.GetComponentInParent <Animator>().enabled = false; //Desactivo barra de salud Skeleton.barra_Salud.enabled = false; other.GetComponentInParent <DestroyRag>().isRagdoll = true; Destroy(other.gameObject); // Destroy(gameObject); } } break; case 3: if (other.gameObject.GetComponentInParent <Cabra>().saludEnemigo > 1) { print("Cabra"); cabra = other.GetComponentInParent <Cabra>(); cabra.saludEnemigo -= 100f; print("Enemigo hit, salud:" + cabra.saludEnemigo.ToString()); cabra.barra_Salud.fillAmount = cabra.saludEnemigo / 100f; } { if (other.gameObject.GetComponentInParent <Cabra>().saludEnemigo <= 0) { scoreValue += cabra.numMonedas; // this.GetComponent<SphereCollider>().enabled = false; other.GetComponentInParent <NavMeshControl>().enabled = false; other.GetComponentInParent <NavMeshAgent>().enabled = false; other.GetComponentInParent <Animator>().enabled = false; //Desactivo barra de salud cabra.barra_Salud.enabled = false; other.GetComponentInParent <DestroyRag>().isRagdoll = true; Destroy(other.gameObject); //Destroy(gameObject); } } break; case 4: if (other.gameObject.GetComponentInParent <Triton>().saludEnemigo > 1) { print("Triton"); triton = other.GetComponentInParent <Triton>(); triton.saludEnemigo -= 100f; print("Enemigo hit, salud:" + triton.saludEnemigo.ToString()); triton.barra_Salud.fillAmount = triton.saludEnemigo / 100f; } { if (other.gameObject.GetComponentInParent <Triton>().saludEnemigo <= 0) { scoreValue += triton.numMonedas; // this.GetComponent<SphereCollider>().enabled = false; other.GetComponentInParent <NavMeshControl>().enabled = false; other.GetComponentInParent <NavMeshAgent>().enabled = false; other.GetComponentInParent <Animator>().enabled = false; //Desactivo barra de salud triton.barra_Salud.enabled = false; other.GetComponentInParent <DestroyRag>().isRagdoll = true; Destroy(other.gameObject); // Destroy(gameObject); } } break; } } //E.numVidas--; }