Beispiel #1
0
    private void OnEnable()
    {
        ComputeIndexes();

        if (!UnityEngineUtils.IsInPlayModeOrAboutToPlay())
        {
            return;
        }
        isAssistMode.OnChange           += OnAssistModeChange;
        currentTiers.OnStatsChangeEvent -= OnStatsChanged;
    }
Beispiel #2
0
    private void OnDisable()
    {
        if (!UnityEngineUtils.IsInPlayModeOrAboutToPlay())
        {
            return;
        }

        currentPlayerStats.OnChangeEvent     -= OnStatsChange;
        currentProjectileStats.OnChangeEvent -= OnStatsChange;
        GameTime.Instance.RemoveTimeListener(this);
    }
Beispiel #3
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (UnityEngineUtils.IsInPlayModeOrAboutToPlay() && GUILayout.Button("Test Use"))
        {
            //actionUI.AnimateTurnActions(() =>
            //{

            //});
        }
    }
Beispiel #4
0
    private IEnumerator InvincibleRoutine()
    {
        while (GameTime.Instance.GameSpeed <= 0)
        {
            yield return(new WaitForEndOfFrame());
        }

        if (GameTime.Instance.ElapsedTime < lastInvincibleStart || GameTime.Instance.ElapsedTime >= lastInvincibleStart + actualIFrame)
        {
            healthSprite.color = spriteColor;
            StopCoroutine(invincibleAnim);
            invincibleAnim = null;

            isInvincible.SetValue(new TimedBool(GameTime.Instance.ElapsedTime, false));
            yield break;
        }

        float toElapse       = actualIFrame;
        float toElapseSprite = healthFrames;

        isInvincible.SetValue(new TimedBool(GameTime.Instance.ElapsedTime, true));

        Color healthColor = UnityEngineUtils.NegativeColor(spriteColor);

        healthSprite.color = healthColor;

        while (toElapse >= 0 && toElapse <= actualIFrame)
        {
            yield return(new WaitForEndOfFrame());

            toElapse       -= GameTime.Instance.DeltaTime;
            toElapseSprite -= GameTime.Instance.DeltaTime;

            if (toElapseSprite <= 0)
            {
                healthSprite.color = (healthSprite.color == healthColor) ? spriteColor : healthColor;
                toElapseSprite     = healthFrames;
            }
            else if (toElapseSprite > healthFrames)
            {
                healthSprite.color = (healthSprite.color == healthColor) ? spriteColor : healthColor;
                toElapseSprite     = toElapseSprite % healthFrames;
            }
        }

        healthSprite.color = spriteColor;
        StopCoroutine(invincibleAnim);
        invincibleAnim = null;

        isInvincible.SetValue(new TimedBool(GameTime.Instance.ElapsedTime, false));
    }
Beispiel #5
0
    private void OnEnable()
    {
        if (!UnityEngineUtils.IsInPlayModeOrAboutToPlay())
        {
            return;
        }

        GameTime.Instance.AddTimeListener(this);
        currentPlayerStats.OnChangeEvent     += OnStatsChange;
        currentProjectileStats.OnChangeEvent += OnStatsChange;

        playerStats = new TimelinedProperty <TimedFloat, float> [(int)StatsIndex.End];
        for (int i = 0; i < playerStats.Length; i++)
        {
            playerStats[i] = new TimelinedProperty <TimedFloat, float>();
        }
    }