// Use this for initialization
    void Start()
    {
        skybox.SetColor("_SkyTint", skyboxColors[0]);
        dirLight.color = sunColors[0];
        SunControl     = GetComponent <DayNightSystem>();

        indexSuivant = Mathf.Abs(Mathf.Deg2Rad * 180f * ((float)(i + 1) / (float)sunColors.Length)) / Mathf.PI;
    }
 // Use this for initialization
 void Start()
 {
     m_Animation       = GetComponent <Animation>();
     m_CurrentKeyState = Idle;
     m_StartPos        = transform.position;
     m_TargetPos       = m_StartPos;
     DayNightSystem.AddDayNightEventHandler(UpdateDayNight);
     m_Transform = transform;
 }
    private void Awake()
    {
        if (instance != null)
        {
            Msg.instance.Print(Msg.ErrorType.Error, 25, "More than one DayNightSystem in scene !", true, false);
            return;
        }

        instance = this;
    }
Exemple #4
0
        public string Execute(byte?hour = null, byte minute = 0)
        {
            if (!hour.HasValue)
            {
                // reset
                DayNightSystem.ServerResetTimeOfDayOffset();
                return(null);
            }

            DayNightSystem.ServerSetCurrentTimeOfDay(hour.Value, minute);
            return(null);
        }
Exemple #5
0
    void CheckCameraInWater()
    {
        if (m_Player != null && m_Player.m_Room != null && m_Player.m_SwimState != SwimmingState.None)
        {
            float    water_level = m_Player.m_Room.GetCenterPoint().y;
            Bounds   b           = m_Player.m_Room.GetBound();
            Material room_mat    = LevelManager.GetSharedMaterial();

            if (b.Contains(m_CameraTransform.position) && !m_bCameraInWater)
            {
                //Debug.Log("Camera In Water");
                //if(room_mat.color != water_color)
                //{
                //room_mat.color = water_color;
                //}

                DayNightSystem.SetAmbientTint(1);
                //do following shader update on entering water

                room_mat.SetFloat("_InSideWater", 1);
                room_mat.SetFloat("_WaterPlaneY", water_level);

                LevelManager.UpdateWaterHolderMaterials(1);
                m_bCameraInWater = true;
                if (m_SoundManager != null)
                {
                    m_SoundManager.PlayUnderWaterAmbient(m_bCameraInWater);
                }
            }

            if (m_CameraTransform.position.y > water_level && m_bCameraInWater)
            {
                //if(room_mat.color != Color.white)
                //{
                //room_mat.color = Color.white;
                //}

                DayNightSystem.SetAmbientTint(0);

                //do following shader update on exiting water
                room_mat.SetFloat("_InSideWater", 0);
                LevelManager.UpdateWaterHolderMaterials(0);

                m_bCameraInWater = false;
                if (m_SoundManager != null)
                {
                    m_SoundManager.PlayUnderWaterAmbient(m_bCameraInWater);
                }
            }
        }
    }
Exemple #6
0
    // Use this for initialization
    void Start()
    {
        m_DisplayRect = new Rect(0, Screen.height - 25, Screen.width, 100);
        m_HtmlFormat  = "<size=30> Temple Of <color=yellow>Gold</color> </size>";


        m_HealthHtmlFormatRect = new Rect(50, 25, 100, 100);
        m_HealthDisplayRect    = new Rect(m_HealthHtmlFormatRect.xMax, m_HealthHtmlFormatRect.yMin, 100, 100);
        m_HealthHtmlFormat     = "Health ";    //"<size=30> <color=yellow>Health</color> </size>";;
        m_HealthDisplayInfo    = "100.00";

        m_TimeDisplayRect    = new Rect(Screen.width - 200, 25, Screen.width, 100);
        m_TimeHtmlFormatRect = new Rect(m_TimeDisplayRect.xMin - 70, m_TimeDisplayRect.yMin, 100, 100);
        m_TimeDisplayFormat  = "Time ";       //"<size=30> <color=yellow>Time</color> </size>";
        m_DayTime            = 0;

        DayNightSystem.AddDayTimeEventHandler(HandleGUIDayTime);


        m_GUIStyle                  = new GUIStyle();
        m_GUIStyle.font             = m_GUIFont;
        m_GUIStyle.normal.textColor = Color.red;
        m_GUIStyle.imagePosition    = ImagePosition.TextOnly;
        //m_GUIStyle.richText = true;

        m_DisplayFormatStyle = new GUIStyle();
        m_DisplayFormatStyle.normal.textColor = Color.yellow;
        m_DisplayFormatStyle.font             = m_GUIFont;
        m_DisplayFormatStyle.imagePosition    = ImagePosition.TextOnly;

        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            m_Helptext =
                "Run – Double tap screen and hold.\n" +
                "Look around – Touch screen and move your fingers.\n" +
                "Pull up -   Get close to a platform double tap screen.";
        }
        else
        {
            m_Helptext =
                "Run/Swim - Up arrow\n" +
                "Walk - Num 5\n" +
                "Jump/Dive - Right mouse button\n" +
                "Look around - Move mouse while pressing left mouse button.\n" +
                "Long Jump - Press jump while you are running.\n" +
                "Short Jump - Press up arrow + jump same time.\n" +
                "Pull up -   Get close to a platform and press up arrow + left mouse button.\n";
        }
    }
Exemple #7
0
Fichier : Map.cs Projet : Pircs/Yi
        public void Enter(YiObj obj)
        {
            Entities.AddOrUpdate(obj.UniqueId, obj);

            switch (obj)
            {
            case Npc npc:
                AddNpc(obj);
                break;

            case DynamicNpc npc:
                AddNpc(obj);
                break;

            case Monster monster:
                AddMob(obj);
                break;

            case FloorItem item:
                AddItem(obj);
                break;
            }

            (obj as Player)?.Send(MsgAction.MapShowPacket(obj));
            (obj as Player)?.Send(MsgStatus.Create(Id, (uint)Flags));

            if (!ScreenSystem.Entities.ContainsKey(obj.UniqueId))
            {
                ScreenSystem.Create(obj);
            }

            ScreenSystem.Update(obj);

            if (!(obj is Player player))
            {
                return;
            }

            WeatherSystem.SetWeatherFor(player);
            DayNightSystem.SetTimeFor(player);
        }
    //private bool equationCorrect;

    /* void Start()
     * {
     *   equation = dangerEquation.GetComponentInChildren<InputField>();
     *   dangerEquationInfo = dangerEquation.transform.Find("Info").GetComponent<Text>();
     *   saveDangerEqButton = dangerEquation.GetComponentInChildren<Button>();
     *
     *   nightAtack = GameObject.FindGameObjectWithTag("DayNightSystem").GetComponent<EnemiesNightAtack>();
     *   equation.text= nightAtack.difficultyEquation;
     *   IsEquationCorrect(nightAtack.difficultyEquation);
     *
     *  Pathfinding.GridGraph gGraph = AstarPath.active.data.gridGraph;
     *   diameter.value = gGraph.collision.diameter;
     *   nearestNode.value = gGraph.active.maxNearestNodeDistance;
     *   heuristicScale.value = gGraph.active.heuristicScale;
     *
     * }*/
    private void OnEnable()
    {
        AddWorldStats();
        if (dangerEquation != null)
        {
            equation           = dangerEquation.GetComponentInChildren <InputField>();
            dangerEquationInfo = dangerEquation.transform.Find("Info").GetComponent <Text>();
            saveDangerEqButton = dangerEquation.GetComponentInChildren <Button>();

            nightAtack     = GameObject.FindGameObjectWithTag("DayNightSystem").GetComponent <EnemiesNightAtack>();
            dayNightSystem = GameObject.FindGameObjectWithTag("DayNightSystem").GetComponent <DayNightSystem>();
            equation.text  = nightAtack.difficultyEquation;
            IsEquationCorrect(nightAtack.difficultyEquation);

            daySlider.value  = dayNightSystem.dayTime;
            nightSider.value = dayNightSystem.nightTime;

            Pathfinding.GridGraph gGraph = AstarPath.active.data.gridGraph;
            diameter.value       = gGraph.collision.diameter;
            nearestNode.value    = gGraph.active.maxNearestNodeDistance;
            heuristicScale.value = gGraph.active.heuristicScale;
        }
    }
Exemple #9
0
 // Use this for initialization
 void Start()
 {
     light = GetComponent <Light>();
     DayNightSystem.AddDayNightEventHandler(UpdateDayNight);
 }