Exemple #1
0
    IEnumerator lightLittleSun(LittleSunHandler littleSunHandler)
    {
        player.playerRuntimeData.lastLittleSunID = littleSunHandler.littleSunData.LittleSunID;
        float   playerLittleSunOffset = 0.25f;
        Vector2 littleSunPos          = littleSunHandler.transform.position;
        Vector2 targetPos             = new Vector2(littleSunPos.x + playerLittleSunOffset, littleSunPos.y);

        // the same hack here as the combat freeze of Goye
        player.stateMachine.SwitchState(player.cinemaState);
        // yield return new WaitUntil(player at target pos);
        if (Mathf.Abs(player.transform.position.x - targetPos.x) >= 1 / 32f)
        {
            // face towards the targetpos
            player.FaceTo(targetPos);
            // walk towards it
            player.Anim.Play(AlfAnimationHash.RUN_0);
            yield return(new WaitForEndOfFrame());

            player.SetVelocity(new Vector2(player.facingDirection * player.playerData.WS_walkSpeed / 5, 0));

            yield return(new WaitUntil(() => Mathf.Abs(player.transform.position.x - targetPos.x) <= 1 / 32f));
        }

        // face towards little sun
        player.FaceTo(littleSunPos);
        player.SetVelocity(Vector2.zero);
        // player.Anim.Play()
        player.Anim.Play(AlfAnimationHash.LIGHT_LITTLE_SUN_0);

        yield return(new WaitUntil(() => player.lightingLittleSunToken == true));

        littleSunHandler.BloodAnim.Play("blood");

        yield return(new WaitUntil(() => littleSunHandler.BloodAnim == null));

        littleSunHandler.LittleSunAnim.Play(LittleSunAnimHash.GENERATE_0);
        // yield return new WaitUntil(finish lighting sun)
        yield return(new WaitUntil(() => littleSunHandler.LittleSunAnim.GetCurrentAnimatorStateInfo(0).shortNameHash == LittleSunAnimHash.IDLE_0));

        // player.stateMachine.switchstate(player.idleState);
        player.stateMachine.SwitchState(player.idleState);

        littleSunHandler.InfoSignAnim.Play(InfoSignAnimHash.INTRO);
        player.lightingLittleSunToken = false;
    }
Exemple #2
0
 void Awake()
 {
     littleSunHandler = transform.parent.GetComponent <LittleSunHandler>();
 }
Exemple #3
0
 public void LightLittleSun(LittleSunHandler littleSunHandler) => StartCoroutine(lightLittleSun(littleSunHandler));
 public void SetLittleSunHandler(LittleSunHandler littleSunHandler) => this.littleSunHandler = littleSunHandler;