Inheritance: uProcessing
Exemplo n.º 1
0
    void CheckIfNeedReturnToDefaultCam()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!curPlanet)
            {
                return;
            }

            cam.transform.DOMove(defaultCamPosi, camBackDt);
            cam.transform.DORotateQuaternion(defaultCamRot, camBackDt);
            cam.transform.parent = defaultCamParent;

            curPlanet.GetComponent <Interations>().enabled = false;
            curPlanet.MySendEventToAll("BACK");
            curPlanet.transform.parent.gameObject.MySendEventToAll("RESUME_ROTATE");
            curPlanet = null;

            orbtis.SetActive(true);
            SetTitle("");
        }

        if (Input.GetKeyDown(KeyCode.O))
        {
            orbitSwitch.SetActive(!orbitSwitch.activeSelf);
        }
    }
Exemplo n.º 2
0
            public override void Create()
            {
                Name = "Island";

                var water1 = new Water();
                var water2 = new Water();
                var water3 = new Water();
                var earth  = new Earth();

                Elements = new Element[]
                {
                    water1, water2, water3, earth
                };

                foreach (var element in Elements)
                {
                    element.Create();
                }

                var kraken    = new Kraken();
                var leviathan = new Leviathan();
                var merfolk1  = new Merfolk();
                var merfolk2  = new Merfolk();
                var merfolk3  = new Merfolk();

                Creatures = new Creature[]
                {
                    kraken, leviathan, merfolk1, merfolk2, merfolk3
                };

                foreach (var creature in Creatures)
                {
                    creature.Create();
                }
            }
Exemplo n.º 3
0
        public void GetNextAscendent()
        {
            GregorianDateTime nd;

            CurrentSign     = Earth.GetNextAscendentStart(CurrentDateTime, out nd);
            CurrentDateTime = nd;
        }
Exemplo n.º 4
0
            public override void Create()
            {
                Name = "Plains";

                var earth1 = new Earth();
                var earth2 = new Earth();

                Elements = new Element[]
                {
                    earth1, earth2
                };

                foreach (var element in Elements)
                {
                    element.Create();
                }

                var human1 = new Human();
                var human2 = new Human();
                var animal = new Animal();
                var orc    = new Orc();

                Creatures = new Creature[]
                {
                    human1, human2, animal, orc
                };

                foreach (var creature in Creatures)
                {
                    creature.Create();
                }
            }
Exemplo n.º 5
0
 public void UpdateCollectionGoalsForest(Earth earth)
 {
     if (m_levelGoalCollected != null)
     {
         m_levelGoalCollected.UpdateGoalsEarth(earth);
     }
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            var dt = TestingEnvironment.CreateCarsTable();
            Earth e = new Earth(dt);
            var result =  e.Predict("mpg");

        }
Exemplo n.º 7
0
        private void OnPaint(UIElement element, SKCanvas canvas)
        {
            Timer.Update();

            var deltaTime = HipsterEngine.DeltaTime.GetDeltaTime();

            mControl.Update();
            mControl.Draw();
            aControl.Draw();

            HipsterEngine.Surface.Canvas.Save();
            HipsterEngine.Surface.Canvas.Translate(HipsterEngine.Surface.Canvas.Camera.X,
                                                   HipsterEngine.Surface.Canvas.Camera.Y);
            HipsterEngine.Surface.Canvas.Scale(HipsterEngine.Surface.Canvas.Camera.ScaleX, HipsterEngine.Surface.Canvas.Camera.ScaleY);
            Earth.Step();
            Earth.Draw();
            Trees.ForEach(t =>
            {
                t.Step();
                t.Draw();
            });
            //  Robots.ForEach(r =>
            //   {
            //    r.Update(1, 1);
            //    r.Draw(HipsterEngine.Surface.Canvas);
            //  });

            HipsterEngine.Physics.Step(1.0f, 20);
            HipsterEngine.Particles.Draw(HipsterEngine.Surface.Canvas.GetSkiaCanvas());
            HipsterEngine.Surface.Canvas.Restore();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Calculates the planet <see cref="Earth"/> distance at a specified time.
        /// </summary>
        /// <param name="time">Local time.</param>
        /// <returns>Distance in AU.</returns>
        public virtual double GetToEarthDistance(DateTime time)
        {
            Earth e = new Earth();

            var    earth = e.GetHeliocentricEclipticCoordinate(time);
            double r0    = e.GetToSunDistance(time);
            var    e1    = GetHeliocentricEclipticCoordinate(time);
            double r1    = GetToSunDistance(time);

            double x1 = r1 * Math.Cos(e1.Latitude * (Math.PI / 180.0)) * Math.Cos(e1.Longitude * (Math.PI / 180.0)) - r0 * Math.Cos(earth.Latitude * (Math.PI / 180.0)) * Math.Cos(earth.Longitude * (Math.PI / 180.0));
            double y1 = r1 * Math.Cos(e1.Latitude * (Math.PI / 180.0)) * Math.Sin(e1.Longitude * (Math.PI / 180.0)) - r0 * Math.Cos(earth.Latitude * (Math.PI / 180.0)) * Math.Sin(earth.Longitude * (Math.PI / 180.0));
            double z1 = r1 * Math.Sin(e1.Latitude * (Math.PI / 180.0)) - r0 * Math.Sin(earth.Latitude * (Math.PI / 180.0));

            //double t = 0.0057755183 * Math.Sqrt(x1 * x1 + y1 * y1 + z1 * z1);

            //var e2 = HeliocentricEclipticCoordinate(time, t);
            //double r2 = ToSunDistance(time, t);

            //double x2 = r2 * Math.Cos(e2.Latitude * (Math.PI / 180.0)) * Math.Cos(e2.Longitude * (Math.PI / 180.0)) - r0 * Math.Cos(earth.Latitude * (Math.PI / 180.0)) * Math.Cos(earth.Longitude * (Math.PI / 180.0));
            //double y2 = r2 * Math.Cos(e2.Latitude * (Math.PI / 180.0)) * Math.Sin(e2.Longitude * (Math.PI / 180.0)) - r0 * Math.Cos(earth.Latitude * (Math.PI / 180.0)) * Math.Sin(earth.Longitude * (Math.PI / 180.0));
            //double z2 = r2 * Math.Sin(e2.Latitude * (Math.PI / 180.0)) - r0 * Math.Sin(earth.Latitude * (Math.PI / 180.0));

            //return Math.Sqrt(x2 * x2 + y2 * y2 + z2 * z2);

            return(Math.Sqrt(x1 * x1 + y1 * y1 + z1 * z1));
        }
Exemplo n.º 9
0
    private static void DestroyClosest(Transform parent, string type)
    {
        if (parent.childCount == 0)         // No enemies found, so nothing to do here
        {
            return;
        }

        // Find closest enemy...
        Transform closestEnemy = null;
        float     minDist      = -1f;

        for (int i = 0; i < parent.childCount; i++)
        {
            Transform missile = parent.GetChild(i);
            float     dist    = Vector2.Distance(Earth.Instance.transform.position, missile.position);
            if (i == 0 || dist < minDist)
            {
                minDist      = dist;
                closestEnemy = missile;
            }
        }

        // ...and destroy it
        if (type == "missile")
        {
            closestEnemy.GetComponent <Missile>().DestroyMissile();
        }
        else if (type == "ship")
        {
            closestEnemy.GetComponent <Ship>().DestroyShip();
        }

        Earth.ShootLaser(closestEnemy.GetChild(0).position, 0.1f);
    }
Exemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     destroyedAsteroid += OnDestroyedAsteroid;
     destroyedEarth    += OnDestroyedEarth;
     earth              = GetComponent <Earth>();
     earth.SetOnDestroyedCallback(destroyedEarth);
 }
Exemplo n.º 11
0
    public void ScorePointsForestTiles(Earth tile)
    {
        if (tile != null)
        {
            if (ScoreManager.Instance != null)
            {
                // score points
                ScoreManager.Instance.AddScore(tile.scoreValue);

                // update the scoreStars in the Level Goal component
                m_levelGoal.UpdateScoreStars(ScoreManager.Instance.CurrentScore);

                if (UIManager.Instance != null && UIManager.Instance.scoreMeter != null)
                {
                    UIManager.Instance.scoreMeter.UpdateScoreMeter(ScoreManager.Instance.CurrentScore,
                                                                   m_levelGoal.scoreStars);
                }
            }

            // play scoring sound clip
            if (SoundManager.Instance != null && tile.clearSound != null)
            {
                SoundManager.Instance.PlayClipAtPoint(tile.clearSound, Vector3.zero, SoundManager.Instance.fxVolume);
            }
        }
    }
 public static void SetHealth(int amount)
 {
     Instance.health       = amount;
     Instance.health       = Mathf.Clamp(Instance.health, 0, Instance.maxHealth);
     Instance.slider.value = (float)Instance.health / Instance.maxHealth;
     Earth.UpdateSprite();
 }
Exemplo n.º 13
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (uc == null)
            {
                uc = new Earth();
                uc.config.isShowDebugInfo = true; //在屏下方显示相机信息
                uc.config.isDynShow       = true; //根据相机视界动态显示图形对象,动态载入时,此属性必须为true
                uc.config.isDynLoad       = true;
                grdMain.Children.Add(uc);
                uc.earthManager.earthpara.ArrowSpan = 1.5f; //控制潮流箭头密度
                loadModel();
                uc.camera.XRotationScale = 0.8;

                uc.MouseMove         += new MouseEventHandler(uc_MouseMove); //tooltip示例
                tooltiptimer.Interval = TimeSpan.FromMilliseconds(200);
                tooltiptimer.Tick    += new EventHandler(tooltiptimer_Tick);


                //动态载入
                bworker.DoWork                    += new DoWorkEventHandler(bworker_DoWork);
                bworker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(bworker_RunWorkerCompleted);
                bworker.WorkerSupportsCancellation = true;
                uc.VisualRangeChanged             += new EventHandler(uc_VisualRangeChanged);
                Camera.ViewRange vr = uc.camera.curCamearaViewRange;
                oldminjd    = vr.farLongitudeStart;
                oldmaxjd    = vr.farLongitudeEnd;
                oldminwd    = vr.latitudeStart;
                oldmaxwd    = vr.latitudeEnd;
                olddictance = uc.camera.curCameraDistanceToGround;
            }
        }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            SolarSystemPlanet ssp = new SolarSystemPlanet(86000, "Земля");
            Earth             abc = new Earth(3, true);
            TheSun            sss = new TheSun(5505, true);

            Console.Write("1)");
            ssp.MoveInOrbit();
            Console.Write("2)");
            ssp.izmenenyeImeny("Марс");
            Console.Write("3)");
            ssp.izmenenyeDiametra(53666);

            Console.Write("4)");
            abc.MakeNewIceAge(true);
            Console.Write("5)");
            abc.GrowATrees();
            Console.Write("6)");
            abc.FloodVillageOnTheShore();

            Console.Write("7)");
            sss.Blow();
            Console.Write("8)");
            sss.IncreaseTemprature(1200);
            Console.Write("9)");
            sss.EmitUltravioletLight();
        }
Exemplo n.º 15
0
        public static double CorrectEquinox(double JDE, EquinoxType Equinox)
        {
            Earth  earth = new Earth();
            double L = earth.CalculateHelocentricLongitude(JDE, 5);
            double B = earth.CalculateHelocentricLatitude(JDE, 4);
            double R = earth.CalculateRadiusVector(JDE, 5);
            double dL, dB, aberration, nutation;

            earth.CorrectLB(L, B, JDE, out dL, out dB);
            aberration = -(20.4898 / R);
            nutation   = MathHelper.Rev(earth.CalculateNutation(JDE));
            double ApparentGeocentricLongitude;

            ApparentGeocentricLongitude = L - 180 - (nutation / 3600) + (dL / 3600) + (aberration / 3600);
            double correction = 58 * MathHelper.Sin((int)Equinox * 90 - ApparentGeocentricLongitude);
            double JDE0       = JDE + correction;

            if (correction <= 0.0000005 && correction >= -0.0000005)
            {
                return(Math.Round(JDE0, 5));;
            }
            else
            {
                return(CorrectEquinox(JDE0, Equinox));
            }
        }
Exemplo n.º 16
0
    void Update()
    {
        Sun.Rotate(Vector3.up * Time.deltaTime * 5);

        Mercury.RotateAround(Sun.position, new Vector3(0.1f, 1, 0), 60 * Time.deltaTime);
        Mercury.Rotate(Vector3.up * 10000 / 58 * Time.deltaTime);

        Venus.RotateAround(Sun.position, new Vector3(0, 1, -0.1f), 55 * Time.deltaTime);
        Venus.Rotate(Vector3.up * 10000 / 243 * Time.deltaTime);

        Earth.RotateAround(Sun.position, Vector3.up, 50 * Time.deltaTime);
        Earth.Rotate(Vector3.up * 10000 * Time.deltaTime);
        Moon.RotateAround(Earth.position, Vector3.up, 5 * Time.deltaTime);
        Moon.Rotate(Vector3.up * 10000 / 27 * Time.deltaTime);

        Mars.RotateAround(Sun.position, new Vector3(0.2f, 1, 0), 45 * Time.deltaTime);
        Mars.Rotate(Vector3.up * 10000 * Time.deltaTime);

        Jupiter.RotateAround(Sun.position, new Vector3(-0.1f, 2, 0), 38 * Time.deltaTime);
        Jupiter.Rotate(Vector3.up * 10000 / 0.3f * Time.deltaTime);

        Saturn.RotateAround(Sun.position, new Vector3(0, 1, 0.2f), 36 * Time.deltaTime);
        Saturn.Rotate(Vector3.up * 10000 / 0.4f * Time.deltaTime);

        Uranus.RotateAround(Sun.position, new Vector3(0, 2, 0.1f), 35 * Time.deltaTime);
        Uranus.Rotate(Vector3.up * 10000 / 0.6f * Time.deltaTime);

        Neptune.RotateAround(Sun.position, new Vector3(-0.1f, 1, -0.1f), 33 * Time.deltaTime);
        Neptune.Rotate(Vector3.up * 10000 / 0.7f * Time.deltaTime);
    }
Exemplo n.º 17
0
        ///<summary>创建图元符号</summary>
        internal static void CreateSymbol(Earth scene)
        {
            var pngs = System.IO.Directory.EnumerateFiles(".\\symbols", "*.png");

            foreach (var png in pngs)
            {
                string ddsname = png.Replace(".png", ".dds");
                string name    = png.Replace(@".\symbols\", "").Replace(".png", "");
                string sort;
                if (name.Contains('_'))
                {
                    sort = name.Substring(0, name.IndexOf('_'));
                    name = name.Substring(name.IndexOf('_') + 1);
                }
                else
                {
                    sort = "未分类";
                }
                if (System.IO.File.Exists(ddsname))
                {
                    scene.objManager.AddSymbol(sort, name, png, ddsname);
                }
                else
                {
                    scene.objManager.AddSymbol(sort, name, png);
                }
            }


            RadialGradientBrush brush = new RadialGradientBrush();

            brush.GradientStops.Add(new GradientStop(Colors.White, 0.2));
            brush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));
            scene.objManager.AddSymbol("系统内部使用", "节点电压_渐变圆", brush, 64, 64);
        }
Exemplo n.º 18
0
        public SceneBase CreateEarthScene(Observer.ISceneObserver obs)
        {
            SceneBase scene = new Earth();

            scene.RegisterObserver(obs);
            return(scene);
        }
Exemplo n.º 19
0
 public void Merge()
 {
     //hasexploded = false;
     if (DefaultTrackableEventHandler1.Cassini)
     {
         CassiniExplode.SetActive(false);
         Cassini.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.Apollo)
     {
         ApolloExplode.SetActive(false);
         Apollo.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.Curiosity)
     {
         CuriosityExplode.SetActive(false);
         Curiosity.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.ISS)
     {
         ISSExplode.SetActive(false);
         ISS.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.Galileo)
     {
         GalileoExplode.SetActive(false);
         Galileo.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.HST)
     {
         HSTExplode.SetActive(false);
         HST.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.Messenger)
     {
         MessengerExplode.SetActive(false);
         Messenger.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.PSLV)
     {
         PSLVExplode.SetActive(false);
         PSLV.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.Chandrayaan)
     {
         ChandrayaanExplode.SetActive(false);
         Chandrayaan.SetActive(true);
     }
     else if (DefaultTrackableEventHandler1.Mangalyaan)
     {
         MangalyaanExplode.SetActive(false);
         Mangalyaan.SetActive(true);
     }
     else if (DefaultTrackableEventHandler.earth)
     {
         EarthExplode.SetActive(false);
         Earth.SetActive(true);
     }
 }
Exemplo n.º 20
0
 public Exercise(User curUser)
 {
     InitializeComponent();
     earth         = new Earth();
     user          = curUser;
     questionIndex = 0;
     radio         = new List <Control>();
 }
Exemplo n.º 21
0
        /// <summary>
        /// 顺数
        /// </summary>
        /// <param name="earth">地支</param>
        /// <param name="count">数多少格</param>
        /// <returns></returns>
        public static int DeasilCountZone(Earth earth, int count)
        {
            int i;

            i  = (int)earth + count;
            i %= 12;
            return(i);
        }
Exemplo n.º 22
0
 // Start is called before the first frame update
 void Start()
 {
     manager       = FindObjectOfType <MySceneManager>();
     currentPlanet = GetComponent <Earth>();
     cam           = Camera.main;
     PreCalc();
     SaveOriginalInfo();
 }
Exemplo n.º 23
0
 public ElementCircle()
 {
     fire      = new Fire();
     lightning = new Lightning();
     earth     = new Earth();
     water     = new Water();
     //start element
     currentElement = fire;
 }
        /// <summary>
        /// Ось вращения Земли вокруг Солнца в гелиоцентрической системе координат.
        /// </summary>
        ///
        /// <param name="julianDate"> Юлианская дата.</param>
        ///
        /// <returns>
        /// Ось вращения Земли вокруг Солнца в гелиоцентрической системе координат.
        /// </returns>
        private static Vector GetEarthRotationAxis(double julianDate)
        {
            // Вариант через угол неклона к экватору
            //return new Vector(GetEps0(julianDate), -Math.PI / 2.0);

            // Вариант через мгновенную ось вращения
            // (перемножаю два вектора координат, найденных через малый промежуток времени).
            return(Earth.GetParamsMethod(julianDate).Vector *Earth.GetParamsMethod(julianDate + TIME_CONST).Vector);
        }
Exemplo n.º 25
0
 private void image2_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     if (i == 1)
     {
         Earth.Begin();
         i = 2;
         PresentTheAttributes(2);
     }
 }
Exemplo n.º 26
0
 /*public void PickupPower(Power Power)
  * {
  *          Debug.Log ("Power.GetType() ->" + Power.GetType ());
  *          if(Power.GetType().Equals(Earth))
  *          {
  *          Earth.PickUp();
  *          Player.AddToPowerList(Power);
  *                  PlayerPowerActions.SetCurrentPower(Power);
  *          }
  *          else if(Power.GetType().Equals(Fire))
  *          {
  *                  Earth.PickUp();
  *                  Player.AddToPowerList(Power);
  *                  PlayerPowerActions.SetCurrentPower(Power);
  *          }
  * }*/
 public void PickUpEarth(Earth Earth)
 {
     //Debug.Log ("PlayerActions PickUpEarth Earth Has:" + Earth.ToString());
     Earth.ActivatePower();
     PlayerPowerActions.SetCurrentPower(Earth);
     Player.AddToPowerList(Earth);
     PlayerPowerActions.DeactivateOtherPowers();
     Earth.PickUp();
 }
Exemplo n.º 27
0
 public void OnButtonPressed(VirtualButtonBehaviour vb)
 {
     if (vb.VirtualButtonName == "previewvb")
     {
         Sun.SetActive(false);
         Mercury.SetActive(false);
         Venus.SetActive(false);
         Earth.SetActive(false);
         Moon.SetActive(false);
         Mars.SetActive(false);
         Sun1.SetActive(true);
         Mercury1.SetActive(true);
         Venus1.SetActive(true);
         Earth1.SetActive(true);
         Moon1.SetActive(true);
         Mars1.SetActive(true);
         videoplane.SetActive(false);
     }
     else if (vb.VirtualButtonName == "animationvb")
     {
         UnityEngine.Debug.Log("animationvb Button pressed");
         Sun.SetActive(true);
         Mercury.SetActive(true);
         Venus.SetActive(true);
         Earth.SetActive(true);
         Moon.SetActive(true);
         Mars.SetActive(true);
         Sun1.SetActive(false);
         Mercury1.SetActive(false);
         Venus1.SetActive(false);
         Earth1.SetActive(false);
         Moon1.SetActive(false);
         Mars1.SetActive(false);
         videoplane.SetActive(false);
     }
     else if (vb.VirtualButtonName == "videovb")
     {
         UnityEngine.Debug.Log("Traveller Button pressed");
         Sun.SetActive(false);
         Mercury.SetActive(false);
         Venus.SetActive(false);
         Earth.SetActive(false);
         Moon.SetActive(false);
         Mars.SetActive(false);
         Sun1.SetActive(false);
         Mercury1.SetActive(false);
         Venus1.SetActive(false);
         Earth1.SetActive(false);
         Moon1.SetActive(false);
         Mars1.SetActive(false);
         videoplane.SetActive(true);
     }
     else
     {
         throw new UnityException(vb.VirtualButtonName + "Virtual Button not supported");
     }
 }
Exemplo n.º 28
0
 // Start is called before the first frame update
 void Start()
 {
     instance           = this;
     instance.rigidbody = GetComponent <Rigidbody>();
     spriteRenderer     = GetComponent <SpriteRenderer>();
     brightnessRate     = 1.0f / numTreesToLaunch;
     endSceneTimer      = 0f;
     countingDown       = false;
 }
Exemplo n.º 29
0
 ///<summary>创建几何体资源</summary>
 internal static void CreateGeometry(Earth scene)
 {
     scene.objManager.AddBoxResource("立方体", 1, 1, 1);
     scene.objManager.AddCylinderResource("圆柱体", 1, 1, 1, 16, 1);
     scene.objManager.AddCylinderResource("圆锥体", 0, 1, 1, 16, 1);
     scene.objManager.AddCylinderResource("倒锥体", 0, 1, 1, 4, 1);
     scene.objManager.AddCylinderResource("正锥体", 1, 0, 1, 4, 1);
     scene.objManager.AddSphereResource("球体", (float)(Math.PI * 2), 16, 16);
 }
Exemplo n.º 30
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == Earth.EARTH_TAG)
     {
         Earth collidedEarth = collision.gameObject.GetComponent <Earth>();
         collidedEarth.ReceiveDamage();
         this.Explode();
     }
 }
Exemplo n.º 31
0
 protected override void ProcessRecord()
 {
     m_earth = new Earth();
     if (m_tjd != 0)
     {
         m_earth.SetForTime(m_tjd);
     }
     WriteObject(m_earth);
 }
Exemplo n.º 32
0
 void Start()
 {
     Application.targetFrameRate = 60;
     Time.captureFramerate = 60;
     maxSpeed = defaultMaxSpeed;
     speed_x = 0.0f;
     speed_y = 0.0f;
     button.transform.position = new Vector3 ((float)Screen.width + 75.0f, (float)Screen.height + 75.0f,0.0f );
     wind = GetComponent<Wind> ();
     fire = GetComponent<Fire> ();
     ice = GetComponent<Ice> ();
     earth = GetComponent<Earth> ();
 }
Exemplo n.º 33
0
 public CaptainPlanet(Earth earth, Wind wind, Fire fire, Water water, Heart heart)
 {
 }