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);
                }
            }
        }
    }
示例#3
0
    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++;
            }
        }
    }
示例#4
0
    public static void Main(string[] args)
    {
        Bola cor = new Bola();

        cor.trocaCor("azul");

        Console.WriteLine(cor.mostraCor());
    }
示例#5
0
    public void ColocarBolaEnPosicionInicial()
    {
        Bola bola = FindObjectOfType <Bola> ();

        bola.transform.position = posicionInicial.position;
        bola.transform.rotation = posicionInicial.rotation;
        bola.SetParametrosIniciales();
    }
示例#6
0
 public void Rellenar()
 {
     for (int nb = 1; nb < 91; nb++)
     {
         Bola bola = new Bola();
         bola.Numero = nb;
         Bolas.Add(bola);
     }
 }
示例#7
0
    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());
        }
示例#9
0
    public void Countdown(Bola ball)
    {
        if (theBall == null)
        {
            theBall = ball;
        }

        StartCoroutine("DoCountdown");
    }
示例#10
0
 public void incrementarPuntuacion()
 {
     punt++;
     if (punt % 5 == 0)
     {
         GameObject ob = GameObject.Find("Bola");
         Bola       b  = (Bola)ob.GetComponent(typeof(Bola));
         b.incrementarVelocidad();
     }
 }
示例#11
0
 public void BolaDestruida(Bola bola)
 {
     if (HaSidoGanado)
     {
         juego.VolverAlOverworld();
     }
     else
     {
         ColocarBolaEnPosicionInicial();
     }
 }
示例#12
0
 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);
 }
示例#13
0
 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
 }
示例#14
0
 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);
     }
 }
示例#15
0
 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;
 }
示例#16
0
    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());
    }
示例#17
0
 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;
 }
示例#18
0
    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++;
            }
        }
    }
示例#19
0
        //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);
        }
示例#20
0
 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);
         }
     }
 }
示例#21
0
 private void Start()
 {
     bola   = FindObjectOfType <Bola>();
     offset = bola.transform.position.x - transform.position.x;
 }
示例#22
0
 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>();
 }
示例#23
0
文件: Bola.cs 项目: falakh/SimpleHoky
    /// <summary>
    /// This function is called when the object becomes enabled and active.
    /// </summary>
    void OnEnable()
    {
        instance_ = this;

        GetComponent <Rigidbody>().AddForce(0, 0, -1);
    }
示例#24
0
    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);
 }
示例#26
0
 public void TacharBola(Bola bola)
 {
     _bolas.Remove(bola);
 }
示例#27
0
 void Start()
 {
     bola       = Bola.GetInstance().gameObject;
     posisiAwal = transform.position;
 }
示例#28
0
 private void Start()
 {
     ball = GetComponent <Bola>();
 }
示例#29
0
 public bool EstaBola(Bola bola)
 {
     return Bolas.Contains(bola);
 }
示例#30
0
 public void MeterBola(Bola bola)
 {
     Bolas.Add(bola);
 }
示例#31
0
 public void SacarBola(Bola bola)
 {
     if (EstaBola(bola)) Bolas.Remove(bola);
     else throw new ArgumentOutOfRangeException("Out of Range Index");
 }