Exemple #1
0
 //! Update soldier GO.
 public void UpdateSoldier(ja2.Soldier Soldier_, GameObject SoldierGO)
 {
     var combined_mesh_com = SoldierGO.GetComponent<SoldierController>();
     // Remove old combined mesh
     Destroy(combined_mesh_com.combinedMesh);
     // Create new
     combined_mesh_com.combinedMesh = charEntityManager.Create(Soldier_.character(), SoldierGO);
     // Must use task here because of unity bug - When mesh is replaced,
     // animation stops to play and is shown in T-pose
     new utils.Task(RebuildCharacterWorkaround(SoldierGO));
 }
Exemple #2
0
    //! Create full mercenary GO.
    public GameObject CreateSoldier(ja2.Soldier Soldier_)
    {
        // Load prefab of soldier
        var soldier_go = utils.PrefabManager.Create("Soldier");
        // Associate solder
        soldier_go.GetComponent<SoldierController>().SetMercenary(Soldier_);
        // Create skinned mesh on parameters and save it
        soldier_go.GetComponent<SoldierController>().combinedMesh = charEntityManager.Create(Soldier_.character(), soldier_go);
        // Activate now, because now is everything set up and we won't get
        // any errors from bones mismatch etc
        soldier_go.SetActive(true);

        return soldier_go;
    }