コード例 #1
0
ファイル: Piece.cs プロジェクト: renatodiasviana/ConnectFour
    void UpdateMaterialAnimation(ANIMATION_TYPE type, float animationSpeed)
    {
        timePassed += Time.deltaTime * animationSpeed;
        timePassed  = timePassed > 1.0f ? 1.0f : timePassed;

        GetComponent <Renderer>().material.SetFloat("_AnimationTime", timePassed);

        if (timePassed >= 1.0f)
        {
            if (type == ANIMATION_TYPE.WIN)
            {
                if (OnWinAnimationEnded != null)
                {
                    OnWinAnimationEnded(transform);
                }
            }
            else
            {
                if (OnResetAnimationEnded != null)
                {
                    OnResetAnimationEnded(transform);
                }
            }

            Type = ANIMATION_TYPE.NONE;
        }
    }
コード例 #2
0
 public IMAGE_scription(Sprite spr, ANIMATION_TYPE animation, string str, int time, string image_name, COMMAND_TYPE t) : base(str, t)
 {
     this._image     = spr;
     this._animation = animation;
     this._timmer    = time;
     this._imagename = image_name;
 }
コード例 #3
0
ファイル: Player5.cs プロジェクト: iris4865/H.A.S
    void Move()
    {
        player_speed      = 2.0f;
        player_moveVector = Vector3.zero;
        currentAnimation  = ANIMATION_TYPE.Wait;

        if (inputEventKey[KeyCode.W])
        {
            if (inputEventKey[KeyCode.LeftShift])
            {
                currentAnimation = ANIMATION_TYPE.Run;
                player_speed     = 8.0f;
            }
            else
            {
                currentAnimation = ANIMATION_TYPE.Walk;
            }
            player_moveVector.z = player_speed;
        }
        if (inputEventKey[KeyCode.S])
        {
            currentAnimation    = ANIMATION_TYPE.Walk;
            player_moveVector.z = -player_speed;
        }
        if (inputEventKey[KeyCode.A])
        {
            transform.Rotate(Vector3.down * Time.deltaTime * 100f);
        }
        if (inputEventKey[KeyCode.D])
        {
            transform.Rotate(Vector3.up * Time.deltaTime * 100f);
        }

        transform.position += ((transform.rotation * player_moveVector) * Time.deltaTime);
    }
コード例 #4
0
ファイル: Piece.cs プロジェクト: renatodiasviana/ConnectFour
 public void StartFallAnimation(Vector3 endPosition, float animationTime)
 {
     timePassed = 0.0f;
     Type       = ANIMATION_TYPE.FALL;
     FallAnimation_EndPosition = endPosition;
     FallAnimation_Time        = animationTime;
 }
コード例 #5
0
 public IMAGE_scription(IMAGE_scription main, Sprite spr, string str, COMMAND_TYPE t) : base(str, t)
 {
     this._animation = main.animation;
     this._timmer    = main.timmer;
     this._imagename = main.imagename;
     this._image     = spr;
 }
コード例 #6
0
ファイル: Piece.cs プロジェクト: renatodiasviana/ConnectFour
    public void StartResetAnimation()
    {
        Type = ANIMATION_TYPE.RESET;
        MaterialAnimation = 0.0f;
        timePassed        = 0.0f;

        GetComponent <Renderer>().material = ResetMaterial;
    }
コード例 #7
0
ファイル: Piece.cs プロジェクト: renatodiasviana/ConnectFour
    public void StartWinAnimation()
    {
        if (IsWinnerPiece)
        {
            return;
        }

        Type = ANIMATION_TYPE.WIN;
        MaterialAnimation = 0.0f;
        timePassed        = 0.0f;

        GetComponent <Renderer>().material = WinMaterial;
    }
コード例 #8
0
ファイル: Player5.cs プロジェクト: iris4865/H.A.S
    void Motion()
    {
        Collider footCollider = foot.GetComponent <SphereCollider>();

        if (inputEventKey[KeyCode.E])
        {
            footCollider.isTrigger = true;
            currentAnimation       = ANIMATION_TYPE.Attack;
            this.audio.clip        = this.attack_sound;
            audio.Play();
        }
        else
        {
            footCollider.isTrigger = false;
            player_animator.SetBool("isaction", false);
        }
    }
コード例 #9
0
    public void SetCondition(ANIMATION_TYPE type)
    {
        switch (type)
        {
        case ANIMATION_TYPE.RUN:
            m_AnimationController.SetBool("Run", true);
            break;

        case ANIMATION_TYPE.STAY:
            m_AnimationController.SetBool("Run", false);
            break;

        case ANIMATION_TYPE.ATTACK:
            m_AnimationController.SetBool("Spinkick", true);
            break;

        case ANIMATION_TYPE.DEAD:
            break;
        }
    }
コード例 #10
0
    /// <summary>
    /// アニメーション切り替え
    /// </summary>
    /// <param name="type"></param>
    public void PlayAnimation(ANIMATION_TYPE type)
    {
        switch (type)
        {
        case ANIMATION_TYPE.IDLE:
            animator.Play("idle");
            break;

        case ANIMATION_TYPE.ATTACK:
            animator.Play("attack");
            break;

        case ANIMATION_TYPE.DAMAGE:
            animator.Play("damage");
            break;

        case ANIMATION_TYPE.DIE:
            animator.Play("die");
            break;
        }
    }
コード例 #11
0
ファイル: Piece.cs プロジェクト: renatodiasviana/ConnectFour
    void UpdateFallAnimation()
    {
        // Avoiding timePassed to pass the limit of the animation
        timePassed = (timePassed + Time.deltaTime) > FallAnimation_Time ?
                     FallAnimation_Time : (timePassed + Time.deltaTime * FallAnimationSpeed);

        // Animating the fall to right position
        Vector3 animationPosition = FallAnimation_EndPosition;

        animationPosition.y *= timePassed / FallAnimation_Time;

        transform.localPosition = animationPosition;

        if (timePassed >= FallAnimation_Time)
        {
            Type = ANIMATION_TYPE.NONE;

            if (OnFallAnimationEnded != null)
            {
                OnFallAnimationEnded(transform);
            }
        }
    }
コード例 #12
0
 public void PlayByTypeWithDelay(ANIMATION_TYPE type, float delay)
 {
     InvokeDelay(PlayByType, delay, type);
 }
コード例 #13
0
 public COLOR_scription(Color color, string str, int time, ANIMATION_TYPE animation, COMMAND_TYPE t) : base(str, t)
 {
     this._color = color; this._timmer = time; this._animation = animation;
 }
コード例 #14
0
 public IMAGE_clear_scription(int place, ANIMATION_TYPE animation_type, int animtime, string str, COMMAND_TYPE type) : base(str, type)
 {
     _place     = place;
     _timmer    = animtime;
     _animation = animation_type;
 }
コード例 #15
0
    //次のスクリプトを読み込む関数
    NOVEL_STATUS Next_Command()
    {
        if (scriptions.Count <= reading_pos)
        {
            return(NOVEL_STATUS.FINISH);
        }
        else
        {
            if (reading_pos > 0 && scriptions[reading_pos].type != COMMAND_TYPE.NORMAL_TEXT_CONTINUE)
            {
                if (now.type == COMMAND_TYPE.NORMAL_TEXT || now.type == COMMAND_TYPE.NORMAL_TEXT_CONTINUE)
                {
                    string check = "";
                    if ((now as Text_scription).character_name.Length > 0)
                    {
                        check += "[" + (now as Text_scription).character_name + "]";
                    }
                    else
                    {
                        if (characterText.text.Length > 0)
                        {
                            check += "[" + characterText.text + "]";
                        }
                        else
                        {
                            check += ' ';
                        }
                    }
                    check   += log_text;
                    log_text = "";
                    Debug.Log(check);
                    string[] temp = check.Split('\\');
                    check = temp[0];
                    for (int i = 1; i < temp.Length; i++)
                    {
                        if (i % 2 == 0)
                        {
                            check += temp[i].Substring(3);
                        }
                        else
                        {
                            string[] before_slash = temp[i].Split('/');
                            string[] contents     = before_slash[0].Split('>');
                            int      num          = contents.Length - 1;
                            check += '(' + contents[num].Substring(0, contents[num].Length - 2) + ')';
                        }
                    }

                    Debug.Log(check);
                    back_log.text += check;
                    back_log.text += "\n\n";
                }
            }

            //コマンド読み込み
            now = scriptions[reading_pos];
            reading_pos++;
            switch (now.type)
            {
            //文字速度変更コマンド
            case COMMAND_TYPE.WAIT_S:
                wait_time = (now as WAIT_scription).counter;
                return(NOVEL_STATUS.NEXT);

            // delay wait の遅延コマンド
            case COMMAND_TYPE.WAIT:
                delaytime    = (now as WAIT_scription).counter;
                delaynowtime = 0;
                skipflag     = (now as WAIT_scription).skipflag;
                return(NOVEL_STATUS.DELAY);

            //通常テキスト
            case COMMAND_TYPE.NORMAL_TEXT:
            {
                characterText.text = (now as Text_scription).character_name;
                if (characterText.text.Length > 0)
                {
                    namebox.gameObject.SetActive(true);
                }
                else
                {
                    namebox.gameObject.SetActive(false);
                }
            }
                save_data       = "";
                text.text       = "";
                character_count = 0;
                line_count      = 0;
                text.color      = chara_color;
                (now as Text_scription).counter = 0;
                (now as Text_scription).timer   = 0f;
                if ((now as Text_scription).check)
                {
                    character_voice.Play();
                }
                return(NOVEL_STATUS.WRITING);

            case COMMAND_TYPE.NORMAL_TEXT_CONTINUE:
                (now as Text_scription).counter = 0;
                (now as Text_scription).timer   = 0f;
                return(NOVEL_STATUS.WRITING);

            case COMMAND_TYPE.COLOR:
            {
                chara_color = (now as COLOR_scription).color;
            }
                return(NOVEL_STATUS.NEXT);

            //bg color系命令
            case COMMAND_TYPE.BACKGROUND_COLOR:
            {
                //Texture2DからSpriteを作成
                Sprite branksprite = Sprite.Create(
                    texture: Texture2D.whiteTexture,
                    rect: new Rect(0, 0, Texture2D.whiteTexture.width, Texture2D.whiteTexture.height),
                    pivot: new Vector2(0.5f, 0.5f)
                    );
                BackScreen.background.sprite = null;
                //BackScreen.background.sprite = branksprite;
                BackScreen.background.sprite = Resources.Load <Sprite>("bg/white");
                BackScreen.background.color  = (now as COLOR_scription).color;

                //アニメーション設定
                registered_animation = (now as COLOR_scription).animation;
                if (registered_animation == ANIMATION_TYPE.MASKRULE)
                {
                    animrulenum = Int32.Parse((now as Scription).text);
                }

                //次同時描画エフェクト(エフェクト番号0番)
                //0秒は廃止にします。(チェンジは一括にするため)
                //仕様としては、BackScreenに登録だけして、NEXTへいく
                if (registered_animation == ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    return(NOVEL_STATUS.NEXT);
                }


                //タイマー設定
                if (registered_animation != ANIMATION_TYPE.ANIMATION_NO_TIME)
                {
                    anim_timer = (now as COLOR_scription).timmer;
                }
                else
                {
                    //エフェクト番号1番
                    anim_timer = -1;
                }
            }
                //アニメーション準備へ
                return(NOVEL_STATUS.PRE_ANIMATION);

            //cl命令
            case COMMAND_TYPE.STAND_IMAGE_CLEAR:
            {
                //BackScreenに描画
                int place = (now as IMAGE_clear_scription).place;
                switch (place)
                {
                case 1:              //001
                    BackScreen.right.sprite = skeltonsprite;
                    BackScreen.right.name   = null;
                    break;

                case 2:              //010
                    BackScreen.center.sprite = skeltonsprite;
                    BackScreen.center.name   = null;
                    break;

                case 4:              //100
                    BackScreen.left.sprite = skeltonsprite;
                    BackScreen.left.name   = null;
                    break;

                case 7:              //111
                    BackScreen.right.sprite  = skeltonsprite;
                    BackScreen.center.sprite = skeltonsprite;
                    BackScreen.left.sprite   = skeltonsprite;
                    BackScreen.right.name    = null;
                    BackScreen.center.name   = null;
                    BackScreen.left.name     = null;
                    break;
                }



                //アニメーション設定
                registered_animation = (now as IMAGE_clear_scription).animation;
                if (registered_animation == ANIMATION_TYPE.MASKRULE)
                {
                    animrulenum = Int32.Parse((now as Scription).text);
                }

                //次同時描画エフェクト(エフェクト番号0番)
                //0秒は廃止にします。(チェンジは一括にするため)
                //仕様としては、BackScreenに登録だけして、NEXTへいく
                if (registered_animation == ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    return(NOVEL_STATUS.NEXT);
                }


                //タイマー設定
                if (registered_animation != ANIMATION_TYPE.ANIMATION_NO_TIME)
                {
                    anim_timer = (now as IMAGE_clear_scription).timmer;
                }
                else
                {
                    //エフェクト番号1番
                    anim_timer = -1;
                }
            }
                //アニメーション準備へ
                return(NOVEL_STATUS.PRE_ANIMATION);

            //bg命令
            case COMMAND_TYPE.BACKGROUND_IMAGE:
            {
                //裏画面に描画
                BackScreen.background.name   = (now as IMAGE_scription).imagename;
                BackScreen.background.sprite = null;
                BackScreen.background.sprite = (now as IMAGE_scription).image;
                BackScreen.background.color  = new Color(1, 1, 1, 1);

                //アニメーション設定
                registered_animation = (now as IMAGE_scription).animation;
                if (registered_animation == ANIMATION_TYPE.MASKRULE)
                {
                    animrulenum = Int32.Parse((now as Scription).text);
                }

                //次同時描画エフェクト(エフェクト番号0番)
                //0秒は廃止にします。(チェンジは一括にするため)
                //仕様としては、BackScreenに登録だけして、NEXTへいく
                if (registered_animation == ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    return(NOVEL_STATUS.NEXT);
                }


                //タイマー設定
                if (registered_animation != ANIMATION_TYPE.ANIMATION_NO_TIME)
                {
                    anim_timer = (now as IMAGE_scription).timmer;
                }
                else
                {
                    //エフェクト番号1番
                    anim_timer = -1;
                }
            }

                //アニメーション準備へ
                return(NOVEL_STATUS.PRE_ANIMATION);

            //ld命令
            case COMMAND_TYPE.STAND_IMAGE:
            {
                //BackScreenに描画
                //l,c,rで分岐
                switch ((now as STAND_IMAGE_scription).place)
                {
                //left  //100
                case 4:
                    BackScreen.left.sprite         = (now as IMAGE_scription).image;
                    BackScreen.left.preserveAspect = true;
                    BackScreen.left.name           = (now as IMAGE_scription).imagename;
                    break;

                //center  //010
                case 2:
                    BackScreen.center.sprite         = (now as IMAGE_scription).image;
                    BackScreen.center.preserveAspect = true;
                    BackScreen.center.name           = (now as IMAGE_scription).imagename;
                    break;

                //right   //001
                case 1:
                    BackScreen.right.sprite         = (now as IMAGE_scription).image;
                    BackScreen.right.preserveAspect = true;
                    BackScreen.right.name           = (now as IMAGE_scription).imagename;
                    break;
                }

                //アニメーション設定
                registered_animation = (now as IMAGE_scription).animation;
                if (registered_animation == ANIMATION_TYPE.MASKRULE)
                {
                    animrulenum = Int32.Parse((now as Scription).text);
                }

                //次同時描画エフェクト(エフェクト番号0番)
                //0秒は廃止にします。(チェンジは一括にするため)
                if (registered_animation == ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    return(NOVEL_STATUS.NEXT);
                }

                //タイマー設定
                if (registered_animation != ANIMATION_TYPE.ANIMATION_NO_TIME)
                {
                    anim_timer = (now as IMAGE_scription).timmer;
                }
                else
                {
                    //エフェクト番号1番
                    anim_timer = -1;
                }
            }
                return(NOVEL_STATUS.PRE_ANIMATION);

            //textoff命令
            case COMMAND_TYPE.TEXTOFF:
                //後でアニメーションとかする場合ここにその準備を追加。

                return(NOVEL_STATUS.UIHIDE);

            case COMMAND_TYPE.TEXTON:
                //後でアニメーションとかする場合ここにその準備を追加。

                return(NOVEL_STATUS.UISHOW);

            //bgm命令
            case COMMAND_TYPE.AUDIO_BGM:
                bgm.enabled = true;
                bgm.clip    = (now as AUDIO_scription).audio;
                bgm.loop    = true;
                bgm.Play();

                return(NOVEL_STATUS.NEXT);

            //bgmstop命令
            case COMMAND_TYPE.AUDIO_BGM_STOP:
                bgm.Stop();
                bgm.enabled = false;

                return(NOVEL_STATUS.NEXT);

            //se命令
            case COMMAND_TYPE.AUDIO_SE:
                se.enabled = true;
                se.clip    = (now as AUDIO_scription).audio;
                if (now.text == "loop")
                {
                    se.loop = true;
                }
                else
                {
                    se.loop = false;
                }
                se.Play();

                return(NOVEL_STATUS.NEXT);

            //sestop命令
            case COMMAND_TYPE.AUDIO_SE_STOP:
                se.Stop();
                se.enabled = false;

                return(NOVEL_STATUS.NEXT);

            //タグ中のボイスを再生する、またはvoice命令
            case COMMAND_TYPE.AUDIO_VOICE:
                character_voice.enabled   = true;
                character_voice.clip      = (now as AUDIO_scription).audio;
                character_voice.clip.name = (now as AUDIO_scription).audio_name;
                character_voice.loop      = false;
                //voice命令の場合
                if ((now as AUDIO_scription).text == "voice")
                {
                    character_voice.Play();
                    isvoicestop = false;
                }
                return(NOVEL_STATUS.NEXT);

            //voicestop命令
            //voice停止と共に、次の行を読むときにボイスを止めるフラグを復活させる意味がある
            case COMMAND_TYPE.AUDIO_VOICE_STOP:
                character_voice.Stop();
                character_voice.enabled = false;
                isvoicestop             = true;
                return(NOVEL_STATUS.NEXT);

            //setwindow命令
            case COMMAND_TYPE.SETWINDOW:
                //テキストボックスを取得
                GameObject textbox = mainui.transform.Find("TextBox").gameObject;
                //画像を更新
                textbox.GetComponent <Image>().sprite = Resources.Load <Sprite>((now as UI_IMAGE_scription).text);
                //位置を更新
                textbox.transform.localPosition = new Vector3((now as UI_IMAGE_scription).x, (now as UI_IMAGE_scription).y);

                //TODO:セーブデータに変更を記録する
                return(NOVEL_STATUS.NEXT);

            case COMMAND_TYPE.RETURN:
                return(NOVEL_STATUS.FINISH);
            }
        }
        Debug.Log(now.text);
        return(NOVEL_STATUS.WRITING);
    }
コード例 #16
0
    // Update is called once per frame
    public bool Updating()
    {
        if (screenshot_coroutine)
        {
            return(true);
        }
        //バックログ処理
        //Operation_BackLog();

        //SCREEN_STATUS分岐(バックログか、ノベルエンジンメインか、セーブ・ロードか。)
        switch (screen)
        {
        case SCREEN_STATUS.BACK_LOG:

            break;

        case SCREEN_STATUS.MAIN:
            //次の行へ
            if (state == NOVEL_STATUS.NEXT)
            {
                ResetFrontAlpha();

                if (character_voice.isPlaying && isvoicestop)
                {
                    character_voice.Stop();
                }
                Debug.Log("Scripter Update Call");

                state = Next_Command();
                if (state == NOVEL_STATUS.FINISH)
                {
                    FrontScreen.left.name   = "left";
                    FrontScreen.right.name  = "right";
                    FrontScreen.center.name = "center";
                    BackScreen.left.name    = "left";
                    BackScreen.center.name  = "center";
                    BackScreen.right.name   = "right";
                    scriptions.Clear();
                    reading_pos = 0;
                    FrontScreen.background.sprite = skeltonsprite;
                    FrontScreen.center.sprite     = FrontScreen.right.sprite = FrontScreen.left.sprite = skeltonsprite;
                    BackScreen.center.sprite      = BackScreen.right.sprite = BackScreen.left.sprite = skeltonsprite;

                    BackScreen.background.sprite = skeltonsprite;
                    mainui.SetActive(false);
                    screenshot_coroutine = false;
                    return(false);
                }
            }
            //文章表示中
            else if (state == NOVEL_STATUS.WRITING)
            {
                float time = (now as Text_scription).timer;
                //文章表示時は強制的にtexton
                ShowUI();
                //強制的に0(Sync)を表示(NScripter準拠)BackScreenをFrontScreenにコピー
                FrontScreen.Copy(BackScreen);

                time += Time.deltaTime * 1000;
                if (time > wait_time)
                {
                    int count = 0;
                    count = (now as Text_scription).counter;
                    if (now.text.Length > count)
                    {
                        if (now.text[count] == '\\' && now.text[count + 1] == 't' && now.text[count + 2] == 'a' && now.text[count + 3] == 'g')
                        {
                            string cut       = now.text.Substring(count + 4);
                            int    main_text = Int32.Parse(cut.Substring(0, 1));
                            cut = cut.Substring(1, cut.Length - 1);
                            string[] temp = cut.Split('\\');
                            text.text += temp[0];
                            count     += temp[0].Length + 8;
                        }
                        else
                        {
                            character_count++;
                            text.text += now.text[count];
                        }
                        (now as Text_scription).counter = count + 1;
                        (now as Text_scription).timer   = 0f;
                        time = 0f;
                    }
                    else
                    {
                        state = NOVEL_STATUS.WAITING;
                    }
                }
                if (check_key)
                {
                    Operation_next();
                }
                (now as Text_scription).timer = time;
            }
            //クリック待ち
            else if (state == NOVEL_STATUS.WAITING)
            {
                if (!character_voice.isPlaying)
                {
                    PageChangeAnim.gameObject.SetActive(true);
                }

                if (check_key)
                {
                    if (Operation_next())
                    {
                        PageChangeAnim.gameObject.SetActive(false);
                        PageWaitAnim.gameObject.SetActive(false);
                    }
                }
            }
            //遅延
            else if (state == NOVEL_STATUS.DELAY)
            {
                if ((Operation_next() && skipflag) || delaynowtime >= delaytime)
                {
                    state = NOVEL_STATUS.NEXT;
                }
                delaynowtime += (int)(Time.deltaTime * 1000);
            }
            else if (state == NOVEL_STATUS.UIHIDE)
            {
                //今は非表示にするだけ。
                HideUI();
                state = NOVEL_STATUS.NEXT;
            }
            else if (state == NOVEL_STATUS.UISHOW)
            {
                //今は表示するだけ。
                ShowUI();
                state = NOVEL_STATUS.NEXT;
            }
            //アニメーション
            else if (state == NOVEL_STATUS.ANIMATION)
            {
                //クリックされた
                if (Operation_next())
                {
                    FrontScreen.Copy(BackScreen);

                    state = NOVEL_STATUS.NEXT;
                }
                else
                {
                    bool check = false;
                    switch (registered_animation)
                    {
                    case ANIMATION_TYPE.ANIMATION_NO_TIME:
                        break;

                    case ANIMATION_TYPE.ANIMATION_SYNCHRO:
                        Debug.Log("Error;");
                        break;

                    case ANIMATION_TYPE.FADE_IN:
                        check = true;
                        FrontScreen.gobj.GetComponent <CanvasGroup>().alpha -= 1000 * Time.deltaTime / anim_timer;
                        //registered_object[i].color -= new Color(0, 0, 0, 1000 * Time.deltaTime / anim_timer);
                        if (FrontScreen.gobj.GetComponent <CanvasGroup>().alpha <= 0f)
                        {
                            registered_animation = ANIMATION_TYPE.ANIMATION_NO_TIME;
                        }
                        break;

                    case ANIMATION_TYPE.MASKRULE:
                        check = true;
                        fadeui.GetComponent <FadeUI>().Range += 1000 * Time.deltaTime / anim_timer;
                        if (fadeui.GetComponent <FadeUI>().Range >= 1)
                        {
                            //prebackground.enabled = false;
                            fadeui.GetComponent <FadeUI>().Range = 1;
                            registered_animation = ANIMATION_TYPE.ANIMATION_NO_TIME;
                        }
                        break;
                    }
                    if (!check)
                    {
                        FrontScreen.Copy(BackScreen);

                        ResetFrontAlpha();

                        BackScreen.gobj.SetActive(false);
                        state = NOVEL_STATUS.NEXT;
                    }
                }
            }
            else if (state == NOVEL_STATUS.PRE_ANIMATION)
            {
                //BackScreenをSetActive
                BackScreen.gobj.SetActive(true);
                switch (registered_animation)
                {
                //フェードイン
                case ANIMATION_TYPE.FADE_IN:
                    FrontScreen.gobj.GetComponent <CanvasGroup>().alpha = 1;
                    state = NOVEL_STATUS.ANIMATION;
                    break;

                //瞬間表示
                case ANIMATION_TYPE.ANIMATION_NO_TIME:
                    //BackScreenをFrontScreenにコピー
                    FrontScreen.Copy(BackScreen);
                    BackScreen.gobj.SetActive(false);
                    state = NOVEL_STATUS.NEXT;

                    anim_timer = 0;
                    break;

                case ANIMATION_TYPE.MASKRULE:
                    state = NOVEL_STATUS.ANIMATION;
                    //フェードマスク用ルール画像の設定
                    Texture animation_mask_texture = Resources.Load <Texture>(string.Format("Fade/{0}", animrulenum));
                    fadeui.GetComponent <FadeUI>().UpdateMaskTexture(animation_mask_texture);
                    fadeui.GetComponent <FadeUI>().Range = 0;
                    fade_method = 0;
                    break;
                }
            }
            break;

        case SCREEN_STATUS.FADE_OUT:
            Debug.Log("Error");
            break;
        }
        return(true);
    }
コード例 #17
0
        /// <summary>
        /// 初期化
        /// </summary>
        /// <param name="rect"></param>
        /// <param name="cg"></param>
        /// <param name="parentSize"></param>
        /// <param name="type"></param>
        public TooltipAnimation(RectTransform rect, CanvasGroup cg, Vector2 parentSize, ANIMATION_TYPE type)
        {
            tooltipRect        = rect;
            tooltipCanvasGroup = cg;
            parentRectSize     = parentSize;
            animationType      = type;

            seq = DOTween.Sequence();
            seq.SetAutoKill(false);
            seq.OnStart(() => {
                ResetTooltip();
            });

            Vector2 firstPosition = Vector2.zero;

            // アニメーションタイプによってSequenceにアニメーションを指定
            switch (animationType)
            {
            case ANIMATION_TYPE.TO_TOP:
                // 開始位置を設定
                firstPosition = new Vector2(0, parentRectSize.y / 2);
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));

                seq.Append(tooltipRect.DOLocalMove(
                               Vector3.up * ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)),
                               NORMAL).SetEase(Ease.InOutCirc));
                seq.Join(tooltipCanvasGroup.DOFade(1.0f, FAST).SetEase(Ease.InOutCirc));
                break;

            case ANIMATION_TYPE.TO_TOP_FADE:
                // 開始位置を設定
                firstPosition = new Vector2(0, (parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2));
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));

                seq.Append(tooltipCanvasGroup.DOFade(1.0f, NORMAL).SetEase(Ease.OutCubic));
                break;

            case ANIMATION_TYPE.TO_TOP_EXPAND:
                // 開始位置を設定
                firstPosition = new Vector2(0, (parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2));
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));
                // 開始サイズを設定
                seq.Join(tooltipRect.DOScale(Vector2.one * 0.5f, 0));

                seq.Append(tooltipCanvasGroup.DOFade(1.0f, SLOW).SetEase(Ease.OutCubic));
                seq.Join(tooltipRect.DOScale(Vector2.one, NORMAL).SetEase(Ease.OutFlash));
                break;

            case ANIMATION_TYPE.TO_TOP_ATTACHED:
                // 開始位置を設定
                firstPosition = new Vector2(0, ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)) * MARGIN_Y);
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));

                seq.Append(tooltipRect.DOLocalMove(
                               Vector3.up * ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)),
                               FAST).SetEase(Ease.InSine));
                seq.Join(tooltipCanvasGroup.DOFade(1.0f, FAST).SetEase(Ease.InOutCirc));
                break;

            case ANIMATION_TYPE.TO_TOP_FUN:
                // 開始位置を設定
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));
                // 開始サイズを設定
                seq.Join(tooltipRect.DOScale(new Vector2(1f, 0.5f), 0));

                seq.Append(tooltipRect.DOLocalMove(
                               Vector3.up * ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2) * MARGIN_Y),
                               SLOW).SetEase(Ease.OutBounce));
                seq.Join(tooltipCanvasGroup.DOFade(1.0f, FAST).SetEase(Ease.InOutCirc));
                seq.Join(tooltipRect.DOScale(Vector2.one, SLOW).SetEase(Ease.InOutCirc));
                break;

            case ANIMATION_TYPE.TO_BOTTOM:
                // 開始位置を設定
                firstPosition = new Vector2(0, (parentRectSize.y / 2) * -1f);
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));

                seq.Append(tooltipRect.DOLocalMove(
                               Vector3.down * ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)),
                               NORMAL).SetEase(Ease.InOutCirc));
                seq.Join(tooltipCanvasGroup.DOFade(1.0f, FAST).SetEase(Ease.InOutCirc));
                break;

            case ANIMATION_TYPE.TO_BOTTOM_FADE:
                // 開始位置を設定
                firstPosition = new Vector2(0, ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)) * -1f);
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));

                seq.Append(tooltipCanvasGroup.DOFade(1.0f, NORMAL).SetEase(Ease.OutCubic));
                break;

            case ANIMATION_TYPE.TO_BOTTOM_EXPAND:
                // 開始位置を設定
                firstPosition = new Vector2(0, ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)) * -1f);
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));
                // 開始サイズを設定
                seq.Join(tooltipRect.DOScale(Vector2.one * 0.5f, 0));

                seq.Append(tooltipCanvasGroup.DOFade(1.0f, SLOW).SetEase(Ease.OutCubic));
                seq.Join(tooltipRect.DOScale(Vector2.one, NORMAL).SetEase(Ease.OutFlash));
                break;

            case ANIMATION_TYPE.TO_BOTTOM_ATTACHED:
                // 開始位置を設定
                firstPosition = new Vector2(0, ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)) * MARGIN_Y * -1f);
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));

                seq.Append(tooltipRect.DOLocalMove(
                               Vector3.down * ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2)),
                               FAST).SetEase(Ease.InSine));
                seq.Join(tooltipCanvasGroup.DOFade(1.0f, FAST).SetEase(Ease.InOutCirc));
                break;

            case ANIMATION_TYPE.TO_BOTTOM_FUN:
                // 開始位置を設定
                seq.Append(tooltipRect.DOLocalMove(firstPosition, 0));
                // 開始サイズを設定
                seq.Join(tooltipRect.DOScale(new Vector2(1f, 0.5f), 0));

                seq.Append(tooltipRect.DOLocalMove(
                               Vector3.down * ((parentRectSize.y / 2) + (tooltipRect.sizeDelta.y / 2) * MARGIN_Y),
                               SLOW).SetEase(Ease.OutBounce));
                seq.Join(tooltipCanvasGroup.DOFade(1.0f, FAST).SetEase(Ease.InOutCirc));
                seq.Join(tooltipRect.DOScale(Vector2.one, SLOW).SetEase(Ease.InOutCirc));
                break;

            default:
                break;
            }
        }
コード例 #18
0
    private IEnumerator InvokeImpl(Action <ANIMATION_TYPE> action, float time, ANIMATION_TYPE type)
    {
        yield return(new WaitForSeconds(time));

        action(type);
    }
コード例 #19
0
ファイル: NovelEditor.cs プロジェクト: pigwin/UnitySRPG
    //Special_script_parserの実際のコマンドを解析する関数
    void Special_script_parser_sub(string temp)
    {
        switch (temp[0])
        {
        case '!':
        {
            COMMAND_TYPE t = COMMAND_TYPE.WAIT_B;
            if (temp[1] == 'w')
            {
                t = COMMAND_TYPE.WAIT_W;
            }
            string timer = temp.Substring(2, temp.Length - 2);
            scriptions.Add(new WAIT_scription(Int32.Parse(timer), true, temp, t));
        }
        break;

        default:
            if (temp[0] == 'b' && temp[1] == 'g' && temp[2] == ' ')
            {
                string[] a    = temp.Split(' ');
                string[] b    = a[1].Split(',');
                int      time = 0;

                //アニメーション情報の指定
                ANIMATION_TYPE type = Animation_Type_Define(Int32.Parse(b[1]));
                if (type != ANIMATION_TYPE.ANIMATION_NO_TIME)
                {
                    time = Int32.Parse(b[2]);
                }
                if (b[0].Equals("white"))
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser("#FFFFFF"), b[1], COMMAND_TYPE.BACKGROUND_COLOR));
                }
                else if (b[0].Equals("black"))
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser("#000000"), b[1], COMMAND_TYPE.BACKGROUND_COLOR));
                }
                else if (b[0][0] == '#')
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser(b[0]), b[1], COMMAND_TYPE.BACKGROUND_COLOR));
                }
                else
                {
                    string[] path = b[0].Split('\"');

                    scriptions.Add(new IMAGE_scription(null, type, b[1], time, path[1], COMMAND_TYPE.BACKGROUND_IMAGE));
                }
                break;
            }

            if (temp[0] == 'l' && temp[1] == 'd')
            {
                string[]     a           = temp.Split(' ');
                string[]     b           = a[1].Split(',');
                int          time        = 0;
                int          place       = 1;
                COMMAND_TYPE command_tmp = COMMAND_TYPE.STAND_IMAGE;
                switch (b[0][0])
                {
                case 'c':
                    place = 2;
                    //command_tmp = COMMAND_TYPE.STAND_IMAGE_CENTER;
                    break;

                case 'l':
                    place = 4;
                    //command_tmp = COMMAND_TYPE.STAND_IMAGE_RIGHT;
                    break;
                }
                string[] path = b[1].Split('\"');

                //アニメーション情報の指定
                ANIMATION_TYPE type = Animation_Type_Define(Int32.Parse(b[2]));

                //エフェクト番号0番、1番は時間を取得しない
                if (type != ANIMATION_TYPE.ANIMATION_NO_TIME && type != ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    time = Int32.Parse(b[3]);
                }
                scriptions.Add(new STAND_IMAGE_scription(place, null, type, b[1], time, path[1], command_tmp));
                break;
            }
            Debug.Log((temp));
            scriptions.Add(new Text_scription("", false, AddRuby(AddBreak(temp)), COMMAND_TYPE.NORMAL_TEXT_CONTINUE));
            break;
        }
    }
コード例 #20
0
 public STAND_IMAGE_scription(int place, Sprite spr, ANIMATION_TYPE animation, string str,
                              int time, string image_name, COMMAND_TYPE t) : base(spr, animation, str, time, image_name, t)
 {
     _place = place;
 }
コード例 #21
0
 public void PlayByType(ANIMATION_TYPE type)
 {
     PlayByIndex(animations.FindIndex(a => a.type == type));
 }
コード例 #22
0
 public Data GetAnimationByType(ANIMATION_TYPE type)
 {
     return(animations.Find(a => a.type == type));
 }
コード例 #23
0
 private Coroutine InvokeDelay(Action <ANIMATION_TYPE> action, float time, ANIMATION_TYPE type)
 {
     return(StartCoroutine(InvokeImpl(action, time, type)));
 }
コード例 #24
0
ファイル: NovelEditor.cs プロジェクト: pigwin/UnitySRPG
    //スクリプトを構文解析する関数
    void Script_parser(string temp)
    {
        Debug.Log("Script_parser");
        if (temp.Length <= 0)
        {
            return;
        }
        switch (temp[0])
        {
        //コメント
        case ';':
            break;

        case '!':
        {
            COMMAND_TYPE t = COMMAND_TYPE.WAIT_B;
            if (temp[1] == 'w')
            {
                t = COMMAND_TYPE.WAIT_W;
            }
            if (temp[1] == 's')
            {
                t = COMMAND_TYPE.WAIT_S;
            }
            string timer    = temp.Substring(2, temp.Length - 2);
            bool   skipflag = true;
            scriptions.Add(new WAIT_scription(Int32.Parse(timer), skipflag, temp, t));
        }
        break;

        case '[':
        {
            Special_script_parser(temp);
        }
        break;

        case '#':
            scriptions.Add(new COLOR_scription(Scripter.Color_Parser(temp), "", COMMAND_TYPE.COLOR));
            break;

        case '*':
            Debug.Log(temp);
            label_line.Add(temp, scriptions.Count);
            label_filename.Add(temp, "");
            break;

        default:
            string[] a = temp.Split(' ');               //命令コマンドと引数を分離
            //bg命令
            if (a[0] == "bg")
            {
                //string[] a = temp.Split(' ');   //命令コマンドと引数を分離
                string[] b    = a[1].Split(',');    //引数をカンマで各取得
                int      time = 0;

                //アニメーション情報の指定
                ANIMATION_TYPE type = Animation_Type_Define(Int32.Parse(b[1]));
                if (type != ANIMATION_TYPE.ANIMATION_NO_TIME && type != ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    time = Int32.Parse(b[2]);
                }

                //命令第一引数で、背景の指定を変化(色or画像)
                if (b[0].Equals("white"))
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser("#FFFFFF"), b[1], time, type, COMMAND_TYPE.BACKGROUND_COLOR));
                }
                else if (b[0].Equals("black"))
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser("#000000"), b[1], time, type, COMMAND_TYPE.BACKGROUND_COLOR));
                }
                else if (b[0][0] == '#')
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser(b[0]), b[1], time, type, COMMAND_TYPE.BACKGROUND_COLOR));
                }
                else
                {
                    string[] path = b[0].Split('\"');
                    scriptions.Add(new IMAGE_scription(null, type, b[1], time, path[1], COMMAND_TYPE.BACKGROUND_IMAGE));
                }

                break;
            }
            //bgm命令
            else if (a[0] == "bgm")
            {
                string[] b = a[1].Split('\"');
                scriptions.Add(new AUDIO_scription(Resources.Load <AudioClip>(b[1]), "", b[1], COMMAND_TYPE.AUDIO_BGM));
                break;
            }
            //bgmstop命令
            else if (a[0] == "bgmstop")
            {
                scriptions.Add(new Scription("bgmstop", COMMAND_TYPE.AUDIO_BGM_STOP));
                break;
            }

            //cl命令
            if (a[0] == "cl")
            {
                //string[] a = temp.Split(' ');
                string[] b     = a[1].Split(',');
                int      place = 1; //r 001
                int      time  = 0;
                switch (b[0][0])
                {
                case 'c':           //010
                    place = 2;
                    break;

                case 'l':           //100
                    place = 4;
                    break;

                case 'a':           //111
                    place = 7;
                    break;
                }
                //アニメーション情報の指定
                ANIMATION_TYPE type = Animation_Type_Define(Int32.Parse(b[1]));
                if (type != ANIMATION_TYPE.ANIMATION_NO_TIME && type != ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    time = Int32.Parse(b[2]);
                }

                scriptions.Add(new IMAGE_clear_scription(place, type, time, b[1], COMMAND_TYPE.STAND_IMAGE_CLEAR));
                break;
            }
            //partyadd命令
            // partyadd scobjname,level  レベルは無くてもよい
            if (a[0] == "partyadd")
            {
                string[] b         = a[1].Split(',');
                string   scobjname = b[0];
                int      level     = 0;
                //levelがかかれていた場合
                if (b.Length >= 2)
                {
                    level = int.Parse(b[1]);
                }

                scriptions.Add(new PARTY_scription(scobjname, level, "PARTY ADD", COMMAND_TYPE.PARTY_ADD));
                break;
            }
            //partyremove命令
            // partyremove scobjname
            if (a[0] == "partyremove")
            {
                string scobjname = a[1];
                scriptions.Add(new PARTY_scription(scobjname, 0, "PARTY REMOVE", COMMAND_TYPE.PARTY_REMOVE));
                break;
            }
            //delay命令
            if (a[0] == "delay")
            {
                //string[] a = temp.Split(' ');
                scriptions.Add(new WAIT_scription(Int32.Parse(a[1]), true, "", COMMAND_TYPE.WAIT));
                break;
            }
            //jump命令
            if (a[0] == "jump")
            {
                //string[] a = temp.Split(' ');
                scriptions.Add(new JUMP_scription(a[1], 0, "", "", COMMAND_TYPE.JUMP));
                break;
            }
            //ld命令
            if (a[0] == "ld")
            {
                //string[] a = temp.Split(' ');
                string[]     b           = a[1].Split(',');
                int          time        = 0;
                int          place       = 1; // r  001
                COMMAND_TYPE command_tmp = COMMAND_TYPE.STAND_IMAGE;
                switch (b[0][0])
                {
                case 'c':
                    place = 2;         //010
                    //command_tmp = COMMAND_TYPE.STAND_IMAGE_CENTER;
                    break;

                case 'l':
                    place = 4;         //100
                    //command_tmp = COMMAND_TYPE.STAND_IMAGE_RIGHT;
                    break;
                }
                string[] path = b[1].Split('\"');

                //アニメーション情報の指定
                ANIMATION_TYPE type = Animation_Type_Define(Int32.Parse(b[2]));
                if (type != ANIMATION_TYPE.ANIMATION_NO_TIME && type != ANIMATION_TYPE.ANIMATION_SYNCHRO)
                {
                    time = Int32.Parse(b[3]);
                }

                scriptions.Add(new STAND_IMAGE_scription(place, null, type, b[2], time, path[1], command_tmp));
                break;
            }
            //monocro命令
            //monocro #COLOR で色調マスクをON、色変更
            //monocro offでマスクを解除
            if (a[0] == "monocro")
            {
                //string[] a = temp.Split(' ');   //命令コマンドと引数を分離
                if (a[1] == "off")
                {
                    scriptions.Add(new Scription("monocro off", COMMAND_TYPE.MONOCRO_OFF));
                }
                else
                {
                    scriptions.Add(new COLOR_scription(Scripter.Color_Parser(a[1]), "monocro on", COMMAND_TYPE.MONOCRO_ON));
                }
                break;
            }
            //return命令
            if (a[0] == "return")
            {
                scriptions.Add(new Scription("finish", COMMAND_TYPE.RETURN));
                break;
            }
            //sestop命令
            if (a[0] == "sestop")
            {
                scriptions.Add(new Scription("sestop", COMMAND_TYPE.AUDIO_SE_STOP));
                break;
            }
            //setwindow命令
            else if (a[0] == "setwindow")
            {
                //string[] a = temp.Split(' ');
                string[] b = a[1].Split(',');

                string imgsource = b[0].Split('\"')[1];
                float  x         = float.Parse(b[1]);
                float  y         = float.Parse(b[2]);

                scriptions.Add(new UI_IMAGE_scription(x, y, imgsource, COMMAND_TYPE.SETWINDOW));

                break;
            }
            //se命令
            else if (a[0] == "seloop")
            {
                //string[] a = temp.Split('\"');
                string[] b = a[1].Split('\"');
                scriptions.Add(new AUDIO_scription(Resources.Load <AudioClip>(b[1]), "loop", b[1], COMMAND_TYPE.AUDIO_SE));
                break;
            }
            //se命令
            else if (a[0] == "se")
            {
                //string[] a = temp.Split('\"');
                string[] b = a[1].Split('\"');
                scriptions.Add(new AUDIO_scription(Resources.Load <AudioClip>(b[1]), "", b[1], COMMAND_TYPE.AUDIO_SE));
                break;
            }
            //texton命令
            if (a[0] == "texton")
            {
                scriptions.Add(new Scription("texton", COMMAND_TYPE.TEXTON));
                break;
            }
            //textoff命令
            else if (a[0] == "textoff")
            {
                scriptions.Add(new Scription("textoff", COMMAND_TYPE.TEXTOFF));
                break;
            }

            //voicestop命令
            if (a[0] == "voicestop")
            {
                scriptions.Add(new Scription("voicestop", COMMAND_TYPE.AUDIO_VOICE_STOP));
                break;
            }
            //voice命令
            else if (a[0] == "voice")
            {
                //string[] a = temp.Split('\"');
                string[] b = a[1].Split('\"');
                scriptions.Add(new AUDIO_scription(Resources.Load <AudioClip>(b[1]), "voice", b[1], COMMAND_TYPE.AUDIO_VOICE));
                break;
            }

            //wait命令
            if (a[0] == "wait")
            {
                //string[] a = temp.Split(' ');
                scriptions.Add(new WAIT_scription(Int32.Parse(a[1]), false, "", COMMAND_TYPE.WAIT));
                break;
            }
            Special_script_parser(temp);
            break;
        }
    }