Ejemplo n.º 1
0
    protected override void OnUpdate()
    {
        Entities
        .WithoutBurst()
        .WithStructuralChanges()
        .ForEach((Entity entity, SpriteRenderer renderer, ref HitComponent hitComp, ref AnimationFrameComponent animComp) => {
            if (false == AnimUtility.HasState(animComp, AnimUtility.hit))
            {
                animComp.state |= AnimUtility.hit;
                renderer.color  = hitComp.hitEffectColor;
                GamePause.Pause(0.15f);
            }

            hitComp.elapsedTime += Time.DeltaTime;
            if ((hitComp.elapsedTime >= hitComp.hitEffectTime) && (renderer.color == hitComp.hitEffectColor))
            {
                renderer.color = Color.white;
            }
            else if (hitComp.elapsedTime >= hitComp.godTime)
            {
                animComp.state ^= AnimUtility.hit;
                EntityManager.RemoveComponent <HitComponent>(entity);
                EntityManager.RemoveComponent <MoveComponent>(entity);
            }
        }).Run();
    }
Ejemplo n.º 2
0
    IEnumerator PauseCoroutine()
    {
        GamePause gamePause = canvas.GetComponent <GamePause>();

        gamePause.Pause();
        narratorTrigger.Play();
        Debug.Log(narratorTrigger.GetLength());
        yield return(new WaitForSecondsRealtime(narratorTrigger.GetLength()));

        gamePause.Resume();
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }