private Color BlendColor(int currentSeconds, int days)
    {
        int startIndex  = ColorAtMarkers.Length - 1;
        int finishIndex = 0;

        int day = days;

        while (currentSeconds > TimeManagerScript.ToSeconds(day, HourMarkers[finishIndex], 0, 0))
        {
            startIndex++;
            finishIndex++;

            startIndex  %= ColorAtMarkers.Length;
            finishIndex %= ColorAtMarkers.Length;

            if (finishIndex == 0)
            {
                day++;
            }
        }

        int startSecs  = TimeManagerScript.ToSeconds(day + ((finishIndex == 0) ? -1 : 0), HourMarkers[startIndex], 0, 0);
        int finishSecs = TimeManagerScript.ToSeconds(day, HourMarkers[finishIndex], 0, 0);

        int   delta = finishSecs - startSecs;
        float t     = ((float)(currentSeconds - startSecs)) / delta;

        //Debug.Log("Delta: " + delta + ", t = " + t.ToString("n3"));

        return(BlendColor(ColorAtMarkers[startIndex], ColorAtMarkers[finishIndex], t));
    }
 private void Awake()
 {
     saveStorageScript    = GameObject.FindWithTag("SaveStorage").GetComponent <SaveStorageScript>();
     timeManagerScript    = GameObject.FindWithTag("TimeManager").GetComponent <TimeManagerScript>();
     airBarScript         = GameObject.FindWithTag("AirBar").GetComponent <AirBarScript>();
     pearlScript          = GameObject.FindWithTag("PearlCount").GetComponent <PearlScript>();
     playerController     = GameObject.FindWithTag("Player").GetComponent <PlayerController>();
     shopControllerScript = shopController.GetComponent <ShopController>();
 }
Esempio n. 3
0
    public override void DoAction()
    {
        //sprawdź czy wpis został już dodany do dziennika

        JournalEntry entry = Entry.GetEntry(TimeManagerScript.GetDate());

        JournalUIScript.TryInsertEntry(entry);
        //wstaw do dziennika
    }
Esempio n. 4
0
 public override void DoAction()
 {
     if (VarianceSet)
     {
         TimeManagerScript.AdvanceTimeWithRandomVariance(VarianceValue, Seconds);
     }
     else
     {
         TimeManagerScript.AdvanceTime(Seconds);
     }
 }
    // Use this for initialization
    void Start()
    {
        this.correctInstance = true;

        TimeFlowCoroutine = StartCoroutine(CountTime());
        OnMinutePassed   += WriteDate;

        if (ManagerScriptInstance == null)
        {
            ManagerScriptInstance = this;
        }
    }
    private void TimeManager_OnMinutePassed()
    {
        int sec;
        int min;
        int hr;

        TimeManager.GetHour(out sec, out min, out hr);

        Color PanelColor = BlendColor(TimeManagerScript.ToSeconds(TimeManager.Day, hr, min, sec), TimeManager.Day);

        Panel.color = PanelColor;
    }
    public override bool ConditionTest()
    {
        WorldDate currentDate     = TimeManagerScript.GetDate();
        bool      finishIsNextDay =
            (HoursOnly)? Start.ToSecondsHoursOnly() > Finish.ToSecondsHoursOnly() : false;
        bool currentIsNextDay = finishIsNextDay && Finish.ToSecondsHoursOnly() >= currentDate.ToSecondsHoursOnly();


        return
            ((HoursOnly) ?
             CompareHoursOnly(currentDate, currentIsNextDay, finishIsNextDay) :
             CompareFullDates(currentDate));
    }
    void Start()
    {
        if (timeManager == null)
        {
            DontDestroyOnLoad(this.gameObject);
            timeManager = this;
        }
        else if (timeManager != this)
        {
            Destroy(this.gameObject);
        }

        startTime = DateTime.Now;
    }
Esempio n. 9
0
    void Start()
    {
        MapDisplay  = GetComponent <RectTransform>();
        TimeManager = GameObject.Find("Time Manager").GetComponent <TimeManagerScript>();

        Edges = new Dictionary <Vector2, List <Edge> >();
        Edge[] edges = EdgesSource.GetComponentsInChildren <Edge>();

        foreach (Edge e in edges)
        {
            if (!Edges.ContainsKey(e.A))
            {
                e.SetMap(this);
                Edges.Add(e.A, new List <Edge>());
            }

            if (!Edges.ContainsKey(e.B))
            {
                e.SetMap(this);
                Edges.Add(e.B, new List <Edge>());
            }

            Edges[e.A].Add(e);
            Edges[e.B].Add(e);

            /*
             * int totalEdges = 0;
             *
             * foreach(KeyValuePair<Vector2, List<Edge>> pair in Edges)
             * {
             *  totalEdges += pair.Value.Count;
             * }
             *
             * Debug.Log("Dodaje do mapy krawędź: " + e.transform.name + " From: " + e.From + " To: " + e.To + ", Vertex Count: " + Edges.Count + " Edge Count: " + totalEdges);
             */
        }

        Pathfinder = GetComponent <AStarPathfindingScript>();
        Pathfinder.SetEdges(Edges);

        if (Pathfinder.LastPlayerWaypoint != null)
        {
            Entered(Pathfinder.LastPlayerWaypoint);
            Pathfinder.PlayerWorldPosition = Pathfinder.LastPlayerWaypoint.WorldCoords;
        }

        PlayerStats = GameObject.Find("Game Info Component").GetComponent <CharacterInfoScript>();
    }
    void Awake()
    {
        Panel = gameObject.GetComponent <Image>();

        TimeManager = GameObject.Find("Time Manager").GetComponent <TimeManagerScript>();
        TimeManager.OnMinutePassed += TimeManager_OnMinutePassed;

        TimeManager_OnMinutePassed();

        HourMarkersInSeconds = new int[HourMarkers.Length];

        for (int i = 0; i < HourMarkers.Length; i++)
        {
            HourMarkersInSeconds[i] = TimeManagerScript.ToSeconds(0, HourMarkers[i], 0, 0);
        }
    }
Esempio n. 11
0
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
Esempio n. 12
0
    bool DrawAdvanceTimeField(int prevSeconds, int labelWidth, out int newSeconds)
    {
        bool result = false;

        WorldDate temp    = new WorldDate(prevSeconds, 0, 0, 0);
        int       seconds = temp.Seconds;
        int       minutes = temp.Minutes;
        int       hours   = temp.Hours;
        int       days    = temp.Days;

        EditorGUILayout.BeginVertical(Config.FoldoutInteriorStyle);
        {
            result |= DrawGenericIntField(days, labelWidth, "Days", out days, 0);
            result |= DrawGenericIntField(hours, labelWidth, "Hours", out hours, 0);
            result |= DrawGenericIntField(minutes, labelWidth, "Minutes", out minutes, 0);
            result |= DrawGenericIntField(seconds, labelWidth, "Seconds", out seconds, 0);
        }
        EditorGUILayout.EndVertical();

        newSeconds = TimeManagerScript.ToSeconds(days, hours, minutes, seconds);

        return(result);
    }
    public override bool ConditionTest()
    {
        WorldDate currentDate = TimeManagerScript.GetDate();

        return(Date.CompareTo(currentDate, TimeOrientation, false, false));
    }
Esempio n. 14
0
 public void Use()
 {
     TimeManagerScript.AdvanceTime(TimeConsumed);
 }