コード例 #1
0
    void Update()
    {
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        //Debug.Log(ray);
        if (Physics.Raycast(ray, out hit))
        {
            Debug.Log(" you clicked on " + hit.collider.gameObject.name);

            if (hit.collider.gameObject.tag == "Treasures")
            {
                TreasureAttributes tr = hit.collider.gameObject.GetComponent <TreasureAttributes> ();
                TreasureSetupController.currTargetName = tr.getTargetImg();
                TreasureSetupController.currPoint      = tr.getPoint();
                TreasureSetupController.currTreasureID = int.Parse(tr.getTreasureID());
                GameManager.instance.treasure_id       = int.Parse(tr.treasureID);
                Debug.Log(GameManager.instance.treasure_id);

                GameManager.instance.point       = tr.treasurePoint;
                GameManager.instance.minigameCat = tr.catchGameFlag;
                GameManager.instance.question    = tr.question;
                GameManager.instance.answer      = tr.answer;
                Debug.Log("The target image is" + TreasureSetupController.currTargetName);
                // Load appropriate scene accroding to the catchGameFlag
                int catchGameFlag = tr.getCatchGameFlag();

                GameManager.instance.treasure_id = int.Parse(tr.treasureID);
                Debug.Log(GameManager.instance.treasure_id);

                GameManager.instance.point       = tr.treasurePoint;
                GameManager.instance.minigameCat = tr.catchGameFlag;

                Debug.Log("The target image is" + TreasureSetupController.currTargetName);
                if (GameManager.instance.minigameCat == 4)
                {
                    if (count == 0)
                    {
                        GameManager.instance.MoveScene("H_CatchView2D");
                    }
                }
                else
                {
                    if (count == 0)
                    {
                        GameManager.instance.MoveScene("H_CatchView");
                        count++;
                    }
                }
            }
        }
    }
コード例 #2
0
    GameObject MakeNewTreasure(GameObject parent, string trId, string trName, string trDes,
                               string gameId, string trLoc, int trPoint, int trCatchGame, string treasureImg, string targetImg, string question, string answer)
    {
        GameObject newTreasure = (GameObject)Instantiate(treasure, StringToVector3(trLoc), Quaternion.identity);

        newTreasure.transform.localScale = Vector3.one;
        TreasureAttributes tr = newTreasure.GetComponent <TreasureAttributes>();

        tr.setAttributes(trId, trName, trDes, gameId, StringToVector3(trLoc), trPoint, trCatchGame, treasureImg, targetImg, question, answer);
        tr.setAsChildOf(parent);
        newTreasure.name        = trId;
        newTreasure.tag         = "Treasures";
        tr.transform.localScale = new Vector3(10, 10, 10);
        return(newTreasure);
    }