コード例 #1
0
    public void Appear(DB.ColorID colorId, Transform tf)
    {
        brushSprite.color = DB.colorCode[(int)colorId];
        targetTf          = tf;

        currentLife = lifeTime;
    }
コード例 #2
0
    // Generatorによる初期値設定
    public void Init(int objID, DB.ColorID colID, Material mat)
    {
        // AudioManagerの取得
        am = GameObject.Find("AudioManager").GetComponent <AudioManager>();

        // 自分のSprite取得
        var tmpCorrect = transform.Find("Correct");
        var tmpAnswer  = transform.Find("Answer");

        //correctFrontSR = tmpCorrect.Find("FrontPicture").GetComponent<SpriteRenderer>();
        correctBackSR = tmpCorrect.Find("BackPicture").GetComponent <SpriteRenderer>();
        //answerFrontSR = tmpAnswer.Find("FrontPicture").GetComponent<SpriteRenderer>();
        answerBackSR = tmpAnswer.Find("BackPicture").GetComponent <SpriteRenderer>();
        tf           = transform;

        myObjectID     = objID;
        correctColorID = colID;

        correctBackSR.material = mat;
        answerBackSR.material  = mat;
        // Spriteのセット
        //correctFrontSR.sprite = sprite;
        //answerFrontSR.sprite = sprite;
        correctBackSR.color = DB.colorCode[(int)correctColorID];
    }
コード例 #3
0
    void PictureSetGenerate()
    {
        GameObject ps = Instantiate(pictureSetPrefab);

        lastGeneratedPictureSet          = ps.transform;
        lastGeneratedPictureSet.position = pictureSetInitPosition.position;

        //正解の色の決定
        DB.ColorID correctColor = ColorDecision();

        //マテリアルの作成
        Material currentMaterial = materialBuffer[currentMaterialIndex];

        MakeMaterial(currentMaterial);

        //ChangeColorの初期化
        ChangeColor changeColor = ps.GetComponent <ChangeColor>();

        changeColor.Init(currentObjectID, correctColor, currentMaterial);

        //Focusの初期化
        Focus focus = ps.GetComponent <Focus>();

        focus.Init(currentObjectID, focusFrame);

        currentObjectID++;
        currentMaterialIndex = (currentMaterialIndex + 1) % materialBufferNum;
    }
コード例 #4
0
    // Update is called once per frame
    private void Update()
    {
        // 自分にフォーカス
        if (DB.focusID == myObjectID)
        {
            if (tf == null || 10f < tf.position.x)
            {
                // 見えていないなら却下
                return;
            }
            if (!isAlreadyCatchedFocus)
            {
                // 先行入力なら却下(次の入力から取得)
                DB.currentColorID     = DB.ColorID.Null;
                isAlreadyCatchedFocus = true;
            }
            else if (DB.currentColorID != DB.ColorID.Null)
            {
                // そうでない & 色IDがID.Nullでないなら色取得
                answerColorID      = DB.currentColorID;
                answerBackSR.color = DB.colorCode[(int)answerColorID];

                // 合否判定
                isCorrect = (answerColorID == correctColorID);
                am.PlayOneShot("Painting");

                // 色を取得したらDBを次へ更新
                DB.currentColorID = DB.ColorID.Null;
                DB.focusID       += 1;
                isAlreadySetColor = true;

                //ブラシを表示
                BrushScript.Instance.Appear(answerColorID, transform);
            }
        }
    }
コード例 #5
0
 public void Init(int objID, DB.ColorID colorId, Sprite sprite)
 {
     Debug.Log("Init");
 }