示例#1
0
    void InitClient(int gridX, int gridY, float offsetX, float offsetY)
    {
        Debug.Log("InitClient");
        playground      = Instantiate <VisualPlayground>(playground_prefab);
        playground.name = "Playground";
        playground.Init(gridX, gridY, offsetX, offsetY);

        character = new VisualJack[2];

        var l1 = Instantiate <VisualJack>(jack_prefab);

        l1.Init(PLAY.ER1, 0, 0, playground.Pos(0, 0));
        Debug.Log("jack 1 pos = " + playground.Pos(0, 0));
        l1.name      = "Jack-1";
        character[0] = l1;

        var l2 = Instantiate <VisualJack>(jack_prefab);

        l2.Init(PLAY.ER2, gridX - 1, 0, playground.Pos(gridX - 1, 0));
        l2.name      = "Jack-2";
        character[1] = l2;

        iAm = PhotonNetwork.isMasterClient ? PLAY.ER1 : PLAY.ER2;

        input         = FindObjectOfType <InputAdapter>();
        input.onTap  += OnTap;
        input.onDrag += OnDrag;

        ui = FindObjectOfType <UIAdapter>();

        photonView.RPC("S_ClientInited", PhotonTargets.MasterClient, (int)iAm);
    }
示例#2
0
 void Start()
 {
     playground = GameObject.FindObjectOfType <VisualPlayground>();
     if (playground == null)
     {
         throw new UnityException("cant find (visual) Playground");
     }
 }