Beispiel #1
0
    void Start()
    {
        PlanarShadows.ShadowingLightDirection = ShadowingLight.transform.forward;
        PlanarShadows.ShadowColor             = ShadowColor;

        foreach (GameObject[] soldierGOs in _allSoldierGOs)
        {
            List <SkinnedMeshRenderer> teamSkinnedMeshRenderers = new List <SkinnedMeshRenderer>();
            Bounds localBounds = new Bounds(new Vector3(0.0f, 1f, 0.0f), new Vector3(10, 5f, 8f));

            foreach (GameObject soldierGO in soldierGOs)
            {
                SkinnedMeshRenderer[] soldierSkinnedMeshRenderers = soldierGO.GetComponentsInChildren <SkinnedMeshRenderer>();
                for (int i = 0; i < soldierSkinnedMeshRenderers.Length; ++i)
                {
                    teamSkinnedMeshRenderers.Add(soldierSkinnedMeshRenderers[i]);
                }

                Animation anim = soldierGO.GetComponent <Animation>();
                //AnimationState animState = anim["run"];
                //animState.time = Random.Range( 0f, animState.length - 0.1f );
                anim.CrossFade(_animationNames[Random.Range(0, _animationNames.Length - 1)]);
                //anim.Play( "run" );
            }

            GameObject teamGO = SkinnedMeshCombiner.Combine(teamSkinnedMeshRenderers, localBounds);
            PlanarShadows.EnableShadowOnGameObject(teamGO, true);
        }
    }
 void Awake()
 {
     gameManager = FindObjectOfType <GameManager>();
     if (!meshCombiner)
     {
         meshCombiner = GetComponent <SkinnedMeshCombiner>();
     }
     UpdateBoneTransforms();
 }
Beispiel #3
0
 // Token: 0x06001284 RID: 4740 RVA: 0x0006E6A0 File Offset: 0x0006C8A0
 private static AvatarDecorator CreateAvatarMesh(AvatarGearParts gear)
 {
     SkinnedMeshCombiner.Combine(gear.Base, gear.Parts);
     gear.Parts.ForEach(delegate(GameObject obj)
     {
         UnityEngine.Object.Destroy(obj);
     });
     return(gear.Base.GetComponent <AvatarDecorator>());
 }
Beispiel #4
0
    public virtual void UpdateUMAMesh(bool updatedAtlas)
    {
        combinedMeshList     = new List <SkinnedMeshCombiner.CombineInstance>();
        combinedMaterialList = new List <Material>();

        if (updatedAtlas)
        {
            CombineByShader();
        }
        else
        {
            CombineByMaterial();
        }

        if (umaData.firstBake)
        {
            umaData.myRenderer.sharedMesh = new Mesh();

            //	umaData.TMPmyRenderer = Instantiate (umaData.myRenderer)  as SkinnedMeshRenderer;

            //	umaData.TMPmyRenderer.sharedMesh = new Mesh();
        }

        var boneMap = new Dictionary <Transform, Transform>();

        SkinnedMeshCombiner.CombineMeshes(umaData.myRenderer, combinedMeshList.ToArray(), boneMap);
        //	SkinnedMeshCombiner.CombineMeshes(umaData.TMPmyRenderer, combinedMeshList.ToArray(), boneMap);

        if (updatedAtlas)
        {
            RecalculateUV();
        }

        umaData.umaRecipe.ClearDNAConverters();
        for (int i = 0; i < umaData.umaRecipe.slotDataList.Length; i++)
        {
            DKSlotData slotData = umaData.umaRecipe.slotDataList[i];
            if (slotData != null)
            {
                umaData.EnsureBoneData(slotData.umaBoneData, boneMap);

                umaData.umaRecipe.AddDNAUpdater(slotData.slotDNA);
            }
        }

        umaData.myRenderer.quality = SkinQuality.Bone4;
        //	umaData.TMPmyRenderer.quality = SkinQuality.Bone4;
        umaData.myRenderer.useLightProbes = true;
        //	umaData.TMPmyRenderer.useLightProbes = true;
        umaData.myRenderer.sharedMaterials = combinedMaterialList.ToArray();
        //	umaData.TMPmyRenderer.sharedMaterials = combinedMaterialList.ToArray();
        //umaData.myRenderer.sharedMesh.RecalculateBounds();
        umaData.myRenderer.sharedMesh.name = "UMAMesh";
        //	umaData.TMPmyRenderer.sharedMesh.name = "UMAMesh";

        umaData.firstBake = false;
    }
Beispiel #5
0
    // Token: 0x06001282 RID: 4738 RVA: 0x0006E5A4 File Offset: 0x0006C7A4
    public static AvatarDecoratorConfig InstantiateRagdoll(AvatarGearParts gear, Color skinColor)
    {
        SkinnedMeshCombiner.Combine(gear.Base, gear.Parts);
        LayerUtil.SetLayerRecursively(gear.Base.transform, UberstrikeLayer.Ragdoll);
        gear.Base.GetComponent <SkinnedMeshRenderer>().updateWhenOffscreen = true;
        AvatarDecoratorConfig component = gear.Base.GetComponent <AvatarDecoratorConfig>();

        component.SetSkinColor(skinColor);
        return(component);
    }
Beispiel #6
0
    // Token: 0x06001502 RID: 5378 RVA: 0x00076CDC File Offset: 0x00074EDC
    private AvatarDecoratorConfig CreateLutzRavinoff(Loadout gearLoadout)
    {
        AvatarDecoratorConfig defaultRagdoll        = PrefabManager.Instance.DefaultRagdoll;
        AvatarDecoratorConfig avatarDecoratorConfig = UnityEngine.Object.Instantiate(defaultRagdoll) as AvatarDecoratorConfig;
        List <GameObject>     list = new List <GameObject>();

        SkinnedMeshCombiner.Combine(avatarDecoratorConfig.gameObject, list);
        foreach (GameObject obj in list)
        {
            UnityEngine.Object.Destroy(obj);
        }
        return(avatarDecoratorConfig);
    }
Beispiel #7
0
    // Token: 0x06001503 RID: 5379 RVA: 0x00076D5C File Offset: 0x00074F5C
    private AvatarDecoratorConfig CreateHolo(IUnityItem holo)
    {
        AvatarDecoratorConfig avatarDecoratorConfig = null;
        GameObject            gameObject            = holo.Create(Vector3.zero, Quaternion.identity);
        HoloGearItem          component             = gameObject.GetComponent <HoloGearItem>();

        if (component && component.Configuration.Ragdoll)
        {
            avatarDecoratorConfig = (UnityEngine.Object.Instantiate(component.Configuration.Ragdoll) as AvatarDecoratorConfig);
            LayerUtil.SetLayerRecursively(avatarDecoratorConfig.transform, UberstrikeLayer.Ragdoll);
            SkinnedMeshCombiner.Combine(avatarDecoratorConfig.gameObject, new List <GameObject>());
        }
        UnityEngine.Object.Destroy(gameObject);
        return(avatarDecoratorConfig);
    }
Beispiel #8
0
 // Token: 0x06001D5D RID: 7517 RVA: 0x00092010 File Offset: 0x00090210
 public static void Combine(GameObject target, List <GameObject> objects)
 {
     if (target && objects != null)
     {
         SkinnedMeshCombiner.CopyComponents(target, objects);
         List <SkinnedMeshRenderer> list = new List <SkinnedMeshRenderer>();
         foreach (GameObject gameObject in objects)
         {
             if (gameObject != null)
             {
                 list.AddRange(gameObject.GetComponentsInChildren <SkinnedMeshRenderer>(true));
             }
         }
         SkinnedMeshCombiner.SuperCombineCreate(target, list);
     }
 }
Beispiel #9
0
    private void Start()
    {
        if (Motor == null)
        {
            Debug.LogError("Error Linking Controller System");
            return;
        }

        OrbitCamera = GetComponentInChildren <KIN_Cam>();
        if (isLocal)
        {
            //joystick
            _Joystick = FindObjectOfType <VariableJoystick>();
            if (_Joystick == null)
            {
                Debug.LogError("Joystick not found");
                return;
            }

            // Camera
            OrbitCamera.IgnoredColliders.Clear();
            OrbitCamera.IgnoredColliders.AddRange(gameObject.GetComponents <Collider>());
            //seperate the camera
            OrbitCamera.transform.parent = null;
            OrbitCamera.SetFollowTransform(CameraFollowPoint);


            // instances refrence
            UIManager.Instance.JumpButton.onClick.AddListener(OnJumpPressed);
        }
        else
        {
            gameObject.name = "AI_Player" + gameObject.GetInstanceID();
            GameObject.Destroy(OrbitCamera.gameObject);
        }


        //players stats
        playerstats = GetComponent <Player_Stats>();


        _Combiner = GetComponentInChildren <SkinnedMeshCombiner>();


        // tran to default:
        TransitionToState(CharacterState.Default);
    }
Beispiel #10
0
 // Token: 0x06001283 RID: 4739 RVA: 0x0006E5FC File Offset: 0x0006C7FC
 private static void UpdateAvatarMesh(AvatarDecorator avatar, AvatarGearParts gear)
 {
     if (!avatar)
     {
         Debug.LogError("AvatarDecorator is null!");
         return;
     }
     gear.Parts.Add(gear.Base);
     foreach (ParticleSystem particleSystem in avatar.GetComponentsInChildren <ParticleSystem>(true))
     {
         UnityEngine.Object.Destroy(particleSystem.gameObject);
     }
     SkinnedMeshCombiner.Update(avatar.gameObject, gear.Parts);
     avatar.renderer.receiveShadows = false;
     gear.Parts.ForEach(delegate(GameObject obj)
     {
         UnityEngine.Object.Destroy(obj);
     });
 }
    private void Start()
    {
        if (!meshCombiner)
        {
            meshCombiner = GetComponentInChildren <SkinnedMeshCombiner>();
        }

        var hips = transform.Find("Character/Root/Hips");

        if (hips)
        {
            equipmentTransformLookup[EquipmentSlot.None]     = null;
            equipmentTransformLookup[EquipmentSlot.Head]     = hips.Find("Spine_01/Spine_02/Spine_03/Neck/Head");
            equipmentTransformLookup[EquipmentSlot.Chest]    = hips.Find("Spine_01/Spine_02/Spine_03/");
            equipmentTransformLookup[EquipmentSlot.MainHand] = hips.Find("Spine_01/Spine_02/Spine_03/Clavicle_R/Shoulder_R/Elbow_R/Hand_R");
            equipmentTransformLookup[EquipmentSlot.OffHand]  = hips.Find("Spine_01/Spine_02/Spine_03/Clavicle_L/Shoulder_L/Elbow_L/Hand_L");
        }

        if (!itemManager)
        {
            itemManager = FindObjectOfType <ItemManager>();
        }
    }
Beispiel #12
0
    IEnumerator LoadAvatar()
    {
        if (isLoading)
        {
            Debug.Log("Now Loading!");
            yield break;
        }

        // ルートボーン用のファイルを読み込む
        Debug.Log("rootBoneFileName " + rootBoneFileName);
        ResourceRequest bornReq = Resources.LoadAsync <GameObject>(rootBoneFileName);

        // 各パーツのファイルを読み込む
        for (int i = 0; i < partsNum; i++)
        {
            resourceReqs[i] = Resources.LoadAsync <Object>(selectedFileNames[i]);
        }

        // ロード待ち
        while (true)
        {
            bool isLoadEnd = true;
            for (int i = 0; i < partsNum; i++)
            {
                if (!resourceReqs[i].isDone)
                {
                    isLoadEnd = false;
                }
            }

            if (isLoadEnd)
            {
                break;
            }
            yield return(null);
        }

        while (!bornReq.isDone)
        {
            yield return(null);
        }

        // Resourcesから必要なファイルを読み込み終わったら、空のGameObjectを生成
        GameObject root = new GameObject();

        root.transform.position   = Vector3.zero;
        root.transform.localScale = Vector3.one;
        root.name = "Avatar";

        // 生成した空のGameObjectにSkinnedMeshCombinerを追加する(以下、Root)
        SkinnedMeshCombiner smc = root.AddComponent <SkinnedMeshCombiner>();

        if (bornReq.asset == null)
        {
            Debug.LogError("born asset is null");
        }
        // ルートボーン用のファイルをInstantiateする
        GameObject rootBone = (GameObject)Instantiate(bornReq.asset as GameObject);

        if (rootBone != null)
        {
            rootBone.transform.parent        = root.transform;
            rootBone.transform.localPosition = Vector3.zero;
            rootBone.transform.localScale    = Vector3.one;
            rootBone.transform.localRotation = Quaternion.identity;
            smc.rootBoneObject = rootBone.transform;
        }
        else
        {
            Debug.LogError("Root Bone Instantiate Error!");
            yield break;
        }

        // Rootの下に読み込んだファイル一式をInstanTiateする
        for (int i = 0; i < partsNum; i++)
        {
            GameObject obj = (GameObject)Instantiate(resourceReqs[i].asset);
            if (obj != null)
            {
                Debug.Log("[" + i + "] " + obj.name);
                obj.transform.parent        = root.transform;
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.one;
                obj.transform.localRotation = Quaternion.identity;
                // 生成したモデルをRootのSkinnedMeshCombinerの各種プロパティに設定する
                smc.equipPartsObjectList[i] = obj;
            }
        }

        // レッツ・コンバイン
        smc.Combine();

        // AvatarTest.playerにRootを割り当てる(古いRootは削除する)
        if (player != null)
        {
            GameObject.DestroyImmediate(player);
            player = null;
        }

        player = root;
    }
Beispiel #13
0
 private void Awake()
 {
     smCombiner             = GetComponent <SkinnedMeshCombiner>();
     smCombiner.mergeMethod = SkinnedMeshCombiner.MergeMethod.OneMeshPerMaterial;
 }