Example #1
0
    void CreatePlayer()
    {
        var parent = GameObject.Find("Units");
        var prefub = PrefubManager.GetPlayer();

        player = GameObject.Instantiate(prefub, Vector3.zero, new Quaternion()) as GameObject;
        player.transform.parent = parent.transform;
        var controller = player.GetComponent <PlayerController>();

        Container.Inject(controller);
        controller.Init(MapGenerator.CenterPos);
        PlayerController = controller;

        var worldPos = TileDataProvider.OffsetTileToWorldPos(MapGenerator.CenterPos);

        Camera.main.transform.GetComponent <TargetChase>().target = player.transform;


        controller.Id = 1;// PhotonNetwork.player.ID;
        otherPlayers.Add(controller);

        //  PhotonManager.inst.SendSpawnUnit(controller.Id, worldPos);
    }
Example #2
0
    public void CreateOtherPlayer(int id, Vector3 worldPos)
    {
        var offset = TileDataProvider.WorldPosToOffsetTile(worldPos);
        var parent = GameObject.Find("Units");
        var prefub = PrefubManager.GetPlayer();

        player = GameObject.Instantiate(prefub, Vector3.zero, new Quaternion()) as GameObject;
        player.transform.parent = parent.transform;

        var controller = player.GetComponent <PlayerController>();

        Container.Inject(controller);
        controller.Init(offset);
        //PlayerController = controller;

        var joystick = player.GetComponent <IJoystick>();

        MonoBehaviour.Destroy(joystick as MonoBehaviour);

        otherPlayers.Add(controller);


        controller.Id = id;
    }