Ejemplo n.º 1
0
    void Start()
    {
        // デバッグ用
        if (initDatas == null)
        {
            initDatas = new List <InitData>();
            initDatas.Add(new InitData(InitData.eCharaId.Detective, 0));
            initDatas.Add(new InitData(InitData.eCharaId.Phantom0, 1));
            initDatas.Add(new InitData(InitData.eCharaId.Phantom1, 2));
            initDatas.Add(new InitData(InitData.eCharaId.Phantom2, 3));
        }

        // 座標取得
        var pointTrans = GameObject.Find("Points").transform;

        // お宝の座標
        m_TresurePosDatas    = new TresurePosDataBase[4];
        m_TresurePosDatas[0] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P1").position);
        m_TresurePosDatas[1] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P2").position);
        m_TresurePosDatas[2] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P3").position);
        m_TresurePosDatas[3] = new TresurePosDataBase(pointTrans.Find("ItemRespawnPoints/P4").position);
        // 怪盗リスポーン座標
        m_phantomRespawnPosDatas    = new Vector3[4];
        m_phantomRespawnPosDatas[0] = pointTrans.Find("PhantomRespawnPoints (1)/P1").position;
        m_phantomRespawnPosDatas[1] = pointTrans.Find("PhantomRespawnPoints (1)/P2").position;
        m_phantomRespawnPosDatas[2] = pointTrans.Find("PhantomRespawnPoints (1)/P3").position;
        m_phantomRespawnPosDatas[3] = pointTrans.Find("PhantomRespawnPoints (1)/P4").position;
        // 探偵の座標
        m_detectivePosData = pointTrans.Find("DetectiveRespawnPoints (2)/P1").position;

        // 全体のお宝
        m_stockTreasures.Add(new TreasureData(eTreasureType.Ring));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Ring));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Ring));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Bracelet));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Bracelet));
        m_stockTreasures.Add(new TreasureData(eTreasureType.Crown));
        m_treasureMaxAll = m_stockTreasures.Count;

        m_treasureNumText = GameObject.Find("TreasureNum").GetComponent <Text>();
        m_treasureNumText.gameObject.SetActive(false);
        m_moonBeginTransform = GameObject.Find("MoonBegin").GetComponent <RectTransform>();
        m_moonEndTransform   = GameObject.Find("MoonEnd").GetComponent <RectTransform>();
        m_moonTransform      = GameObject.Find("moon").GetComponent <RectTransform>();
        m_moonTransform.gameObject.SetActive(false);
        m_timeText = GameObject.Find("timeText").GetComponent <Text>();

        UpdateTreasureNumText();

        for (int i = 0; i < initDatas.Count; i++)
        {
            if (initDatas[i].charaId == InitData.eCharaId.None)
            {
                continue;
            }
            string  path = "";
            Vector3 pos  = Vector3.zero;
            switch (initDatas[i].charaId)
            {
            case InitData.eCharaId.Detective:
                path = "Prefabs/Character/Detective";
                pos  = m_detectivePosData;
                break;

            case InitData.eCharaId.Phantom0:
                path = "Prefabs/Character/Phantom";
                pos  = m_phantomRespawnPosDatas[0];
                break;

            case InitData.eCharaId.Phantom1:
                path = "Prefabs/Character/Phantom2";
                pos  = m_phantomRespawnPosDatas[1];
                break;

            case InitData.eCharaId.Phantom2:
                path = "Prefabs/Character/Phantom3";
                pos  = m_phantomRespawnPosDatas[2];
                break;
            }
            var obj = Instantiate(Resources.Load(path)) as GameObject;
            obj.transform.position = pos;
            switch (initDatas[i].charaId)
            {
            case InitData.eCharaId.Detective:
                m_detective = obj.GetComponent <Detective>();
                m_detective.Init(initDatas[i]);
                break;

            case InitData.eCharaId.Phantom0:
                m_phantom1 = obj.GetComponent <Phantom>();
                m_phantom1.Init(initDatas[i]);
                break;

            case InitData.eCharaId.Phantom1:
                m_phantom2 = obj.GetComponent <Phantom>();
                m_phantom2.Init(initDatas[i]);
                break;

            case InitData.eCharaId.Phantom2:
                m_phantom3 = obj.GetComponent <Phantom>();
                m_phantom3.Init(initDatas[i]);
                break;
            }
        }
        //Instantiate(Resources.Load("Prefabs/Stage/Stage00"));
        CreateTresure();

        FadeManager.TipsOn();
    }