Exemple #1
0
    public void OnInject()
    {
        PrefubManager.InitPlayer(Player);
        PrefubManager.InitUnits(Units);
        PrefubManager.InitItems(Items);
        TargetManager.Init();
        GuiPoolManager.SetPool(GuiPool.guiPool);

        MapGenerator.StartApplication();
    }
Exemple #2
0
    public AiController CreateMinerUnit(int id, Vector2Int pos)
    {
        var parent = GameObject.Find("Units");
        var prefub = PrefubManager.GetUnit(id);
        var unit   = GameObject.Instantiate(prefub, Vector3.zero, new Quaternion()) as GameObject;

        unit.transform.parent = parent.transform;
        var controller = unit.GetComponent <AiController>();

        Container.Inject(controller);
        controller.Init(pos);
        controller.InitMinerBehaviour();
        return(controller);
    }
Exemple #3
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);
    }
Exemple #4
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;
    }