Ejemplo n.º 1
0
        private void GetAliens()
        {
            Aliens.Add(new Character()
            {
                personName = "Deviant",
                name       = "Thanos",
                universe   = "Terra 999",
                image      = "thanos_background"
            });

            Aliens.Add(new Character()
            {
                personName = "Kree",
                name       = "Ronan",
                universe   = "Terra 999",
                image      = "ronan_background"
            });

            Aliens.Add(new Character()
            {
                personName = "Skrull",
                name       = "Talos",
                universe   = "Terra 999",
                image      = "talos_background"
            });
        }
Ejemplo n.º 2
0
    void Update()
    {
        if (waitSpawnTime < Time.time)
        {
            waitSpawnTime = Time.time + UnityEngine.Random.Range(minIntervalTime, maxIntervalTime);
            SpawnAlien();
        }

        //if(Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Stationary)
        if (Input.GetMouseButtonDown(0))
        {
            //Debug.Log("Click");
            //Touch fakeTouch = new Touch();
            //fakeTouch.position = Input.mousePosition;
            RaycastHit hit;
            // Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);//fakeTouch, Input.GetTouch(0)
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 100f))
            {
                if (hit.transform.tag == "Alien")
                {
                    Aliens alien = hit.transform.GetComponent <Aliens>();
                    AlienBattle(alien.alienType);
                    //Debug.Log("Hit hit");
                }
                //Debug.Log("Hit");
            }
        }
    }
Ejemplo n.º 3
0
 private void LoadboxSelectionChanged(object sender, RoutedEventArgs e)
 {
     if (_loadBox.SelectedItem != null)
     {
         _loadedAlien = (Aliens)_loadBox.SelectedItem;
         _loadWindow.Close();
         LoadAlien();
     }
 }
Ejemplo n.º 4
0
        public IEnumerable <Personajes> getPersonaje()
        {
            //Creando los Enemigos por defecto
            Humanos flash          = new Humanos("flash", 'M', "USA");
            Humanos mujerMaravilla = new Humanos("mujerMaravilla", 'M', "USA");
            Aliens  superMan       = new Aliens("superMan", 'M', "Martes");
            Aliens  hulk           = new Aliens("hulk", 'M', "Martes");



            return(lista);
        }
Ejemplo n.º 5
0
    void SpawnAlien()
    {
        AlienType type   = (AlienType)(int)UnityEngine.Random.Range(0, Enum.GetValues(typeof(AlienType)).Length);
        float     newLat = tileManager.getLat + UnityEngine.Random.Range(-0.0007f, 0.0007f);
        float     newLon = tileManager.getLon + UnityEngine.Random.Range(-0.0007f, 0.0007f);

        Aliens prefab = Resources.Load("MapAlien/" + type.ToString(), typeof(Aliens)) as Aliens;
        Aliens alien  = Instantiate(prefab, Vector3.zero, Quaternion.identity) as Aliens;

        alien.tileManager = tileManager;
        alien.Init(newLat, newLon);

        aliens.Add(alien);
    }
Ejemplo n.º 6
0
        public IEnumerable <Personaje> getPersonaje()
        {
            Humanos      agregacion1 = new Humanos("agregar", " nuevaliga", "villano", "armamento", "armadura");
            Aliens       agregacion2 = new Aliens("agregar", " nuevaliga", "villano", "especie");
            Artificial   agregacion3 = new Artificial("agregar", " nuevaliga", "villano", "create");
            SuperHumanos agregacion4 = new SuperHumanos("agregar", " nuevaliga", "villano", "combinacion");

            personas.Add(agregacion1);
            personas.Add(agregacion2);
            personas.Add(agregacion3);
            personas.Add(agregacion4);

            return(personas);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///		Create one Alien
        /// </summary>
        /// <param name="alienName"></param>
        /// <param name="alienId"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="color"></param>
        private Aliens LoadIndividualAlien(GameObject.Name objectName, Sprite.Name spriteName, AlienName alienName, float x, float y)
        {
            // Aliens spawn on y differently depending on level
            int   currentLevel = GameSessionData.Active.Level;
            float yOffset      = (currentLevel % MaxDissent) * this.YGap;

            Aliens newAlien = new Aliens(alienName);

            newAlien.SetName(objectName);
            newAlien.SetPosition(x, y - yOffset);
            newAlien.SetColor(Colors.White);
            newAlien.Collider.Color = this.CollisonColor;
            newAlien.SetSprite(this.batchName, SpriteEntityManager.Self.Find(spriteName));
            GameObjectManager.Active.Attach(newAlien);
            return(newAlien);
        }
Ejemplo n.º 8
0
        private void LoadAlienRow(AlienName alienName, uint numOfAliens, float initX, float initY, float xSpacing, AlienCoordinator coordinator)
        {
            // Determine correct enum names
            GameObject.Name objectName = GameObject.Name.UNINITIALIZED;
            Sprite.Name     spriteName = Sprite.Name.UNINITIALIZED;
            switch (alienName)
            {
            case AlienName.Crab:
                objectName = GameObject.Name.AlienCrab;
                spriteName = Sprite.Name.AlienCrab;
                break;

            case AlienName.Squid:
                objectName = GameObject.Name.AlienSquid;
                spriteName = Sprite.Name.AlienSquid;
                break;

            case AlienName.Octopus:
                objectName = GameObject.Name.AlienOctopus;
                spriteName = Sprite.Name.AlienOctopus;
                break;

            default:
                break;
            }

            // Use a loop to create a row of aliens
            // Each "i" is a column
            for (uint i = 0; i < numOfAliens; i++)
            {
                Aliens alien = this.LoadIndividualAlien(objectName,
                                                        spriteName,
                                                        alienName,
                                                        initX + xSpacing * i,
                                                        initY
                                                        );
                coordinator.Columns[i].AddChild(alien);
            }
        }
Ejemplo n.º 9
0
 public AlienType(Aliens type, bool hasShield)
 {
     Type      = type;
     HasShield = hasShield;
 }
Ejemplo n.º 10
0
        public async override void GameLoop()
        {
            int   i;
            Label l;


            long time = DateTime.Now.Ticks;
            int  dt;

            Counter++;

            if (gameLoopRunning)
            {
                foreach (SpaceThing thing in Enemies)
                {
                    thing.Simulate(this);
                }
                foreach (Blastable debris in Debris)
                {
                    debris.Simulate(this);
                }
                foreach (Blastable bullet in Bullets)
                {
                    bullet.Simulate(this);
                }
                foreach (SpaceAlien a in Aliens)
                {
                    a.Simulate(this);
                }



                if (((Counter * 50000000 + 345) * (Counter + 55)) % 125 == 0)
                {
                    Aliens.Add(factory.BigAlien());
                }
                foreach (SpaceAlien a in Aliens)
                {
                    a.Shoot(this, Player.GetLocation());
                }

                CollideAsteroidsAliensBullets();



                await Task.Delay(1);

                //if (Counter == 3)
                //MessageBox.Show("hullo");

                PlayerTimer--;
                view.Children.Clear();


                foreach (Blastable thing in Enemies)
                {
                    thing.Draw(view);
                }
                foreach (Blastable debris in Debris)
                {
                    debris.Draw(view);
                }
                foreach (Blastable bullet in Bullets)
                {
                    bullet.Draw(view);
                }

                foreach (SpaceAlien a in Aliens)
                {
                    a.Draw(view);
                }

                l = new Label();


                l.Margin  = new Thickness(420, 280, 0, 0);
                l.Content = "ASTEROIDS";
                //l.FontStretch = FontStretches.ExtraCondensed;
                l.Foreground = Brushes.White;
                l.FontSize   = 100;
                //l.FontFamily = new FontFamily("");
                l.FontFamily  = new FontFamily("Lucida Console");
                l.FontStretch = FontStretches.ExtraCondensed;
                //l.FontWeight = FontWeights.Bold;


                view.Children.Add(l);



                l = new Label();


                l.Margin     = new Thickness(180, 80, 0, 0);
                l.Content    = "HIGH SCORES";
                l.Foreground = Brushes.White;
                l.FontSize   = 25;
                l.FontFamily = new FontFamily("Courier");

                //l.FontWeight = FontWeights.Bold;


                view.Children.Add(l);



                for (i = 0; i < 10; i++)
                {
                    l = new Label();


                    l.Margin     = new Thickness(190, 150 + i * 60, 0, 0);
                    l.Content    = Scores[i].ToString();
                    l.Foreground = Brushes.White;
                    l.FontSize   = 15;
                    l.FontFamily = new FontFamily("Courier");

                    l.FontWeight = FontWeights.Bold;


                    view.Children.Add(l);
                }



                //Player.Draw(view);

                HandleBlasts();
            }


            //if (Counter > 50)
            //MessageBox.Show(time + "");
            await Task.Delay(1);

            time = DateTime.Now.Ticks - time;
            dt   = 60 - (int)(time / 10000);
            if (dt > 0)
            {
                await Task.Delay(60 - (int)(time / 10000));
            }
            if (Enemies.Count < 1)
            {
                StartLevel(7);
            }



            if (!stopped)
            {
                GameLoop();
            }
        }
Ejemplo n.º 11
0
        private void btSave_Click(object sender, RoutedEventArgs e)
        {
            using (var context = new Db1Entities())
            {
                var dbAlien = new Aliens
                {
                    Name                   = TbName.Text,
                    chemicalBasis          = CbChemicalBasis.SelectedValue.ToString(),
                    LandOrWater            = CbLandOrWater.SelectedValue.ToString(),
                    LandHabitat            = CbLandHabitat.SelectedValue.ToString(),
                    WaterHabitat           = CbWaterHabitat.SelectedValue.ToString(),
                    TrophicDiet            = CbThrophicDiet.SelectedValue.ToString(),
                    PrimaryLocomotion      = CbPrimaryLocomotion.SelectedValue.ToString(),
                    SecondaryLocomotion    = CbSecondaryLocomotion.SelectedValue.ToString(),
                    hasSecondaryLocomotuib = CheckHasSecondaryLocmotion.IsChecked,
                    Gravity                = null,
                    SizeClass              = CbSizeClass.SelectedValue.ToString(),
                    Size                   = double.Parse(CbSize.Text),
                    Symmetry               = CbSymmetry.SelectedValue.ToString(),
                    Sides                  = int.Parse(CbSides.Text),
                    LimbSegments           = int.Parse(CbLimbSegments.Text),
                    Tail                   = CbTails.SelectedValue.ToString(),
                    Manipulators           = int.Parse(CbManipulators.Text),
                    Skeleton               = CbSkeleton.SelectedValue.ToString(),
                    SkinClass              = CbSkinClass.SelectedValue.ToString(),
                    Skin                   = CbSkin.SelectedValue.ToString(),
                    Breathing              = CbBreathing.SelectedValue.ToString(),
                    Temperatur             = CbTemperture.SelectedValue.ToString(),
                    Growth                 = CbGrowthRate.SelectedValue.ToString(),
                    Sex                = CbSexes.SelectedValue.ToString(),
                    Gestation          = CbGestation.SelectedValue.ToString(),
                    Strategy           = CbStrategy.SelectedValue.ToString(),
                    OffspringCount     = int.Parse(CbOffspringCount.Text),
                    PrimarySense       = CbPrimarySense.SelectedValue.ToString(),
                    Vision             = CbVision.SelectedValue.ToString(),
                    Hearing            = CbHearing.SelectedValue.ToString(),
                    Touch              = CbTouch.SelectedValue.ToString(),
                    TasteSmell         = CbTasteSmell.SelectedValue.ToString(),
                    Intelligence       = CbIntelligence.SelectedValue.ToString(),
                    IntelligenceValue  = int.Parse(CbIntelligenceValue.Text),
                    MatingBehaviour    = CbMatingBehaviour.SelectedValue.ToString(),
                    SocialOrganization = CbSocialOrganization.SelectedValue.ToString(),
                    SocialGroupSize    = int.Parse(CbSocialGroupSize.Text),
                    Concentration      = CbConcentration.SelectedValue.ToString(),
                    Curiosity          = CbCuriosity.SelectedValue.ToString(),
                    Egoism             = CbEgoism.SelectedValue.ToString(),
                    Empathy            = CbEmpathy.SelectedValue.ToString(),
                    Gegariousness      = CbGegariousness.SelectedValue.ToString(),
                    Imagination        = CbImagination.SelectedValue.ToString(),
                    Chauvinism         = CbChauvinism.SelectedValue.ToString(),
                    Suspicion          = CbSuspicion.SelectedValue.ToString(),
                    Playfulness        = CbPlayfulness.SelectedValue.ToString(),
                    Image              = BuildByteArrayFromImage(_raceBitmapImage)
                };
                //FIXME

                //if (RaceImageWindow.Source != null)
                //{
                //    byte[] buffer;
                //    FileStream fileStream = new FileStream(_imagePath, FileMode.Open, FileAccess.Read);
                //    try
                //    {
                //        int length = (int)fileStream.Length;  // get file length
                //        buffer = new byte[length];            // create buffer
                //        int count;                            // actual number of bytes read
                //        int sum = 0;                          // total number of bytes read

                //        // read until Read method returns 0 (end of the stream has been reached)
                //        while ((count = fileStream.Read(buffer, sum, length - sum)) > 0)
                //            sum += count;  // sum is a buffer offset for next reading
                //    }
                //    finally
                //    {
                //        fileStream.Close();
                //    }
                //    DBAlien.image = buffer;
                //}

                context.Aliens.Add(dbAlien);
                context.SaveChanges();
            }

            MessageBox.Show("The Alien '" + TbName.Text + "' has been saved in the Database");
        }
Ejemplo n.º 12
0
        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            #region "Atributos"

            string nombre       = Convert.ToString(tbNombre.Text);
            string nacionalidad = Convert.ToString(tbNacionalidad.Text);
            char   genero       = Convert.ToChar(dlGenero.SelectedItem.Value);


            #endregion

            #region "Carácteristicas"

            string liga          = rbLiga.SelectedItem.Value;
            string typePersonaje = TypePersonaje.SelectedItem.Value;

            #endregion

            ////Creando los Enemigos por defecto
            Humanos flash          = new Humanos("flash", 'M', "USA");
            Humanos mujerMaravilla = new Humanos("mujerMaravilla", 'M', "USA");
            Aliens  superMan       = new Aliens("superMan", 'M', "Martes");
            Aliens  hulk           = new Aliens("hulk", 'M', "Martes");

            //Insertando enemigos a la Lista
            PersonajesRepositories ppp = new PersonajesRepositories();
            ppp.addEnemigos(flash, mujerMaravilla, superMan, hulk);


            if (typePersonaje == "humano")
            {
                Humanos personaje = new Humanos(nombre, genero, nacionalidad);

                //iniciando Caracteristicas
                Caracterizacion armasPerson = new Armas();

                // Añadiendo Armas
                if (chCatana.Checked)
                {
                    armasPerson = new Catana(armasPerson);
                }

                if (chAk47.Checked)
                {
                    armasPerson = new Ak47(armasPerson);
                }

                if (chManun.Checked)
                {
                    armasPerson = new ArmaManun(armasPerson);
                }

                if (chEspada.Checked)
                {
                    armasPerson = new Espada(armasPerson);
                }

                //Añadiendo las Armas a Batman
                personaje.add(armasPerson);

                ppp.addPersonaje(personaje);
                Response.Redirect("Default.aspx");
            }

            if (typePersonaje == "shumano")
            {
                SuperHumanos personaje = new SuperHumanos(nombre, genero, nacionalidad);
            }

            if (typePersonaje == "aliens")
            {
                Aliens personaje = new Aliens(nombre, genero, nacionalidad);
            }

            if (typePersonaje == "artificiales")
            {
                double       version   = Convert.ToDouble(tbVersion);
                Artificiales personaje = new Artificiales(nombre, genero, version);
            }
        }