コード例 #1
0
    private IEnumerator ChessBoardInitiate(GameObject board, float initialSize, float finalSize, float time, float speedUp)
    {
        var animator = chessBoard.GetComponent <Animator>();

        animator.Play("Drop");

        var clipInfo = animator.GetCurrentAnimatorClipInfo(0);

        yield return(new WaitForSeconds(clipInfo[0].clip.length * 0.4f * initiateTimeMultiplier));

        AudioManager.Instance.PlaySFX("whoosh", 0.45f);
        yield return(new WaitForSeconds(clipInfo[0].clip.length * 0.6f * initiateTimeMultiplier));

        StartCoroutine(Shake(chessBoard.transform, 0.25f, 0.25f * initiateTimeMultiplier));
        AudioManager.Instance.PlaySFX("impact");

        for (int i = -8; i <= 8; i++)
        {
            for (int j = -8; j <= 8; j++)
            {
                var particle = Instantiate(dust, new Vector3(i * 0.5f, j * 0.5f, 0), Quaternion.identity);
                Destroy(particle.gameObject, particle.GetComponent <ParticleSystem>().main.duration);
            }
        }

        yield return(new WaitForSeconds(0.5f * initiateTimeMultiplier));

        StartCoroutine(GetComponent <ChessManager>().InitiateChess(playerTeam, initiateTimeMultiplier));
        chessBoard.GetComponentInChildren <CanvasGroup>().DOFade(1.0f, 3f * initiateTimeMultiplier);

        //AudioManager.Instance.SetMusicVolume(0.5f);
        //AudioManager.Instance.PlayMusicWithFade("theme", 3f);

        yield return(new WaitForSeconds(3f * initiateTimeMultiplier));

        UICanvas.CharacterMoveIn(0.5f);

        // Enable cursor and assign a team for it
        InitiateCursor(playerCursor, playerTeam);
        playerCursor.GetComponent <Input>().SetControlActive(true);
        InitiateCursor(enemyCursor, playerTeam == Team.White ? Team.Black : Team.White);
        enemyCursor.GetComponent <CursorAIInput>().active = true;

        // white start first
        isPlayerTurn = (playerTeam == Team.Black);
        Turn();
    }