Exemplo n.º 1
0
        void SpawnObjectUnitPos(SpawnObjectConfig target, Vector3 Pos)
        {
            Pos *= ZDGameRule.UNIT_IN_WORLD;
            string ObjPath = ZDAssetTable.GetPath(target.name);

            PhotonNetwork.InstantiateSceneObject(ObjPath, Pos, Quaternion.identity);
            if (target.flipX || target.flipY)
            {
                if (target.flipX)
                {
                    Pos.x = -Pos.x;
                }
                if (target.flipY)
                {
                    Pos.y = -Pos.y;
                }
                PhotonNetwork.InstantiateSceneObject(ObjPath, Pos, Quaternion.identity);
            }
        }
Exemplo n.º 2
0
        public void OnEvent(EventData photonEvent)
        {
            switch ((ZDGameEvent)photonEvent.Code)
            {
            case ZDGameEvent.OpenGame:
                Destroy(LoadingView);
                OpenGame();
                break;

            case ZDGameEvent.StartGame:
                StartGame();
                break;

            case ZDGameEvent.EndGame:
                EndGame(photonEvent.CustomData);
                break;

            case ZDGameEvent.SpawnEffect:
                object[] data = (object[])photonEvent.CustomData;
                Instantiate(ZDAssetTable.GetObject((string)data[0]), (Vector3)data[1], (Quaternion)data[2]);
                break;
            }
        }