Example #1
0
    void ProgressRecipe()
    {
        if (CanProgress == false)
        {
            print("can't progress");
            return;
        }
        print("progress");
        if (AutomaticProgression)
        {
            CurrentProgress += (Time.deltaTime * CraftingManager.Instance.CraftingSpeed) * 60;
        }
        else
        {
            CurrentProgress += Time.deltaTime * CraftingManager.Instance.CraftingSpeed;
        }
        // print("progress: " + CurrentProgress);
        Color newcolor = Color.white;

        newcolor.a         = MapRangeExtension.MapRange(CurrentProgress, 0f, TargetProgress, 0.1f, 1f);
        RecipeSprite.color = newcolor;
        if (OnRecipeProgress != null)
        {
            OnRecipeProgress();
        }
        if (CurrentProgress >= TargetProgress)
        {
            RecipeDone();
        }
    }
    void Rotate()
    {
        // transform.Rotate(new Vector3(0, 0, 360f / (24 * 60)));
        int   currentMinutes = (TimeManager.Instance.CurrentHour * 60) + TimeManager.Instance.CurrentMinute;
        float rot            = MapRangeExtension.MapRange(currentMinutes, 0, 1440, 0, 360);

        transform.eulerAngles = new Vector3(0, 0, rot);
    }
Example #3
0
 public void Load()
 {
     if (CurrentRecipe != null)
     {
         RecipeSprite.sprite = CurrentRecipe.Recipe.Outputs[0].ContainedItem.Icon;
         Color newcolor = Color.white;
         newcolor.a         = MapRangeExtension.MapRange(CurrentProgress, 0f, TargetProgress, 0.1f, 1f);
         RecipeSprite.color = newcolor;
     }
     if (GetComponent <CraftingStationContextualHUD>() != null)
     {
         GetComponent <CraftingStationContextualHUD>().Load();
     }
 }
Example #4
0
    // Update is called once per frame
    protected override void UpdateUI()
    {
        if (Target == null)
        {
            return;
        }
        if (ValueText != null)
        {
            ValueText.text = Target.GetValueText();
        }
        Vector2 pos = Arrow.GetComponent <RectTransform> ().anchoredPosition;

        pos.x = MapRangeExtension.MapRange(Target.CurrentValue, 37f, 47f, -32f, 32f);
        Arrow.GetComponent <RectTransform> ().anchoredPosition = pos;
    }
    // Update is called once per frame
    void LateUpdate()
    {
        float currentMinutes = (TimeManager.Instance.CurrentHour * 60) + TimeManager.Instance.CurrentMinute;
        float targetMinutes  = NextDayPhase.DayPhaseHours[0] * 60f;

        float phaseStartTime = 0;
        float phaseEndTime   = CurrentDayPhase.DayPhaseHours.Count * 60;

        currentMinutes = MapRangeExtension.MapRange(currentMinutes, 0, 24 * 60, phaseStartTime, phaseEndTime);

        float targetRed   = MapRangeExtension.MapRange(currentMinutes, phaseStartTime, phaseEndTime, CurrentDayPhase.SunColor.r, NextDayPhase.SunColor.r);
        float targetGreen = MapRangeExtension.MapRange(currentMinutes, phaseStartTime, phaseEndTime, CurrentDayPhase.SunColor.g, NextDayPhase.SunColor.g);
        float targetBlue  = MapRangeExtension.MapRange(currentMinutes, phaseStartTime, phaseEndTime, CurrentDayPhase.SunColor.b, NextDayPhase.SunColor.b);

        Sun.intensity = MapRangeExtension.MapRange(currentMinutes, phaseStartTime, phaseEndTime, CurrentDayPhase.SunIntensity, NextDayPhase.SunIntensity);
        Sun.color     = new Color(targetRed, targetGreen, targetBlue);
    }
Example #6
0
 // Update is called once per frame
 protected virtual void UpdateUI()
 {
     if (Target == null)
     {
         return;
     }
     if (ValueText != null)
     {
         ValueText.text = Target.GetValueText();
     }
     if (Reverse)
     {
         FillImage.value = MapRangeExtension.MapRange(Target.CurrentValue, Target.BaseMinValue, Target.BaseMaxValue, 1f, 0f);
     }
     else
     {
         FillImage.value = MapRangeExtension.MapRange(Target.CurrentValue, Target.BaseMinValue, Target.BaseMaxValue, 0f, 1f);
     }
 }
Example #7
0
    private void StartRace()
    {
        int i = 0;

        foreach (KeyValuePair <string, float> competitor in BlossomCompetitionManager.Instance.CurrentResults)
        {
            float       speed                    = MapRangeExtension.MapRange(competitor.Value, 0, BlossomCompetitionManager.Instance.GetCompetitionMaxScore(), 0.75f, 1.25f);
            DOTweenPath path                     = Blossoms[i].GetComponent <DOTweenPath>();
            path.GetTween().timeScale            = speed * 0.25f;
            BlossomAppearance         appearance = Blossoms[i].GetComponent <BlossomAppearance>();
            string                    id         = competitor.Key;
            string                    growth     = DialogueLua.GetVariable(id + "Growth").AsString;
            string                    color      = DialogueLua.GetVariable(id + "Color").AsString;
            BlossomData.BlossomGrowth growthData = (BlossomData.BlossomGrowth)System.Enum.Parse(typeof(BlossomData.BlossomGrowth), growth);
            appearance.SetAppearance(growthData, color);
            string name = DialogueLua.GetVariable(id + "Name").AsString;
            Blossoms[i].GetComponentInChildren <TextMeshProUGUI>().text = name;
            i++;
            path.DOPlay();
        }
    }
Example #8
0
 public void RecipeProgress()
 {
     ProgressBar.value = MapRangeExtension.MapRange(TargetStation.CurrentProgress, 0, TargetStation.TargetProgress, 0, 1);
 }