Inheritance: MonoBehaviour
示例#1
0
        private void Draw()
        {
            // Создаем экземпляр
            OpenGL gl = this.openGLControl1.OpenGL;

            float[] mat_amb_def_front = new float[] { 0.2f, 0.2f, 0.2f, 1.0f };
            float[] mat_amb_def_back  = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };

            // Очистка экрана и буфера глубин
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.LoadIdentity();

            /*
             * Установим камеру
             * */
            gl.LookAt(Camera.X, Camera.Y, Camera.Z,             // Позиция самой камеры
                      Camera.ViewX, Camera.ViewY, Camera.ViewZ, // Направление, куда мы смотрим
                      Camera.UpX, Camera.UpY, Camera.UpZ);      // Верх камеры

            gl.Light(OpenGL.GL_LIGHT0, OpenGL.GL_POSITION, Sun.Position);

            /*
             * Установим свойства материала
             * */
            gl.Material(OpenGL.GL_FRONT, OpenGL.GL_AMBIENT_AND_DIFFUSE, mat_amb_def_front);
            gl.Material(OpenGL.GL_BACK, OpenGL.GL_AMBIENT_AND_DIFFUSE, mat_amb_def_back);


            /*
             * Отрисовка карты
             * */
            for (int i = 0; i < hMap.Map.GetLength(0) - 1; i++)
            {
                int y = i - hMap.Map.GetLength(0) / 2;
                for (int j = 0; j < hMap.Map.GetLength(1) - 1; j++)
                {
                    int x = j - hMap.Map.GetLength(1) / 2;

                    /*
                     * Проходми по карте высот и для каждого квадрата 2х2 рисуем 2 треугольника,
                     * на которые накладываем текстуру
                     * */
                    gl.Begin(OpenGL.GL_TRIANGLE_STRIP);
                    gl.TexCoord(i * textureBitX, j * textureBitY);  gl.Vertex(x * STEP, y * STEP, hMap.Map[i, j]);
                    gl.TexCoord(i * textureBitX, (j + 1) * textureBitY);  gl.Vertex((x + 1) * STEP, y * STEP, hMap.Map[i, j + 1]);
                    gl.TexCoord((i + 1) * textureBitX, j * textureBitY);  gl.Vertex(x * STEP, (y + 1) * STEP, hMap.Map[i + 1, j]);
                    gl.TexCoord((i + 1) * textureBitX, (j + 1) * textureBitY);  gl.Vertex((x + 1) * STEP, (y + 1) * STEP, hMap.Map[i + 1, j + 1]);
                    gl.End();
                }
            }

            gl.Flush();


            Sun.Move();             //Сдвигаем Солнце
            Camera.CamRotate();     //Вращаем камеру
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("unity3p!!\n");

            Sun sun = new Sun();

            Console.WriteLine(sun.tolower("ABCDE"));
            Console.WriteLine(sun.toupper("abcde"));
        }
示例#3
0
 public Location(string id, string name, string longitude, string latitude, string country, Sun sun)
 {
     Id        = id;
     Name      = name;
     Longitude = longitude;
     Latitude  = latitude;
     Country   = country;
     Sun       = sun;
 }
示例#4
0
文件: Sun.cs 项目: Valensta/otherside
 void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Debug.Log("Sun got destroyed\n");
         Destroy(gameObject);
     }
     Instance = this;
 }
示例#5
0
    void CreateSun()
    {
        Sun   sun            = GameObject.Instantiate <GameObject>(this.prefabSun, Vector3.zero, Quaternion.identity, this.transform).GetComponent <Sun>();
        float downTargetPosY = Random.Range(sunDownMinPosY, sunDownMaxPosY);
        float createPosX     = Random.Range(createSunMinPosX, createSunMaxPosX);
        float createPosY     = createSunPosY;

        sun.InitForSky(downTargetPosY, createPosX, createPosY);
    }
示例#6
0
    private void SpawnMySun()
    {
        Sun   sunClone = (Sun)Instantiate(sunPrefab, transform.position, transform.rotation);
        float sunSize  = 2;

        sunClone.transform.localScale = new Vector3(sunSize, sunSize, 0f);
        sunClone.transform.SetParent(sunParent.transform);
        sunClone.transform.localPosition = new Vector3(UnityEngine.Random.Range(-5f, 5f), sunParent.transform.position.y, 0f);
        sunClone.GetComponent <Rigidbody2D>().velocity = new Vector2(Random.Range(-2, 2), UnityEngine.Random.Range(-10, -1));
    }
示例#7
0
        private static async Task <string> getTimeModul(Modules modules)
        {
            Sun sun = DataAccess.DeserializeModuleData(typeof(Sun), await DataAccess.GetModuleData(modules));

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append($"<table style=\"width: 100%; height: 60%; table-layout: fixed; padding: 2.5%;\"> <tr> <td colspan=\"2\" style=\"font-size: 1.75em;\">{DateTime.Now:D}</td> </tr> <tr> <td colspan=\"2\" style=\"font-size: 7.5em;\" class=\"clock\"></td> </tr> <tr> <td style=\"font-size: 1.75em; text-align: right; padding-right: 5%;\"> <img src=\"sunrise.png\" alt=\"\" style=\"height: 0.85em;\"/> {sun.Sunrise}</td> <td style=\"font-size: 1.75em;  text-align: left; padding-left: 5%;\"> <img src=\"sunset.png\" alt=\"\" style=\"height: 0.85em;\"/> {sun.Sunset}</td> </tr> </table>");

            return(stringBuilder.ToString());
        }
示例#8
0
 public SphericalWorldScreen(IContext context) : base(context, "spherical_world")
 {
     _sphere  = new Sphere(Context, 255, 5000);
     _sky     = new Sky(Context);
     _sun     = new Sun();
     _camera  = new SphericalWorldCamera();
     _counter = new FpsCounter();
     Register(new DynamicLabel(context, "fps_counter", new UniRectangle(5, 5, 100, 50),
                               () => _counter.Value + "FPS"));
 }
示例#9
0
        public static Sun Random(string name)
        {
            var newObj = new Sun();

            newObj.pos     = new Vector(StaticRandom.randomNormalizedFloat * 50f, StaticRandom.randomNormalizedFloat * 50f);
            newObj.name    = name;
            newObj.radius  = StaticRandom.randomNormalizedFloat * 20f;
            newObj.Gravity = StaticRandom.randomNormalizedFloat * 10f;
            return(newObj);
        }
示例#10
0
 void onWaveStart(int i)  //i is always current_wave but we need this for eventoverseers
 {
     calcTimeBasedXp();
     InitWave(i);
     Noisemaker.Instance.Play("wave_start");
     if (my_sun == null)
     {
         my_sun = Sun.Instance;
     }
 }
示例#11
0
        public SolarSystemRenderer(LunarCalc lunarCalc, SolarCalc solarCalc, PlanetsCalc planetsCalc, SolarTextureDownloader solarTextureDownloader, ISettings settings)
        {
            this.planetsCalc = planetsCalc;
            this.sun         = solarCalc.Sun;
            this.moon        = lunarCalc.Moon;

            this.solarTextureDownloader = solarTextureDownloader;
            this.settings = settings;
            penShadowOutline.DashStyle = DashStyle.Dot;
        }
示例#12
0
    //Michael Schmidt
    /// <summary>
    /// Saves impotertend datas from Sun Script
    /// </summary>
    /// <param name="sun"></param>
    public static void SaveSun(Sun sun)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/sun.fun";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        SunData data = new SunData(sun);

        formatter.Serialize(stream, data);
        stream.Close();
    }
示例#13
0
    public void SpawnPlayer(Transform spawnPoint)
    {
        GameObject currentPlayer = Instantiate(playerPrefab, spawnPoint.position, spawnPoint.rotation);

        // Change camera background colour
        Camera playerCam = currentPlayer.GetComponentInChildren <Camera>();
        Sun    sun       = FindObjectOfType <Sun>();

        playerCam.backgroundColor = sun.GetSkyColour(spawnPoint.position);
        sun.ChangeCamera(playerCam);
    }
示例#14
0
    // Use this for initialization
    void Start()        //When enemy spawns
    {
        sun          = FindObjectOfType <Sun>();
        health       = Mathf.RoundToInt(health + (sun.numberOfDays * 10)); //Spawn with base health damage, money and score. Increased based on how many days have passed
        startHealth  = health;                                             //Set start health value to be used by health bar
        damage       = Mathf.RoundToInt(damage + (sun.numberOfDays * 10));
        moneyForKill = Mathf.RoundToInt(moneyForKill + (sun.numberOfDays * 10));
        scoreForKill = Mathf.RoundToInt(scoreForKill + (sun.numberOfDays * 10));

        pp = FindObjectOfType <PlayerProperties>();
    }
    // Use this for initialization
    void Start()
    {
        sun      = FindObjectOfType <Sun>();
        spawners = new List <GameObject>();
        spawners.AddRange(GameObject.FindGameObjectsWithTag("Spawner"));

        foreach (GameObject go in spawners)
        {
            go.SetActive(false); //Turn all spawners off to begin with
        }
    }
示例#16
0
        protected override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Sky/Upper", false, out subEle))
            {
                SkyUpper.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Fog", false, out subEle))
            {
                Fog.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Unused1", false, out subEle))
            {
                Unused1.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Ambient", false, out subEle))
            {
                Ambient.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sunlight", false, out subEle))
            {
                Sunlight.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sun", false, out subEle))
            {
                Sun.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Stars", false, out subEle))
            {
                Stars.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Sky/Lower", false, out subEle))
            {
                SkyLower.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Horizon", false, out subEle))
            {
                Horizon.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Unused2", false, out subEle))
            {
                Unused2.ReadXML(subEle, master);
            }
        }
示例#17
0
    // Update is called once per frame
    void Update()
    {
        Transform transform = GetComponent <Transform>();

        SunPos = GameObject.FindObjectOfType <Sun>();
        Vector3 angle      = new Vector3(0, -self * Time.deltaTime, 0);
        Vector3 revolution = new Vector3(0, -around * Time.deltaTime, 0);

        transform.Rotate(angle);
        transform.RotateAround(SunPos.transform.position, revolution, around);
    }
    // Use this for initialization
    void Start()
    {
        _sun                  = GameObject.Find("Sun").GetComponent <Sun>();
        _cellManager          = GameObject.Find("CellManager").GetComponent <CellManager>();
        cellSleepingTransform = GameObject.Find("CellSleepTransform").transform;


        //if (loadedScene == Scenes.Cell)
        DynamicGI.UpdateMaterials(GameObject.Find("Cell").GetComponent <Renderer>());

        SetActiveScene();
    }
示例#19
0
        private static void DrawSunRing(RenderWindow app, Sun sun)
        {
            var sunRing      = CreateRing(app, 240, new Color(255, 255, 255), true);
            var sunPegPoints = CreatePegPoints(app, sunRing, 56, (Math.PI * 2) / 56);

            Array.Reverse(sunPegPoints);
            sunPegPoints[sun.Get() - 1].FillColor = new Color(255, 0, 0);
            foreach (var p in sunPegPoints)
            {
                app.Draw(p);
            }
        }
示例#20
0
    // Use this for initialization
    void Start()
    {
        name = DEFAULT_NAMES[DEFAULT_NAMES_POINTER];
        DEFAULT_NAMES_POINTER += 1;

        if (DEFAULT_NAMES_POINTER > DEFAULT_NAMES.Length) {
            DEFAULT_NAMES_POINTER = 0;
        }

        orbit = (Orbit) gameObject.GetComponent("Orbit");
        sun = (Sun) orbit.target.GetComponent("Sun");
    }
示例#21
0
 //是否点击了阳光
 private bool clickSun(int x, int y)
 {
     for (int i = 0; i < map.Suns.Count; i++)
     {
         Sun sun = (Sun)map.Suns[i];
         if (sun.isClick(x, y))
         {
             return(true);
         }
     }
     return(false);
 }
示例#22
0
        public SunMapUnit(Map map, Sun sun, Vector movementOffset)
            : base(map, sun, movementOffset)
        {
            this.sun = sun;

            CoronaInfos = new SunCoronaInfo[sun.Coronas.Count];

            for (int i = 0; i < CoronaInfos.Length; i++)
            {
                CoronaInfos[i] = new SunCoronaInfo(sun.Coronas[i]);
            }
        }
示例#23
0
    private IEnumerator CampRoutine(int seconds)
    {
        var MaxEatPrGob = 4;


        Team.OnFoodFound.Invoke(-Mathf.Min(Team.Food, Team.Members.Count * MaxEatPrGob));

        Sun.Night();

        //FADE up fire
        //TODO: move fade to method
        var start         = Time.time;
        var fadeDuration  = 3;
        var fireIntensity = Light.intensity;

        while (Time.time < start + fadeDuration)
        {
            yield return(new WaitForFixedUpdate());

            Light.intensity = fireIntensity * ((Time.time - start) / fadeDuration);
        }

        //Consume resources - add bonuses
        yield return(new WaitForSeconds(seconds - fadeDuration));

        //TODO: light flicker
        //TODO: campfire sounds

        foreach (var teamMember in Team.Members)
        {
            teamMember.Heal();
        }

        Team.Campfire = null;

        Sun.Day();

        FireSprite.enabled = false;

        //Fading light
        start = Time.time;

        while (Time.time < start + fadeDuration)
        {
            yield return(new WaitForFixedUpdate());

            Light.intensity = fireIntensity * (1 - (Time.time - start) / fadeDuration);
        }
        Light.enabled = false;


        //Destroy(this.gameObject);
    }
示例#24
0
 public void GetSunLongitudeAtJulianDateTest()
 {
     Assert.AreEqual(4.986246180809974, Sun.GetSunLongitudeAtJulianDate(2451550.2083333335), 1E-10);
     //Assert.AreEqual(269.1290096900839,
     //    Astronomy.GetSunLongitudeAtJulianDate(
     //        Astronomy.UniversalDateTimeToJulianDate(new DateTime(2000, 12, 21).AddHours(-7))).ToDegrees(),
     //    1E-10);
     Assert.AreEqual(268.5546509479341,
                     Sun.GetSunLongitudeAtJulianDate(
                         JulianDateConverter.UniversalDateTimeToJulianDate(new DateTime(1990, 12, 21).AddHours(-7))).ToDegrees(),
                     1E-10);
 }
示例#25
0
    void Start()
    {
        sunScript  = GameObject.Find("Sunset").GetComponent <Sun>();
        nightWaves = GameObject.Find("GameManager").GetComponent <NightWavesGen>();

        //Set Day
        SetDay();

        //Set Timer
        time             = new TimeSpan(0, minutes, seconds);
        coroutineStarted = false;
    }
示例#26
0
        private void openGLControl1_OpenGLInitialized(object sender, EventArgs e)
        {
            OpenGL gl = this.openGLControl1.OpenGL;         //Сохраним контекст для отрисовки

            Camera.Init();                                  //Проинициализируем камеру стандартными настройками
            Sun.Init();                                     //Проинициализируем Солнце стандартными настройками
            hMap = new HeightMap("Map.png");                //Получим карту высот из файла, сожержащего шум Перлина

            /*
             * Настроим свет
             * */
            gl.Light(OpenGL.GL_LIGHT0, OpenGL.GL_AMBIENT, Sun.Ambient);
            gl.Light(OpenGL.GL_LIGHT0, OpenGL.GL_DIFFUSE, Sun.Diffuse);
            gl.Light(OpenGL.GL_LIGHT0, OpenGL.GL_SPECULAR, Sun.Specular);
            gl.LightModel(OpenGL.GL_LIGHT_MODEL_TWO_SIDE, OpenGL.GL_TRUE);
            gl.Enable(OpenGL.GL_LIGHTING);
            gl.Enable(OpenGL.GL_LIGHT0);
            gl.ShadeModel(OpenGL.GL_SMOOTH);

            gl.ClearColor(
                1.0f * Color.SkyBlue.R / 255,
                1.0f * Color.SkyBlue.G / 255,
                1.0f * Color.SkyBlue.B / 255,
                0
                );


            gl.Enable(OpenGL.GL_DEPTH_TEST);

            /*
             * Включим обработку текстур
             * */
            gl.Enable(OpenGL.GL_TEXTURE_2D);
            texture.Create(gl, new Bitmap("Rock.jpg"));     //зададим текстуру (по стандарту - камень)

            gl.MatrixMode(OpenGL.GL_PROJECTION);            //установим матрицу проекции

            //  Единичная матрица для последующих преобразований
            gl.LoadIdentity();

            //  Преобразование
            gl.Perspective(
                60.0f,
                (double)Width / (double)Height,
                0.01,
                Math.Max(hMap.Map.GetLength(0), hMap.Map.GetLength(1)) * STEP);

            //  Зададим модель отображения
            gl.MatrixMode(OpenGL.GL_MODELVIEW);

            texture.Bind(gl);
        }
示例#27
0
文件: Sun.cs 项目: frozen4/UnityPlus
    public override void OnInspectorGUI()
    {
        Sun sun = target as Sun;

        EditorGUILayout.PropertyField(sp2);
        EditorGUILayout.PropertyField(sp3);
        EditorGUILayout.PropertyField(sp4);
        EditorGUILayout.PropertyField(sp5);

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();
    }
示例#28
0
 protected override void WriteData(ESPWriter writer)
 {
     SkyUpper.WriteBinary(writer);
     Fog.WriteBinary(writer);
     Unused1.WriteBinary(writer);
     Ambient.WriteBinary(writer);
     Sunlight.WriteBinary(writer);
     Sun.WriteBinary(writer);
     Stars.WriteBinary(writer);
     SkyLower.WriteBinary(writer);
     Horizon.WriteBinary(writer);
     Unused2.WriteBinary(writer);
 }
        private static GameData SetSunData(GameData data)
        {
            Sun sun = GameObject.FindObjectOfType <Sun>();

            if (data == null || sun == null)
            {
                return(data);
            }

            data.sun = sun.GetData();

            return(data);
        }
示例#30
0
    // Start is called before the first frame update
    void Start()
    {
        navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>();
        health       = GetComponent <EnemyHealth>();
        audioPlayer  = GetComponent <AudioSource>();
        target       = GameObject.Find("Player").transform;
        sun          = FindObjectOfType <Sun>();

        float triggerTime = Random.Range(0, triggeredLimit);

        Debug.Log(triggerTime);
        Invoke("TriggerHuntingZombie", triggerTime);
    }
示例#31
0
        void Update()
        {
            _moon = new Moon(App.SelectedDate, LocationManager.Geoposition.Latitude, LocationManager.Geoposition.Longitude, TimeZoneInfo.FindSystemTimeZoneById(LocationManager.Geoposition.TimeZone));
            _sun  = new Sun(App.SelectedDate, LocationManager.Geoposition.Latitude, LocationManager.Geoposition.Longitude, TimeZoneInfo.FindSystemTimeZoneById(LocationManager.Geoposition.TimeZone));

            OnPropertyChanged(nameof(Date));
            OnPropertyChanged(nameof(DawnTime));
            OnPropertyChanged(nameof(DuskTime));
            OnPropertyChanged(nameof(FoolMoonDate));
            OnPropertyChanged(nameof(MoonIcon));
            OnPropertyChanged(nameof(NewMoonDate));
            OnPropertyChanged(nameof(PhasePercent));
        }
示例#32
0
        public void Can_use_long_as_id()
        {
            using(var store = NewDocumentStore())
            {
                using(var s = store.OpenSession())
                {
                    var entity = new Sun{Name = "Terra"};
                    s.Store(entity);

                    s.SaveChanges();

                    Assert.Equal(1, entity.Id);
                    Assert.Equal("suns/1", s.Advanced.GetDocumentId(entity));
                }
            }
        }
示例#33
0
文件: Sun.cs 项目: HatiEth/GGJ2016
    // Use this for initialization
    void Start () {
        l = GetComponent<Light>();
        l.color = dayColor;
        sun = this;
        l.shadowStrength = 0.6f;
        Camera.main.GetComponent<SunShafts>().sunColor = l.color;
        if (Camera.main.GetComponent<SunShafts>()==null)
            Camera.main.gameObject.AddComponent<SunShafts>();
        if (!Camera.main.GetComponent<SunShafts>().isActiveAndEnabled)
            Camera.main.GetComponent<SunShafts>().enabled=true;
        Camera.main.GetComponent<SunShafts>().sunTransform = l.transform;

        RenderSettings.fog = true;
        RenderSettings.fogColor = Color.black;
        RenderSettings.fogMode = FogMode.ExponentialSquared;

        RenderSettings.reflectionIntensity = reflectday;
    }
示例#34
0
    public static void Inspector(Sun s)
    {
        s.noFlare = GuiTools.Toggle("No lensflare",s.noFlare,true);
        if (!s.noFlare){
            s.SunFlare = (Flare)EditorGUILayout.ObjectField("Flare",s.SunFlare,typeof(Flare),true);
        }

        EditorGUILayout.Space();
        s.onlyFlare = GuiTools.Toggle("Only lensflare",s.onlyFlare,true);
        if (!s.onlyFlare){
            s.directionalLight.color = EditorGUILayout.ColorField( "Light color",s.directionalLight.color);
        }

        EditorGUILayout.Space();

        s.lockView = GuiTools.Toggle("Lock view",s.lockView,true);

        // Position
        EditorGUI.BeginChangeCheck();
        s.Longitude = EditorGUILayout.Slider("Longitude",s.Longitude,-180f,180f);
        if (EditorGUI.EndChangeCheck()){
            if (s.lockView)
                GuiTools.SetSceneCamera( -s.Latitude, s.Longitude);
        }

        EditorGUI.BeginChangeCheck();
        s.Latitude = EditorGUILayout.Slider("latitude",s.Latitude,-90f,90f);
        if (EditorGUI.EndChangeCheck()){
            if (s.lockView)
                GuiTools.SetSceneCamera( -s.Latitude, s.Longitude);
        }

        if (GUI.changed){
            EditorUtility.SetDirty( s);
        }
    }
示例#35
0
 void OnEnable()
 {
     sunlightScript = sunLight.GetComponent(typeof(Sun)) as Sun;
 }
示例#36
0
 void Start()
 {
     sunlightScript = sunLight.GetComponent(typeof(Sun)) as Sun;
     set=gameObject.GetComponent("Settings") as Settings;
 }
	void Start () {
        sunlightScript = sunLight.GetComponent(typeof(Sun)) as Sun;
	}
示例#38
0
    public static void SunProperties(Sun s)
    {
        #region Header
        EditorGUILayout.BeginHorizontal();
        Color crossColor = Color.red;

        int width = Screen.width-90;
        if (s.isWaitToDelte){
            crossColor= Color.white;
            width =  Screen.width-134;
        }

        // Delete
        if (GuiTools.Button("X",crossColor,19)){
            s.isWaitToDelte = !s.isWaitToDelte;
        }
        if (s.isWaitToDelte){
            if (GuiTools.Button("Delete",Color.red,50)){
                DestroyImmediate( s.gameObject );
                return;
            }
        }

        bool showProperties = GuiTools.ChildFoldOut( s.inspectorShowProperties,"Sun",new Color(183f/255f,230f/255f,252f/255f),width);
        if (showProperties !=s.inspectorShowProperties){
            s.inspectorShowProperties = showProperties;
        }

        GUI.backgroundColor = Color.green;
        if (GUILayout.Button (new GUIContent("S"),GUILayout.Width(19))){
            GuiTools.SetSceneCamera( -s.Latitude, s.Longitude);
            s.inspectorShowProperties = true;
        }
        GUI.backgroundColor = Color.white;

        EditorGUILayout.EndHorizontal();
        #endregion

        #region treatment
        if (s.inspectorShowProperties){
            EditorGUI.indentLevel++;
            SunInspector.Inspector( s);
            EditorGUI.indentLevel--;
        }
        #endregion
    }
示例#39
0
 public void UnselectSystem()
 {
     gameState = ViewState.GALACTIC_VIEW;
     selectedSystem = null;
 }
示例#40
0
 public Sun.Core.DBContext.Page<Sun.Core.Logging.LogInfo> Page(int rows, int page, Sun.Core.Logging.LogLevel? level = null, string title = null, bool? status = null)
 {
     throw new NotImplementedException();
 }
        public static void SetTransformed(bool transformed)
        {
            Debug.Log("JoolNova - SetTransformed = " + transformed);
            // Initialize static variables
            if (jool == null)
            {
                Debug.Log("JoolNova - Doing one-time setup");
                jool = PSystemManager.Instance.localBodies.Find(b => b.name == "Jool");
                sun = PSystemManager.Instance.localBodies.Find(b => b.name == "Sun");

                // Setup materials
                MeshRenderer sunRenderer = sun.scaledBody.GetComponent<MeshRenderer>();
                MeshRenderer joolRenderer = jool.scaledBody.GetComponent<MeshRenderer>();
                joolMaterial = joolRenderer.material;

                sunMaterial = Instantiate(sunRenderer.material) as Material;
                sunMaterial.SetColor(Shader.PropertyToID("_EmitColor0"), newSunColor);
                sunMaterial.SetColor(Shader.PropertyToID("_EmitColor1"), newSunColor2);
                sunMaterial.SetColor(Shader.PropertyToID("_RimColor"), newSunColor3);

                // Add in sun shader
                SunShaderController sunShader = sun.scaledBody.gameObject.GetComponent<SunShaderController>();
                SunShaderController joolSunShader = jool.scaledBody.gameObject.AddComponent<SunShaderController>();
                foreach (FieldInfo field in typeof(SunShaderController).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    field.SetValue(joolSunShader, field.GetValue(sunShader));
                }
                joolSunShader.enabled = false;

                // Add in the coronas
                foreach (Transform t in sun.scaledBody.transform)
                {
                    if (t != null && t.gameObject != null)
                    {
                        GameObject corona = (GameObject)Instantiate(t.gameObject);
                        corona.name = "Corona";
                        corona.transform.parent = jool.scaledBody.transform;
                        corona.SetActive(false);

                        corona.transform.localPosition = Vector3.zero;

                        MeshRenderer coronaRenderer = corona.GetComponent<MeshRenderer>();

                        Texture2D coronaTex = GameDatabase.Instance.GetTexture("ContractPacks/JoolianEncounter/Images/redsuncorona", false);
                        coronaRenderer.material = Instantiate(coronaRenderer.material) as Material;
                        coronaRenderer.material.SetColor(Shader.PropertyToID("_TintColor"), newSunColor);
                        coronaRenderer.material.SetTexture(Shader.PropertyToID("_MainTex"), coronaTex);
                    }
                }
            }

            // Remove the sun object
            if (secondSun != null && !transformed)
            {
                Destroy(secondSun.gameObject);
                secondSun = null;
            }

            // Do the transform
            if (JoolNova.transformed != transformed)
            {
                JoolNova.transformed = transformed;

                MeshRenderer joolRenderer = jool.scaledBody.GetComponent<MeshRenderer>();

                // Set the material
                joolRenderer.material = transformed ? sunMaterial : joolMaterial;

                // Turn components on/off
                joolRenderer.GetComponent<SunShaderController>().enabled = transformed;
                joolRenderer.GetComponent<ScaledSpaceFader>().enabled = !transformed;
                joolRenderer.GetComponent<MaterialSetDirection>().enabled = !transformed;
                joolRenderer.GetComponent<MeshRenderer>().enabled = true;

                // Turn gameObjects on/off
                foreach (Transform t in joolRenderer.transform)
                {
                    if (t != null && t.gameObject != null)
                    {
                        t.gameObject.SetActive((t.gameObject.name == "Atmosphere") ^ transformed);
                    }
                }
            }
        }
示例#42
0
 public void SelectSystem(Sun sun)
 {
     gameState = ViewState.SYSTEM_VIEW;
     selectedSystem = sun;
 }
        private void Update()
        {
            if (state == State.JOOL_SHRINK)
            {
                joolScale -= SHRINK_RATE * Time.deltaTime;
            }
            else if (state == State.SUN_GROW || state == State.EXPLOSION_GROW)
            {
                float x = (Time.time - stateTime);
                if (state == State.SUN_GROW)
                {
                    float xGR = x * GROW_RATE;
                    if (x < 2 * (FINAL_SCALE - SHRUNK_SCALE) / GROW_RATE)
                    {
                        // This is calculated as a quadratic to give a smoothed growth
                        // b = GROWTH_RATE (to match the initial kick of the explosion
                        // c = SHRUNK_SCALE (to match the starting size)
                        // a = calculated such that at (y = FINAL_SCALE) we have a local maximum

                        joolScale = -(xGR * xGR) / (4 * FINAL_SCALE - SHRUNK_SCALE) + xGR + SHRUNK_SCALE;
                    }
                    else
                    {
                        joolScale = FINAL_SCALE;
                    }
                }
                explosionScale = (SHRUNK_SCALE + x * GROW_RATE) * 1.01f;
            }

            if (transformed && secondSun == null)
            {
                Debug.Log("JoolNova: Setting up second sun");
                Sun old = Sun.Instance;
                secondSun = Instantiate(Sun.Instance) as Sun;
                Sun.Instance = old;
                foreach (FieldInfo field in typeof(Sun).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
                {
                    if (field.GetValue(secondSun) == null)
                    {
                        field.SetValue(secondSun, field.GetValue(old));
                    }
                }

                secondSun.GetComponent<Light>().color = newSunColor;
                secondSun.gameObject.SetActive(true);
                secondSun.sun = jool;
                secondSun.sunFlare.color = newSunColor;
                secondSun.sunFlare.brightness *= 0.25f;
                secondSun.enabled = true;
                secondSun.useLocalSpaceSunLight = true;
                secondSun.SunlightEnabled(transformed);
            }

            if (secondSun != null)
            {
                // Set the light intensity for our red dwarf - this seems to want to get reset
                Light sunlight = sunLightField.GetValue(secondSun) as Light;
                sunlight.intensity = 0.5f;
            }
        }
示例#44
0
 public int Insert(Sun.Core.Logging.LogInfo info)
 {
     var sql = "INSERT INTO loginfo(ipaddress,level,title,message,logtime,status)values(@0,@1,@2,@3,@4,@5)";
     return DBContext.Instance.Execute(new Sql(sql, info.IPAddress, info.Level, info.Title, info.Message, info.LogTime, info.Status));
 }
示例#45
0
        void Start()
        {
            /// UI setup
            busyIndicator = GameObject.Find("BusyIndicator");
            showLoading();

            /// Data setup
            loadMaterials();
            loadItems();
            loadRecipes();

            /// Environment setup
            clock = GameObject.Find("Clock").GetComponent<Text>();
            daytime = GameObject.Find("Sun").GetComponent<Sun>();

            /// Scene setup
            Type t = Type.GetType("com.qetrix.apps.quly." + sceneName);
            scene = (Scene) Activator.CreateInstance(t);
            MethodInfo method = t.GetMethod("init", BindingFlags.Instance | BindingFlags.Public);
            if (method != null) method.Invoke(scene, null);

            /// Player setup
            var cam = GameObject.Find(players[0].name() + "/QulyCam").GetComponent<QulyCam>();
            cam.player(players[1]);

            /// Qules setup
            foreach (Qule q in scene.qules) {
                Vector3 pos = q.transform().position();
                if (pos.y == -1) {
                    pos = new Vector3(pos.x, Terrain.activeTerrain.SampleHeight(pos) + 2, pos.z);
                    Debug.Log("New pos:" + pos + " for " + q.name());
                }
                QuleMB qq = (Instantiate(Resources.Load("Prefabs/Qule"), pos, q.transform().rotation()) as GameObject).GetComponent<QuleMB>();
                qq.q(q);
                qq.tag = (cam.playerFamily() == q.family() ? "Family" : "Neutral"); // TODO!!!!
                if (q.npc() != null) {
                    qq.gameObject.AddComponent(Type.GetType("com.qetrix.apps.quly." + q.npc(), true, true));
                    qq.gameObject.AddComponent<EnergyManager>().scriptCalled = q.npc();
                    qq.tag = "Neutral";
                    qq.GetComponent<Rigidbody>().sleepThreshold = 1f;
                }
                qq = null;
            }
            hideLoading();
        }
示例#46
0
 public int Clear(DateTime endTime, Sun.Core.Logging.LogLevel? level = null, bool status = true)
 {
     throw new NotImplementedException();
 }
示例#47
0
 void Start()
 {
     cam = Camera.main;
     sunlightScript = sunLight.GetComponent(typeof(Sun)) as Sun;
 }