public override void UpdatePosicao(Bola ball) { BolaWPF castedBall = (BolaWPF)ball; System.Windows.Controls.Canvas.SetLeft(castedBall.WpfShape, castedBall.X - castedBall.Raio); System.Windows.Controls.Canvas.SetTop(castedBall.WpfShape, castedBall.Y - castedBall.Raio); }
public void spawnarGeometria <Y>(int distanciaObjetoPlataforma, Vector2 inipos) { if (!typeof(Y).IsSubclassOf(typeof(Geometria))) { return; } inipos = plataforma_ref.transform.position; Vector3 position = inipos; //bounds.size.x/2 certo? float sizeT = plataforma_ref.GetComponent <SpriteRenderer>().bounds.size.x / 2; //pq trabalhar aqui com o spriteRenderer da plataforma? position.x = Random.Range(position.x - sizeT, position.x + sizeT); position.y = distanciaObjetoPlataforma; position.z = -1f; if (listaGeometria.Count > 0) { if (typeof(Y) == typeof(Bola)) { if (listaGeometria.OfType <Bola>().Any()) //pegar todos os elementos do tipo bola não é uma condição? { int index = listaGeometria.FindLastIndex(x => x.GetType() == typeof(Bola)); //aqui salva a posição na lista? Bola b = (Bola)listaGeometria[index]; listaGeometria.RemoveAt(index); b.transform.position = position; b.gameObject.SetActive(true); } } } }
void OnCollisionEnter(Collision col) { Bola bola = col.gameObject.GetComponent <Bola>(); if (bola != null) { float velx = 10 + (10 * Random.value) * ((Random.Range(0, 1) * 2 - 1)); float velz = 10 + (10 * Random.value) * ((Random.Range(0, 1) * 2 - 1)); Vector3 impulsoIni = new Vector3(velx, 0, velz); bola.transform.position = new Vector3(0f, (float)0.8, 0f); bola.GetComponent <Rigidbody>().velocity = Vector3.zero; bola.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; bola.GetComponent <Rigidbody>().AddForce(impulsoIni, ForceMode.Impulse); if (jugador == ePlayer.Right) { puntaje.puntaje2++; } else if (jugador == ePlayer.Left) { puntaje.puntaje1++; } } }
public static void Main(string[] args) { Bola cor = new Bola(); cor.trocaCor("azul"); Console.WriteLine(cor.mostraCor()); }
public void ColocarBolaEnPosicionInicial() { Bola bola = FindObjectOfType <Bola> (); bola.transform.position = posicionInicial.position; bola.transform.rotation = posicionInicial.rotation; bola.SetParametrosIniciales(); }
public void Rellenar() { for (int nb = 1; nb < 91; nb++) { Bola bola = new Bola(); bola.Numero = nb; Bolas.Add(bola); } }
public static void Main(string[] args) { Bola azul = new Bola("azul", 3.5f, "diamante"); azul.trocarCor("verde"); //Console.WriteLine(azul.getCor()); azul.mostrarCor(); }
public void testColor_Bola() { Bola bola = new Bola(); bola.trocaCor("Azul"); Assert.AreEqual("Azul", bola.mostraCor()); bola.trocaCor("Vermelho"); Assert.AreEqual("Vermelho", bola.mostraCor()); }
public void Countdown(Bola ball) { if (theBall == null) { theBall = ball; } StartCoroutine("DoCountdown"); }
public void incrementarPuntuacion() { punt++; if (punt % 5 == 0) { GameObject ob = GameObject.Find("Bola"); Bola b = (Bola)ob.GetComponent(typeof(Bola)); b.incrementarVelocidad(); } }
public void BolaDestruida(Bola bola) { if (HaSidoGanado) { juego.VolverAlOverworld(); } else { ColocarBolaEnPosicionInicial(); } }
private void Rellenar() { Random ramdom = new Random(DateTime.Now.Millisecond); do { Bola bola = new Bola(); int numAleatorio = ramdom.Next(1, 90); bola.Numero = numAleatorio; _bolas.Add(bola); } while (_bolas.Count < 15); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); bola = new Bola(Content, Vector2.One, new Vector2(0, 0), 100f); bola.Posicao = new Vector2((telaX - bola.Textura.Width), (telaY - bola.Textura.Height)) / 2; jogador1 = new Jogador(Content, Vector2.One, Vector2.Zero, 1000); jogador1.Posicao = new Vector2(0, (telaY - jogador1.Textura.Height) / 2); jogador2 = new Jogador(Content, Vector2.One, Vector2.Zero, 1000); jogador2.Posicao = new Vector2(telaX - jogador2.Textura.Width, (telaY - jogador2.Textura.Height) / 2); // TODO: use this.Content to load your game content here }
void OnCollisionEnter(Collision col) { //bola = new Bola (); if (col.gameObject.tag == "holes") { bola = new Bola(numero, color); //bola.Numero = numero; //bola.Color = color; //Debug.Log ("Soy la bola " + bola.Numero ); Destroy(gameObject); holeController.bolaEntronada(bola); } }
public Bola ElegirBola() { if (NumeroBolas <= 0) throw new ArgumentOutOfRangeException(); Random ramdom = new Random(DateTime.Now.Millisecond); Bola bola = new Bola(); do { int numAleatorio = ramdom.Next(1, 90); bola.Numero = numAleatorio; } while (!EstaBola(bola)); return bola; }
public static void Main(string[] args) { Bola bola = new Bola("Vermelha", "Ferro"); Console.Clear(); Console.WriteLine("A cor e o material são:"); Console.WriteLine(bola.getCor()); Console.WriteLine(bola.getMaterial()); bola.setCor("Azul"); Console.WriteLine("\nA cor nova é:"); Console.WriteLine(bola.getCor()); }
public bool TacharBola(Bola bola) { if (primera.Bolas.Contains(bola)) { primera.TacharBola(bola); return true; } if (segunda.Bolas.Contains(bola)) { segunda.TacharBola(bola); return true; } if (tercera.Bolas.Contains(bola)) { segunda.TacharBola(bola); return true; } return false; }
void OnCollisionEnter(Collision col) { if (!PhotonNetwork.IsMasterClient) { return; } Bola ball = col.gameObject.GetComponent <Bola>(); if (ball != null) { ball.transform.position = new Vector3(0f, 1f, 0f); if (player == ePlayer.Right) { score.scorePlayerLeft++; } else if (player == ePlayer.Left) { score.scorePlayerRight++; } } }
//public IList<IList<EspaçoNoCampo>> Campo { get; set; } public Jogo(IList<Jogador> jogadoresA, EsquemaTatico esquemaA, IList<Jogador> jogadoresB, EsquemaTatico esquemaB, Equipe posseDeBolaInicial) { ConfereSeTemosJogadoresDe1A11(jogadoresA); ConfereSeTemosJogadoresDe1A11(jogadoresB); JogadoresA = jogadoresA; JogadoresB = jogadoresB; _esquemaA = esquemaA; _esquemaB = esquemaB; _posseDeBola = posseDeBolaInicial; _equipeDaVez = posseDeBolaInicial; Bola = new Bola(); //Campo = GeraCampo(); PosicionaJogadores(); _sorte = new CoeficienteSorteAleatorio(); _motor = new Motor.Motor(_sorte); }
private void Rellenar(int posicion) { if (posicion == 1) { for (int ball = 1; _bolas.Count < 5; ball++) { Random ramdom = new Random(DateTime.Now.Millisecond); int numAleatorio = ramdom.Next(1, 30); Bola bola = new Bola(); bola.Numero = numAleatorio; _bolas.Add(bola); } } if (posicion == 2) { for (int ball = 1; _bolas.Count < 5; ball++) { Random ramdom = new Random(DateTime.Now.Millisecond); int numAleatorio = ramdom.Next(30,60); Bola bola = new Bola(); bola.Numero = numAleatorio; _bolas.Add(bola); } } if (posicion == 3) { for (int ball = 1; _bolas.Count < 5; ball++) { Random ramdom = new Random(DateTime.Now.Millisecond); int numAleatorio = ramdom.Next(60, 90); Bola bola = new Bola(); bola.Numero = numAleatorio; _bolas.Add(bola); } } }
private void Start() { bola = FindObjectOfType <Bola>(); offset = bola.transform.position.x - transform.position.x; }
private Controle() { robos = new Dictionary <string, Robo <Img, VtoERobo, EtoCRobo, VtoEBola, VtoECampo, PlaceToDraw> >(); bola = new Bola <Img, VtoEBola, PlaceToDraw>(); campo = new Campo <Img, VtoECampo, PlaceToDraw>(); }
/// <summary> /// This function is called when the object becomes enabled and active. /// </summary> void OnEnable() { instance_ = this; GetComponent <Rigidbody>().AddForce(0, 0, -1); }
public void spawnarGeometria <T>(int distanciaBolaPlataforma, Vector2 inicialPos) { if (!typeof(T).IsSubclassOf(typeof(Geometria)))//aqui verifica se o T é filho da geometria { return; } inicialPos = plataforma_ref.transform.position; Vector3 position = inicialPos; float sizeX = plataforma_ref.GetComponent <SpriteRenderer>().bounds.size.x / 2; position.x = Random.Range(position.x - sizeX, position.x + sizeX); position.y = distanciaBolaPlataforma; position.z = -1; if (poolGeometrias.Count > 0) //quando tiver q spawnar se tem objetos na pool, utilizar eles senão criar um novo { //não entrara neste if se não houver nada na pool if (typeof(T) == typeof(Bola)) { if (poolGeometrias.OfType <Bola>().Any()) //aqui o ofType é para pegar todos os elementos do tipo bola { int index = poolGeometrias.FindLastIndex(x => x.GetType() == typeof(Bola)); // salva a posição Bola b = (Bola)poolGeometrias[index]; poolGeometrias.RemoveAt(index); // retira da lista b.transform.position = position; //aqui acha a localização da bola b.gameObject.SetActive(true); } } else if (typeof(T) == typeof(Quadrado)) { if (poolGeometrias.OfType <Quadrado>().Any()) { int index = poolGeometrias.FindLastIndex(x => x.GetType() == typeof(Quadrado)); Quadrado b = (Quadrado)poolGeometrias[index]; poolGeometrias.RemoveAt(index); b.transform.position = position; b.gameObject.SetActive(true); } } else if (typeof(T) == typeof(Triangulo)) { if (poolGeometrias.OfType <Triangulo>().Any()) //aqui o ofType é para pegar todos os elementos do tipo bola { int index = poolGeometrias.FindLastIndex(x => x.GetType() == typeof(Triangulo)); // salva a posição Triangulo b = (Triangulo)poolGeometrias[index]; poolGeometrias.RemoveAt(index); // retira da lista b.transform.position = position; //aqui o position é onde o objeto sera spawnada b.gameObject.SetActive(true); } } } else { if (typeof(T) == typeof(Bola)) { Instantiate(bolaPrefab, position, Quaternion.identity); } else if (typeof(T) == typeof(Quadrado)) { Instantiate(quadradoPrefab, position, Quaternion.identity); } else if (typeof(T) == typeof(Triangulo)) { Instantiate(TrianguloPrefab, position, Quaternion.identity); } } }
public void bolaEntronada(Bola bola) { Debug.Log("Bola " + bola.Numero); }
public void TacharBola(Bola bola) { _bolas.Remove(bola); }
void Start() { bola = Bola.GetInstance().gameObject; posisiAwal = transform.position; }
private void Start() { ball = GetComponent <Bola>(); }
public bool EstaBola(Bola bola) { return Bolas.Contains(bola); }
public void MeterBola(Bola bola) { Bolas.Add(bola); }
public void SacarBola(Bola bola) { if (EstaBola(bola)) Bolas.Remove(bola); else throw new ArgumentOutOfRangeException("Out of Range Index"); }