コード例 #1
0
    protected override IEnumerator TickUntilDone()
    {
        List <IEnumerator> sparks = new List <IEnumerator>();

        for (int i = 0; i < sparkCount; ++i)
        {
            sparks.Add(DelayedSpark(Random.value));
        }

        sparks.Add(CoroutineComposer.MakeDelayed(.2f, CoroutineComposer.MakeAction(() => Game.Instance.audioManager.Play("repair"))));
        sparks.Add(CoroutineComposer.MakeDelayed(.6f, CoroutineComposer.MakeAction(() => Game.Instance.audioManager.Play("repair"))));

        yield return(CoroutineComposer.MakeParallel(this, sparks.ToArray()));
    }
コード例 #2
0
    public void OnVesselEndTurn(VesselEncounter vessel)
    {
        Debug.Assert(turnState == TurnState.Deciding);

        // disable input
        pageEncounter.IsInputEnabled = false;

        // enqueue health bar animations
        EnqueueAnimation(CoroutineComposer.MakeParallel(
                             this,
                             pageEncounter.healthBarPlayer.AnimateFill(owner.playerStatus.GetHealthPercentage(), 1),
                             pageEncounter.healthBarOpponent.AnimateFill(opponentStatus.GetHealthPercentage(), 1)
                             ));

        // luck roll to prevent player death
        if (playerEncounter.Status.health <= 0)
        {
            float luckRoll = playerEncounter.Stats.RollLuck();
            Debug.Log($"Anti-death luck roll: {luckRoll}");
            if (luckRoll > 0.9f)
            {
                // repair
                playerEncounter.Status.Repair(true);

                // repair and health bar animations
                EnqueueAnimation(CoroutineComposer.MakeParallel(this,
                                                                Game.Instance.effects.Create <EffectRepair>("Repair").Setup(pageEncounter.playerVisuals.transform.position, pageEncounter.playerVisuals.hull.sprite.rect).Run(),
                                                                pageEncounter.healthBarPlayer.AnimateFill(owner.playerStatus.GetHealthPercentage(), 1)
                                                                ));
            }
        }

        // enqueue end of turn
        pendingCoroutines.Add(CoroutineComposer.MakeAction(OnFinishAnimating));

        // run coroutines
        turnState = TurnState.Animating;
        StartCoroutine(CoroutineComposer.MakeSequence(pendingCoroutines.ToArray()));
    }
コード例 #3
0
 private void OnDeactivateEvade()
 {
     owner.EnqueueAnimation(CoroutineComposer.MakeDelayed(.25f, CoroutineComposer.MakeAction(() => visuals.TrailVisible = false)));
 }
コード例 #4
0
 private void OnActivateEvade()
 {
     Debug.LogFormat("Evading");
     owner.EnqueueAnimation(CoroutineComposer.MakeDelayed(.25f, CoroutineComposer.MakeAction(() => visuals.TrailVisible = true)));
     FinishTurn();
 }