コード例 #1
0
ファイル: Akari.cs プロジェクト: pixelflag/akari2100
    void Start()
    {
        animator = GetComponent <Animator>();

        block          = new MaterialPropertyBlock();
        spriteRenderer = GetComponent <SpriteRenderer>();
        spriteRenderer.GetPropertyBlock(block);

        animCount = 0;
        animState = AkariAnimationState.Idle;

        startCount = 0;
    }
コード例 #2
0
ファイル: Akari.cs プロジェクト: pixelflag/akari2100
    private void changeState()
    {
        switch (animState)
        {
        case AkariAnimationState.Idle:
            if (animCount >= 1)
            {
                animCount = 0;
                animState = AkariAnimationState.Ojigi;
                animator.Play(ojigiAnim.name);
            }
            break;

        case AkariAnimationState.Ojigi:
            if (animCount >= 1)
            {
                animCount = 0;
                animState = AkariAnimationState.Idle2;
                animator.Play(idleAnim.name);
            }
            break;

        case AkariAnimationState.Idle2:
            if (animCount >= 1)
            {
                animCount = 0;
                animState = AkariAnimationState.Banzai;
                animator.Play(banzaiAnim.name);
            }
            break;

        case AkariAnimationState.Banzai:
            if (animCount >= 3)
            {
                animCount = 0;
                if (jumpDirection == JumpDirection.LEFT)
                {
                    animState = AkariAnimationState.LJump;
                    animator.Play(jumpLAnim.name);
                }
                else
                {
                    animState = AkariAnimationState.RJump;
                    animator.Play(jumpRAnim.name);
                }
            }
            break;

        case AkariAnimationState.LJump:
            if (animCount >= 2)
            {
                animCount = 0;
                if (jumpDirection == JumpDirection.LEFT)
                {
                    animState = AkariAnimationState.RJump;
                    animator.Play(jumpRAnim.name);
                }
                else
                {
                    animState = AkariAnimationState.Idle;
                    animator.Play(idleAnim.name);
                }
            }
            break;

        case AkariAnimationState.RJump:
            if (animCount >= 2)
            {
                animCount = 0;
                if (jumpDirection == JumpDirection.LEFT)
                {
                    animState = AkariAnimationState.Idle;
                    animator.Play(idleAnim.name);
                }
                else
                {
                    animState = AkariAnimationState.LJump;
                    animator.Play(jumpLAnim.name);
                }
            }
            break;
        }
    }