コード例 #1
0
    bool static_border;     //静态边界是否已构建

    // Use this for initialization
    void Start()
    {
        //  DontDestroyOnLoad(transform.gameObject);
        //PhotonNetwork.OfflineMode = true;
        if (PhotonNetwork.IsMasterClient)
        {
            GameObject item = PhotonNetwork.Instantiate("Axe", new Vector3(15, 1f, 6), Quaternion.identity);
            item.name = "Axe";
            item.transform.SetParent(GameObject.Find("MovableStuff").transform);
        }


        Environment = GameObject.Find("Environment").transform;

        Rail_preview   = GameObject.Find("Environment").transform.Find("Rail_preview");
        Bridge_preview = GameObject.Find("Environment").transform.Find("Bridge_preview");

        GameObject player = PhotonNetwork.Instantiate("Player3", new Vector3(14, 2.2f, 14), Quaternion.identity);

        player.name = "Player";
        Player      = player.transform;

        toolManager = Player.GetComponent <ToolManager>();

        //GameObject train = PhotonNetwork.Instantiate("Train", new Vector3(13, 1, 4), Quaternion.identity);
        //train.name = "Train";
        //Train = train.transform;
        Train        = GameObject.Find("Train").transform;
        trainManager = Train.GetComponent <TrainManager>();

        Rails        = GameObject.Find("Rails").transform;
        railsManager = Rails.GetComponent <RailsManager>();

        PanelManager = GameObject.Find("Panel").transform.Find("Canvas").GetComponent <Panel>();

        SetObstacleArray();
        SetBorderArray();
        railsManager.InitRails();
        trainManager.InitTrain();

        Pass          = false;
        ReachTerminal = false;
        BridgeBuild   = false;
        RailPut       = false;
        TrainMove     = false;

        static_border = false;
        testflag      = false;

        // 倒计时3秒出发
        //Invoke("TrainSetOut", 3.0f);
    }