示例#1
0
 public void NoMoon()
 {
     isMoon  = false;
     planete = null;
     infoGold.gameObject.SetActive(true);
     UpdateGold();
 }
        }// return true

        #endregion
        #endregion

        //actualise l'univers
        public void Refresh()
        {
            Univers.Clear();

            string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string path       = (System.IO.Path.GetDirectoryName(executable));

            AppDomain.CurrentDomain.SetData("DataDirectory", path);
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                string sql = "SELECT * FROM [UniversDATABase].[Planete]";
                using (var command = new SqlCommand(sql, connection))
                {
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var planeteE = new Planete();
                            planeteE.Nom             = reader["PlaneteNom"].ToString();
                            planeteE.Volume          = reader["PlaneteVolume"].ToString();
                            planeteE.Masse           = reader["PlaneteMasse"].ToString();
                            planeteE.Anneaux         = reader["PlaneteAnneaux"].ToString();
                            planeteE.AnnéeDecouverte = reader["PlaneteDecouverte"].ToString();
                            planeteE.NbreSatellite   = reader["PlaneteNBSat"].ToString();
                            planeteE.PeriodeRevo     = reader["PlanetePeriodeRevo"].ToString();
                            planeteE.PlanIm          = reader["PlanetePathIm"].ToString();

                            Univers.Add(planeteE);
                        }
                    }
                }
            }
        }
示例#3
0
    void Update()
    {
        int layerMask = 1 << 8;


        if (Input.GetMouseButton(0))
        {
            movement.x += Mathf.Abs(Input.GetAxis("Mouse X"));
            movement.y += Mathf.Abs(Input.GetAxis("Mouse Y"));
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (movement.x < movementDetectionThreshold && movement.y < movementDetectionThreshold)
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask))
                {
                    Planete p = hit.collider.GetComponentInParent <Planete>();
                    if (p != null && cameraBehavior != null)
                    {
                        cameraBehavior.Target       = p.center;
                        cameraBehavior.zoomMinLimit = p.GetRange();
                    }
                }
            }

            movement = new Vector2(0f, 0f);
        }
    }
示例#4
0
 void Start()
 {
     Planete       = FindObjectOfType <Planete>();
     ResteSurTerre = GetComponent <ResteSurTerre>();
     InitPositionDeReference();
     RandomDestination();
 }
示例#5
0
文件: ET.cs 项目: mimusangel/LD46
 public void Update()
 {
     if (focus != null)
     {
         rg2d.velocity = ((focus.transform.position + Vector3.up * 3.5f) - transform.position).normalized * vel;
         if (Vector3.Distance(transform.position, focus.transform.position) < 4.0f)
         {
             missionTime       += Time.deltaTime;
             textMission.text   = $"{Mathf.RoundToInt((missionTime / 10.0f) * 100.0f)}%";
             transform.position = focus.transform.position + Vector3.up * 3.5f;
             rg2d.velocity      = Vector3.zero;
             if (missionTime >= 10.0f)
             {
                 focus.GetComponent <Rotate>()?.ET_TP();
                 focus = null;
             }
         }
     }
     else
     {
         textMission.text = "";
         rg2d.velocity    = (startPoint - transform.position).normalized * vel;
         if (Vector3.Distance(startPoint, transform.position) < 10.0f)
         {
             Destroy(gameObject);
         }
     }
 }
示例#6
0
        private void exporteLesPlanetesDeLaGalaxieDansLaPlageSpecifiee(int galaxie, int systemeDebut, int systemeFin)
        {
            Collection <Planete> cp = new Collection <Planete>();

            for (int s = systemeDebut; s <= systemeFin; ++s)
            {
                if (backgroundWorkerExportation.CancellationPending)
                {
                    return;
                }
                if (FormPrincipale.LUniversConnu[galaxie].SystemeNonNul(s))
                {
                    for (int p = 1; p <= 15; ++p)
                    {
                        Planete pl = FormPrincipale.LUniversConnu[galaxie, s, p] as Planete;
                        if (pl != null)
                        {
                            if (pl.Nom != "Planete inconnue" &&
                                pl.Nom != "Planète inconnue"
                                )
                            {
                                cp.Add(pl);
                            }
                        }
                    }
                }
            }
            if (backgroundWorkerExportation.CancellationPending)
            {
                return;
            }
            resultat += fp.serveur.ExporterLesPlanetes(cp);
        }
 public AjoutPlanete(Planete _planete)
 {
     AddOrModify = "Ajouter";
     OnAddNew    = new DelegateCommande(OnAddAction, CanAdd);           //Commande du bouton Ajouter et Modifier
     OnCancel    = new DelegateCommande(OnCancelCommand, CanCancel);    //Commande du bouton Annuler
     LoadCommand = new DelegateCommande(OnLoadCommand, CanLoadCommand); //Commande du bouton parcourir
     Planete     = _planete;
 }
示例#8
0
    void Start()
    {
        Planete              = FindObjectOfType <Planete>();
        ResteSurTerre        = GetComponent <ResteSurTerre>();
        GenerateTerrainTypes = FindObjectOfType <GenerateTerrainTypes>();

        CouleurDesert = GenerateTerrainTypes.TerrainVariationColors[0].Color;
        CouleurHerbe  = GenerateTerrainTypes.TerrainVariationColors[1].Color;
    }
示例#9
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        if (GUILayout.Button("Fill atributs with childrens"))
        {
            Planete p = (Planete)target;
            p.FillAttributsWithChidrens();
        }
    }
        private void OnAddAction(object o)
        {
            EventClick.GetClick().Handler += CloseAddView;
            Planete PlaneteAjout           = new Planete();

            add      = new Fajout(PlaneteAjout);
            add.Name = "Ajout";
            add.ShowDialog();
            AlreadyExiste = false;


            if (add.ViewModelAjout.CLickOnAdd == true)
            {
                foreach (Planete p in Univers)
                {
                    if (add.ViewModelAjout.Planete.Nom.ToLower().Equals(p.Nom.ToLower()))
                    {
                        AlreadyExiste = true;
                    }
                }

                if (AlreadyExiste)
                {
                    Info info = new Info("La planète fait déjà parti de l'univers et n'as donc pas été ajouté");
                    info.ShowDialog();
                }
                else
                {
                    string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
                    string path       = (System.IO.Path.GetDirectoryName(executable));
                    AppDomain.CurrentDomain.SetData("DataDirectory", path);
                    SqlConnection conn = new SqlConnection(connectionString);

                    conn.Open();
                    Planete planeteAdd = add.ViewModelAjout.Planete;
                    string  SQLcmdAdd  = "INSERT INTO [UniversDATABase].[Planete] VALUES (@PNom,@PVol,@PMas,@PAnn,@PDec,@PSat,@PRev,@PIma);";

                    var command = new SqlCommand(SQLcmdAdd, conn);
                    command.Parameters.AddWithValue("@PNom", planeteAdd.Nom);
                    command.Parameters.AddWithValue("@PVol", planeteAdd.Volume);
                    command.Parameters.AddWithValue("@PMas", planeteAdd.Masse);
                    command.Parameters.AddWithValue("@PAnn", planeteAdd.Anneaux);
                    command.Parameters.AddWithValue("@PDec", planeteAdd.AnnéeDecouverte);
                    command.Parameters.AddWithValue("@PSat", planeteAdd.NbreSatellite);
                    command.Parameters.AddWithValue("@PRev", planeteAdd.PeriodeRevo);
                    command.Parameters.AddWithValue("@PIma", planeteAdd.PlanIm);
                    command.ExecuteReader();
                    conn.Close();

                    NotifyPropertyChanged("Univers");
                }
                Refresh();
            }
        }
 public ActionResult Edit(int id, Planete planete)
 {
     try
     {
         _dataLayer.UpdateOrInsertOne(planete);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Delete(int id, Planete planete)
 {
     try
     {
         // TODO: Add delete logic here
         _dataLayer.delete(planete);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(Planete planete)
 {
     try
     {
         // TODO: Add insert logic here
         this._dataLayer.UpdateOrInsertOne(planete);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Create(Planete planete)
        {
            try
            {
                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#15
0
    public void SetFocus(Planete planete)
    {
        if (focus == planete)
        {
            return;
        }
        if (focus)
        {
            focus.HideCase();
            PanelCase.Instance.Hide();
        }
        Planete lastFocus = focus;

        focus = planete;
        if (focus != null)
        {
            foreach (Planete p in Planete.Planetes)
            {
                if (p != focus)
                {
                    p.gameObject.SetActive(false);
                }
            }
            if (focus.isMoon)
            {
                focus.infoGold.gameObject.SetActive(true);
            }
            focus.UpdateGold();
            focus.ShowCase();
            if (lastFocus == null)
            {
                size     = cam.orthographicSize;
                position = gameObject.transform.position;
            }
            Time.timeScale = 0.0f;
        }
        else
        {
            foreach (Planete p in Planete.Planetes)
            {
                p.gameObject.SetActive(true);
            }
            if (lastFocus.isMoon)
            {
                lastFocus.infoGold.gameObject.SetActive(false);
            }
            cam.orthographicSize          = size;
            gameObject.transform.position = position;
            Time.timeScale = 1.0f;
        }
    }
示例#16
0
    public void SpawnMoon(Planete planete)
    {
        GameObject goMoon  = Instantiate(MoonPrefab[Random.Range(0, MoonPrefab.Count)]);
        Rotate     rotMoon = goMoon.GetComponent <Rotate>();

        rotMoon.targetToRotate     = planete.transform;
        rotMoon.worldPointToRotate = planete.GetComponent <Rotate>().worldPointToRotate;
        rotMoon.rotate             = Vector2.one;
        rotMoon.rotateSpeed        = 90.0f;
        Planete pMoon = goMoon.GetComponent <Planete>();

        pMoon.isMoon  = true;
        pMoon.planete = planete;
    }
示例#17
0
    public void SpawnPlanete()
    {
        GameObject prefab   = PlanetePrefab[Random.Range(0, PlanetePrefab.Count)];
        Vector2    position = new Vector2(
            Random.Range(-50.0f, 50.0f),
            Random.Range(-50.0f, 50.0f)
            );

        position.x += position.x < 0 ? -5 : 5;
        position.y += position.y < 0 ? -5 : 5;

        GameObject go  = Instantiate(prefab, position, Quaternion.identity);
        Rotate     rot = go.GetComponent <Rotate>();

        rot.worldPointToRotate = new Vector2(
            Random.Range(-5.0f, 5.0f),
            Random.Range(-5.0f, 5.0f)
            );
        rot.rotate      = rotates[Random.Range(0, rotates.Length)];
        rot.rotateSpeed = Random.Range(45.0f, 135.0f);
        Planete planete = go.GetComponent <Planete>();

        float moonChance = 10.0f;

        switch (GameSettings.GameDifficulty)
        {
        case GameSettings.Difficulty.Easy:
            moonChance = 15.0f;
            break;

        case GameSettings.Difficulty.Normal:
            moonChance = 12.5f;
            break;

        case GameSettings.Difficulty.Hard:
            moonChance = 10.0f;
            break;
        }
        if (Random.Range(0.0f, 100.0f) < moonChance)
        {
            SpawnMoon(planete);
        }
    }
示例#18
0
            public BackGroundImage(int width, int height)
            {
                clr = new List <Brush>();
                clr.Add(Brushes.Beige);
                clr.Add(Brushes.Gray);
                clr.Add(Brushes.Aquamarine);
                clr.Add(Brushes.Red);
                clr.Add(Brushes.DarkOrange);
                clr.Add(Brushes.Orchid);
                clr.Add(Brushes.DarkGoldenrod);
                clr.Add(Brushes.Orange);
                clr.Add(Brushes.LawnGreen);

                Random rnd = new Random();

                _planets = new Planete[8];
                for (int i = 0; i < 8; i++)
                {
                    int k = rnd.Next(3, 10);
                    _planets[i] = new Planete(new Point((int)(width - 70 * i - 50), (int)(Math.Exp(i))), new Point(0, 0), new Size(7 * k, 7 * k), clr.ElementAt(i));
                }
            }
        private void OnEditCommand(object o)
        {
            EventClick.GetClick().Handler += CloseEditView;

            edit = new Fajout(Planete);                  // Factorisation de code. on utilise la même fenetre que pour l'ajout de planete
            edit.ViewModelAjout.AddOrModify = "Valider"; // changement du contenu bouton
            edit.Name = "Edit";
            edit.ShowDialog();
            if (edit.ViewModelAjout.CLickOnAdd == true)
            {
                NotifyPropertyChanged("Planete");
                Planete modifAApliquer = edit.ViewModelAjout.Planete;

                string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
                string path       = (System.IO.Path.GetDirectoryName(executable));
                AppDomain.CurrentDomain.SetData("DataDirectory", path);
                SqlConnection conn = new SqlConnection(connectionString);
                conn.Open();
                string SQLcmdAdd = "UPDATE [UniversDATABase].[Planete] SET PlaneteVolume = @PVol,PlaneteMasse = @PMas,PlaneteAnneaux = @PAnn, PlaneteDecouverte = @PDec, PlaneteNBSat = @PSat, PlanetePeriodeRevo = @PRev, PlanetePathIm = @PIma WHERE PlaneteNom = @PNom";

                var command = new SqlCommand(SQLcmdAdd, conn);
                command.Parameters.AddWithValue("@PNom", modifAApliquer.Nom);
                command.Parameters.AddWithValue("@PVol", modifAApliquer.Volume);
                command.Parameters.AddWithValue("@PMas", modifAApliquer.Masse);
                command.Parameters.AddWithValue("@PAnn", modifAApliquer.Anneaux);
                command.Parameters.AddWithValue("@PDec", modifAApliquer.AnnéeDecouverte);
                command.Parameters.AddWithValue("@PSat", modifAApliquer.NbreSatellite);
                command.Parameters.AddWithValue("@PRev", modifAApliquer.PeriodeRevo);
                command.Parameters.AddWithValue("@PIma", modifAApliquer.PlanIm);

                command.ExecuteReader();
                conn.Close();

                NotifyPropertyChanged("Planete");
                NotifyPropertyChanged("Univers");
            }
            Refresh();
        }
示例#20
0
 public bool IsFocus(Planete planete)
 {
     return(focus == planete);
 }
        // Methode permettant de calculer les corps célestes
        public void Compute()
        {
            //PositionTemps positionTemps = new PositionTemps(App.ObservationPointsViewModel.LieuObservationSelectionne.LieuObservation, DateTime.Now.AddHours(1 + ComputeHourChange(DateTime.Now)), 1, ComputeHourChange(DateTime.Now));
            PositionTemps positionTemps = new PositionTemps(App.ObservationPointsViewModel.LieuObservationSelectionne.LieuObservation, DateTime.Now, 1, ComputeHourChange(DateTime.Now));

            for (int i = 0; i < App.PlanetSelectionViewModel.SelectedPlanets.Count; i++)
            {
                CorpsSystemeSolaire c = null;
                double phase          = -100;
                double magnitude      = -100;
                switch (App.PlanetSelectionViewModel.SelectedPlanets[i].Name)
                {
                case "La Lune":
                    c = new Lune();
                    ((Lune)c).CalculerIteratif(positionTemps);
                    phase = ((Lune)c).Phase;
                    break;

                case "Mercure":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.MERCURE);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    phase     = ((Planete)c).Phase;
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;

                case "Venus":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.VENUS);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    phase     = ((Planete)c).Phase;
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;

                case "Mars":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.MARS);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;

                case "Jupiter":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.JUPITER);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;

                case "Saturne":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.SATURNE);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;

                case "Uranus":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.URANUS);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;

                case "Neptune":
                    c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.NEPTUNE);
                    ((Planete)c).CalculerIteratif(positionTemps);
                    magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude;
                    break;
                }
                MoonAndPlanet moonAndPlanet = new MoonAndPlanet(c, App.PlanetSelectionViewModel.SelectedPlanets[i], phase, magnitude);
                if (App.PlanetSelectionViewModel.SelectedPlanets[i].IsSelected)
                {
                    MoonAndPlanetsList.Add(moonAndPlanet);
                }
            }
        }
        // GET: Planete/Edit/5
        public ActionResult Edit(int id)
        {
            Planete planete = _dataLayer.Select().Find(item => item.ID == id);

            return(View(planete));
        }
        private void ImportAction(object o)
        {
            Planete PlaneteImporte;
            string  line;
            string  chemin = "";

            string[] part = new string[8];


            Microsoft.Win32.OpenFileDialog op = new Microsoft.Win32.OpenFileDialog();
            op.Title  = "Selectionner un fichier";
            op.Filter = "Fichier texte(.txt)|*.txt|" +
                        "*.*|*.*";

            if (op.ShowDialog() == true)
            {
                chemin = op.FileName;
            }
            if (chemin != "")
            {
                System.IO.StreamReader ReadForImport = new System.IO.StreamReader(chemin);
                line = ReadForImport.ReadLine(); // eleve la ligne des infos colonnes
                line = ReadForImport.ReadLine();
                while ((line = ReadForImport.ReadLine()) != null)
                {
                    if (line.Equals(""))
                    {
                        line = ReadForImport.ReadLine();
                    }
                    PlaneteImporte = new Planete();
                    part           = line.Split('|');

                    PlaneteImporte.Nom             = part[0];
                    PlaneteImporte.Volume          = part[1];
                    PlaneteImporte.Masse           = part[2];
                    PlaneteImporte.Anneaux         = part[3];
                    PlaneteImporte.AnnéeDecouverte = part[4];
                    PlaneteImporte.NbreSatellite   = part[5];
                    PlaneteImporte.PeriodeRevo     = part[6];
                    PlaneteImporte.PlanIm          = part[7];



                    foreach (Planete p in Univers) ///test si la planete existe
                    {
                        if (PlaneteImporte.Nom.ToLower().Equals(p.Nom.ToLower()))
                        {
                            AlreadyExiste = true;
                        }
                    }

                    if (!(AlreadyExiste))
                    {
                        string executable = System.Reflection.Assembly.GetExecutingAssembly().Location;
                        string path       = (System.IO.Path.GetDirectoryName(executable));
                        AppDomain.CurrentDomain.SetData("DataDirectory", path);
                        SqlConnection conn = new SqlConnection(connectionString);
                        conn.Open();

                        string SQLcmdAdd = "INSERT INTO [UniversDATABase].[Planete] VALUES (@PNom,@PVol,@PMas,@PAnn,@PDec,@PSat,@PRev,@PIma);";

                        var command = new SqlCommand(SQLcmdAdd, conn);
                        command.Parameters.AddWithValue("@PNom", PlaneteImporte.Nom);
                        command.Parameters.AddWithValue("@PVol", PlaneteImporte.Volume);
                        command.Parameters.AddWithValue("@PMas", PlaneteImporte.Masse);
                        command.Parameters.AddWithValue("@PAnn", PlaneteImporte.Anneaux);
                        command.Parameters.AddWithValue("@PDec", PlaneteImporte.AnnéeDecouverte);
                        command.Parameters.AddWithValue("@PSat", PlaneteImporte.NbreSatellite);
                        command.Parameters.AddWithValue("@PRev", PlaneteImporte.PeriodeRevo);
                        command.Parameters.AddWithValue("@PIma", PlaneteImporte.PlanIm);
                        command.ExecuteReader();
                        conn.Close();
                    }
                    AlreadyExiste = false;  //remise a zero du booleen de test
                }
                ReadForImport.Close();
                Refresh();
                Info IImp = new Info("Toutes les planète du fichier ont été importées");
                IImp.ShowDialog();
            }
        }
示例#24
0
文件: Solar.cs 项目: mimusangel/LD46
 private void Update()
 {
     if (!End)
     {
         absorbTime = Mathf.Max(absorbTime - Time.deltaTime, 0.0f);
         bool hasShieldActif = false;
         for (int j = 0; j < shields.Count; j++)
         {
             if (shields[j].HasShield)
             {
                 hasShieldActif = true;
                 break;
             }
         }
         Shield.SetActive(hasShieldActif);
         Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, (scale + 1.0f * absorbTime), layer.value);
         for (int i = 0; i < colliders.Length; i++)
         {
             int dmg = 1;
             if (colliders[i].gameObject == this.gameObject)
             {
                 continue;
             }
             Planete pl = colliders[i].gameObject.GetComponent <Planete>();
             if (pl)
             {
                 bool isPinky = colliders[i].gameObject.GetComponent <Pinky>() != null;
                 if (isPinky)
                 {
                     GameManager.Instance.SpawnPlanete();
                 }
                 pl.Dead(true);
             }
             Asteroid at = colliders[i].gameObject.GetComponent <Asteroid>();
             if (at)
             {
                 GameManager.Instance.AddScore(-at.maxLife);
                 if (at.Big)
                 {
                     dmg++;
                 }
             }
             Destroy(colliders[i].gameObject);
             if (hasShieldActif)
             {
                 for (int j = 0; j < shields.Count; j++)
                 {
                     if (shields[j].HasShield)
                     {
                         shields[j].UseShield();
                         dmg--;
                         if (dmg <= 0)
                         {
                             break;
                         }
                     }
                 }
             }
             if (dmg > 0)
             {
                 absorbTime += dmg;
                 scale      += dmg;
                 if (scale >= 20)
                 {
                     WarningUI.SetActive(true);
                     if (AudioCritique.isPlaying == false)
                     {
                         AudioCritique.Play();
                     }
                     float pct = (scale - 20.0f) / 10.0f;
                     AudioCritique.pitch = 1 + pct * 0.5f;
                 }
                 End = scale >= 30.0f;
                 if (End)
                 {
                     timer = Time.time;
                     AudioCritique.Stop();
                 }
             }
         }
         transform.localScale = Vector3.one * (scale + 1.0f * absorbTime);
         UpdateAnimation();
     }
     else
     {
         float pct = Time.time - timer;
         scale = endCurve.Evaluate(pct > 1.5f ? 1.5f : pct) * 1.5f;
         transform.localScale = Vector3.one * scale;
         Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, scale, layer.value);
         for (int i = 0; i < colliders.Length; i++)
         {
             if (colliders[i].gameObject == this.gameObject)
             {
                 continue;
             }
             Destroy(colliders[i].gameObject);
         }
         if (pct >= 0.5f && AudioEnd.isPlaying == false && PanelEnd.Instance.IsVisible == false)
         {
             AudioEnd.Play();
         }
         float pc = (pct - 1.5f) / 0.5f;
         pc = Mathf.Clamp01(pc);
         GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f - pc);
         if (pct > 2.0f)
         {
             if (PanelEnd.Instance.IsVisible == false)
             {
                 GameSettings.AddScore();
                 PanelEnd.Instance.Show();
             }
         }
     }
 }
示例#25
0
 void Start()
 {
     Planete   = FindObjectOfType <Planete>();
     Rigidbody = GetComponent <Rigidbody>();
 }
示例#26
0
 void Start()
 {
     Planete = FindObjectOfType <Planete>();
 }
示例#27
0
        public void Search(Main mainForm)
        {
            // on regarde initialise la page au debut
            if (!ProcessInit)
            {
                mainForm.action = Action.updatePlayerIdUnique;
                Initialisation(mainForm);
                return;
            }
            if (GalaxyNavigation <= GalaxyMax)
            {
                // on est actuellement au coordonnées suivantes
                string galaxieActual = mainForm.webBrowserMain.Document.GetElementById("galaxi").GetAttribute("value");
                string systemActual  = mainForm.webBrowserMain.Document.GetElementById("system").GetAttribute("value");

                // on recupere l'ID parent le plus proche des planetes
                HtmlElement pageSystemSolaire = mainForm.webBrowserMain.Document.GetElementById("galaxiform");
                foreach (HtmlElement elementTemp in pageSystemSolaire.Children)
                {
                    // on recupere le conteneur de l'ensemble des planetes
                    if (elementTemp.GetAttribute("className").Contains("orcp2m"))
                    {
                        // mainForm.searchCDRUserView.progressChanged(this.GalaxyStart, this.SystemStart, this.GalaxyMax, 100, this.GalaxyNavigation, this.SystemNavigation, base.lastLoadTime);
                        int position = 0;
                        foreach (HtmlElement elementTemp2 in elementTemp.Children)
                        {
                            // Parcours de chaques lignes de planetes (pas de différence en les zones sombres et claires)
                            if (elementTemp2.GetAttribute("className").Contains("orcp2mlg"))
                            {
                                position++;
                                Player  player;
                                Planete planete = null;
                                foreach (HtmlElement elementTemp3 in elementTemp2.Children)
                                {
                                    // on recupère les informations de la planète
                                    if (elementTemp3.GetAttribute("className").Contains("orcp2mlgc"))
                                    {
                                        string planeteName = elementTemp3.InnerText;
                                        if (!string.IsNullOrEmpty(planeteName))
                                        {
                                            planete          = new Planete();
                                            planete.Galaxy   = GalaxyNavigation;
                                            planete.System   = SystemNavigation;
                                            planete.Position = position;
                                            planete.Name     = planeteName;
                                        }
                                    }

                                    if (elementTemp3.GetAttribute("className").Contains("orcp2mlgf"))
                                    {
                                        if ((elementTemp3.FirstChild != null) && (planete != null))
                                        {
                                            string elementClick = elementTemp3.FirstChild.OuterHtml;
                                            if (elementClick.Contains("messagerie_ecrire"))
                                            {
                                                List <long> allInt = GeneralFunction.getNumberFromText(elementClick);

                                                int UniquePUniqueNumberContact = Convert.ToInt32(allInt[0]);
                                                player = new Player();
                                                player.UniqueNumberContact = UniquePUniqueNumberContact;


                                                EasyOR.DataAccess.SqlServer.PlayerAction playerDB = new DataAccess.SqlServer.PlayerAction();
                                                var playerFound = playerDB.GetUserByInternalIdOR(player.UniqueNumberContact);
                                                if (playerFound == null)
                                                {
                                                    // Add player
                                                    playerDB.AddPlayer(new EasyOR.DTO.Player()
                                                    {
                                                        Name = null, IsAFK = null, IsVacation = null, InternalIdOR = player.UniqueNumberContact
                                                    });

                                                    playerFound = playerDB.GetUserByInternalIdOR(player.UniqueNumberContact);
                                                    // add planet
                                                    new PlanetAction().AddPlanet(new DTO.Planet()
                                                    {
                                                        Galaxy = (Int16)planete.Galaxy, System = (Int16)planete.System, Position = (Int16)planete.Position, PlayerId = playerFound.PlayerId, Name = planete.Name
                                                    });
                                                }
                                                else
                                                {
                                                    var planet = new PlanetAction().GetByCoordinatesAndUserInternalID((Int16)planete.Galaxy, (Int16)planete.System, (Int16)planete.Position, player.UniqueNumberContact);
                                                    if (planet == null)
                                                    {
                                                        new PlanetAction().AddPlanet(new DTO.Planet()
                                                        {
                                                            Galaxy = (Int16)planete.Galaxy, System = (Int16)planete.System, Position = (Int16)planete.Position, PlayerId = playerFound.PlayerId, Name = planete.Name
                                                        });
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                SystemNavigation++;
                new Navigation().InvokeForm(capteurInterstellaireURL, mainForm.webBrowserMain, "galaxi_envoi", new object[] { GalaxyNavigation, SystemNavigation });
            }
            else
            {
                mainForm.action        = Action.updatePlayerNameStep1;
                mainForm.getPlayerName = new GetPlayerName();
                mainForm.getPlayerName.GetName(mainForm);
                mainForm.searchPlayer = null;
            }
        }
 public ActionResult Create(Planete wookie)
 {
     return(this.View());
 }