コード例 #1
0
ファイル: ScoreHandleState.cs プロジェクト: tTomonori/KeyNote
        //音符を消した時の演出
        protected void productHit(Note aNote, TypeEvaluation.Evaluation aEvaluation)
        {
            //評価表示オブジェクト生成
            MyBehaviour tBehaviour = MyBehaviour.create <MyBehaviour>();

            tBehaviour.name = "evaluation";
            SpriteRenderer tRenderer = tBehaviour.gameObject.AddComponent <SpriteRenderer>();

            tBehaviour.transform.parent        = parent.mScore.transform;
            tBehaviour.transform.localScale    = new Vector3(1.7f, 1.7f, 1);
            tBehaviour.transform.localPosition = new Vector3(0, 0, 0);
            tBehaviour.transform.Translate(aNote.transform.position - parent.mScore.transform.position);
            tBehaviour.positionZ = -2;
            //sprite設定とアニメーション
            switch (aEvaluation)
            {
            case TypeEvaluation.Evaluation.perfect:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/perfect");
                tBehaviour.moveBy(new Vector3(0, 1, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.great:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/great");
                tBehaviour.moveBy(new Vector3(0, 0.6f, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.good:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/good");
                tBehaviour.moveBy(new Vector3(0, 0.4f, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.bad:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/bad");
                tBehaviour.moveBy(new Vector3(0, 0.1f, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;

            case TypeEvaluation.Evaluation.miss:
                tRenderer.sprite = Resources.Load <Sprite>("sprites/point/miss");
                tBehaviour.moveBy(new Vector3(0, -1, 0), 1, () => {
                    tBehaviour.delete();
                });
                break;
            }
        }
コード例 #2
0
    /// <summary>
    /// SEを再生する
    /// </summary>
    /// <param name="aFileName">ファイルへのパス("resources/sound/se" + X)</param>
    static public void playSe(string aFileName)
    {
        //音声ロード
        AudioSource tAudio = MyBehaviour.create <AudioSource>();

        tAudio.name = "SE : " + aFileName;
        tAudio.clip = Resources.Load <AudioClip>("sound/se/" + aFileName);
        if (tAudio.clip == null)
        {
            //音声のロードに失敗
            Debug.Log("音声のロードに失敗 : " + "「sound/se/" + aFileName + "」");
            return;
        }
        tAudio.Play();
        //再生終了したら削除
        MyBehaviour tBehaviour = tAudio.gameObject.AddComponent <MyBehaviour>();
        Coroutine   tCoroutine = null;

        tCoroutine = tBehaviour.runCoroutine(() => {
            if (!tAudio.isPlaying)
            {
                tBehaviour.StopCoroutine(tCoroutine);
                tBehaviour.delete();
            }
        });
    }
コード例 #3
0
    /// <summary>食糧取得or損失アニメーション</summary>
    public static void getFood(PlayerStatusDisplay aDisplay, int aFood, Action aCallback)
    {
        TextMesh tMesh = MyBehaviour.create <TextMesh>();

        tMesh.text               = (aFood >= 0 ? "+" : "") + aFood.ToString();
        tMesh.name               = "getFoodMesh : " + tMesh.text;
        tMesh.fontSize           = 100;
        tMesh.characterSize      = 0.04f;
        tMesh.anchor             = TextAnchor.MiddleLeft;
        tMesh.transform.position = new Vector3(aDisplay.positionX - 0.6f, aDisplay.positionY - 0.1f, -20);
        Vector2 tDirection;

        if (aFood >= 0)
        {
            //取得
            tMesh.color = new Color(0, 1, 1);
            tDirection  = new Vector2(0, 0.3f);
        }
        else
        {
            //損失
            tMesh.color = new Color(1, 0, 0);
            tDirection  = new Vector2(0, -0.3f);
        }
        MyBehaviour tBehaviour = tMesh.gameObject.AddComponent <MyBehaviour>();

        tBehaviour.moveBy(tDirection, 1.2f, () => {
            tBehaviour.delete();
            aCallback();
        });
    }
コード例 #4
0
ファイル: Beat.cs プロジェクト: tTomonori/KeyNote
    private void createBeatObject(bool aTriplet = false)
    {
        if (mBeatObject != null)
        {
            mBeatObject.delete();
        }
        mBeatObject = MyBehaviour.createObjectFromPrefab <MyBehaviour>("score/" + (aTriplet ? "beatTriplet" : "beat"));
        mBeatObject.transform.parent        = this.gameObject.transform;
        mBeatObject.transform.localPosition = new Vector3(0, 0, 0);
        mBeatObject.transform.localScale    = new Vector3(1, 1, 1);

        //配列初期化
        if (aTriplet)
        {
            mNotes    = new Note[3];
            mLyricses = new LyricsBubble[3];
            mBpms     = new ChangeBpmObject[3];
        }
        else
        {
            mNotes    = new Note[4];
            mLyricses = new LyricsBubble[4];
            mBpms     = new ChangeBpmObject[4];
        }
        //behaviour取得
        mNotePositions   = mBeatObject.findChild("notes").GetComponent <MyBehaviour>().GetComponentsInChildrenWithoutSelf <Transform>();
        mLyricsPositions = mBeatObject.findChild("lyricses").GetComponent <MyBehaviour>().GetComponentsInChildrenWithoutSelf <Transform>();
        mBpmPositions    = mBeatObject.findChild("bpms").GetComponent <MyBehaviour>().GetComponentsInChildrenWithoutSelf <Transform>();
        sendTimeToColliders();
    }
コード例 #5
0
 public override void release()
 {
     if (mLight != null)
     {
         mLight.delete();
     }
 }
コード例 #6
0
 //消滅
 protected void hitAndDelete(MyBehaviour aNoteObject)
 {
     //透明度
     aNoteObject.opacityBy(-1, 0.4f, () => {
         aNoteObject.delete();
     });
     //大きさ
     aNoteObject.scaleBy(new Vector3(0.3f, 0.5f, 0), 0.2f, null);
 }
コード例 #7
0
    public void throwLight()
    {
        MyBehaviour tLight = MyBehaviour.create <MyBehaviour>();

        tLight.gameObject.AddComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("sprites/game/dice/light");
        float tScale = Random.Range(0.3f, 0.6f);

        tLight.scale2D = new Vector2(tScale, tScale);
        tLight.transform.SetParent(this.transform, false);
        tLight.changeLayer(10);
        float   tMoveDistance = 2 * Random.Range(1, 4);
        float   tMoveSpeed    = 3 * Random.Range(1, 3);
        Vector2 tDirection    = Quaternion.Euler(0, 0, Random.Range(0, 359)) * new Vector2(tMoveDistance, 0);

        tLight.moveByWithSpeed(tDirection, tMoveSpeed, () => {
            tLight.delete();
        });
    }
コード例 #8
0
ファイル: StageView.cs プロジェクト: tTomonori/animalKing
    public void showStage(string aFilePath)
    {
        if (mMasContainer != null)
        {
            mMasContainer.name = "deleted";
            mMasContainer.delete();
            mRouteContainer.name = "deleted";
            mRouteContainer.delete();
        }

        StageData tStageData = new StageData(aFilePath);

        mStageData = tStageData;
        GamePlacer.placeMas(tStageData);
        mMasContainer = GameObject.Find("masContainer").GetComponent <MyBehaviour>();
        mMasContainer.transform.SetParent(mStage.transform, false);
        mRouteContainer = GameObject.Find("routeContainer").GetComponent <MyBehaviour>();
        mRouteContainer.transform.SetParent(mStage.transform, false);
    }
コード例 #9
0
ファイル: ScoreHandleState.cs プロジェクト: tTomonori/KeyNote
        //理想のタイミングとの差の表示
        protected void displayTimeDifference(Note aNote, float aDifference)
        {
            TextMesh    tText      = MyBehaviour.createObjectFromPrefab <TextMesh>("score/parts/evaluationDifference");
            MyBehaviour tBehaviour = tText.GetComponent <MyBehaviour>();

            tText.name = "timeDifference";
            //テキスト設定
            double tDifference = Math.Round(Mathf.Abs(aDifference), 2);

            if (tDifference == 0)
            {
                tText.text  = "just";
                tText.color = new Color(0, 1, 0);
            }
            else if (aDifference < 0)
            {
                tText.text  = "-" + tDifference.ToString();
                tText.color = new Color(0, 0, 1);
            }
            else if (aDifference > 0)
            {
                tText.text  = "+" + tDifference.ToString();
                tText.color = new Color(1, 0, 0);
            }
            //表示位置調整
            tBehaviour.transform.parent        = parent.mScore.transform;
            tBehaviour.transform.localScale    = new Vector3(1.7f, 1.7f, 1);
            tBehaviour.transform.localPosition = new Vector3(0, 0, 0);
            tBehaviour.transform.Translate(aNote.transform.position - parent.mScore.transform.position);
            tBehaviour.positionZ  = -2;
            tBehaviour.positionY -= 1.5f;
            //削除
            tBehaviour.setTimeout(2, () => {
                tBehaviour.delete();
            });
        }