public void OverrideAnimClip(string motion, string clipname) { //get override clip AnimationClip animClip = XResources.Load <AnimationClip>(clipname, AssetType.Anim); OverrideAnimClip(motion, animClip); }
static void OnInitCallback(byte t, IntPtr ptr) { string command = Marshal.PtrToStringAnsi(ptr); switch (t) { case ASCII.L: XDebug.CLog(command); break; case ASCII.W: XDebug.CWarn(command); break; case ASCII.E: XDebug.CError(command); break; case ASCII.G: GameObject go = XResources.Load <GameObject>(command, AssetType.Prefab); go.name = command; break; case ASCII.U: XDebug.CLog("unload: " + command); break; default: XDebug.LogError(t + " is not parse symbol: " + command); break; } }
public void PlayHitFx(Transform trans, string fx, bool follow) { if (string.IsNullOrEmpty(fx)) { return; } hit_fx = XResources.Load <GameObject>(fx, AssetType.Prefab); binded_bone = trans.Find("Bip001/Bip001 Pelvis/Bip001 Spine"); Transform parent = (binded_bone == null) ? trans : binded_bone; if (follow) { hit_fx.transform.parent = parent; hit_fx.transform.localPosition = Vector3.zero; hit_fx.transform.localRotation = Quaternion.identity; hit_fx.transform.localScale = Vector3.one; } else { hit_fx.transform.position = parent.position; hit_fx.transform.rotation = parent.rotation; } ParticleSystem[] systems = hit_fx.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem system in systems) { system.Play(); } }
private void TailResult(bool present) { if (_data.Skill.Result[_data.Sequnce].LongAttackData.TriggerAtEnd) { if (_data.Warning) { _bullet.transform.position = _data.WarningPos; } Result(null); } if (!present) { return; } if (!string.IsNullOrEmpty(_data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx)) { GameObject fx = XResources.Load <GameObject>(_data.Skill.Result[_data.Sequnce].LongAttackData.End_Fx, AssetType.Prefab); Vector3 pos = _bullet.transform.position; if (_data.Skill.Result[_data.Sequnce].LongAttackData.EndFx_Ground) { pos.y = 0; } fx.transform.position = pos; fx.transform.rotation = _bullet.transform.rotation; XResources.Destroy(fx, _data.Skill.Result[_data.Sequnce].LongAttackData.EndFx_LifeTime); } if (_data.Firer.ShownTransform == _bullet.transform) { _data.Firer.ShownTransform = _data.Firer.Transform; } }
private static bool _SaveMountAssett(GameObject fbx, ModelImporter modelImporter, string path) { string saveRootPath = "Assets/Resources/Prefabs/Equipment/"; GameObject go = GameObject.Instantiate(fbx) as GameObject; Renderer[] renders = go.GetComponentsInChildren <Renderer>(); Shader shader = Shader.Find("Custom/Common/MobileDiffuse"); foreach (Renderer r in renders) { r.lightProbeUsage = LightProbeUsage.BlendProbes; r.shadowCastingMode = ShadowCastingMode.Off; r.receiveShadows = false; foreach (Material mat in r.sharedMaterials) { mat.shader = shader; } } Animator animator = go.GetComponent <Animator>(); animator.runtimeAnimatorController = XResources.Load <RuntimeAnimatorController>("Controller/XMinorAnimator", AssetType.Controller); go.layer = LayerMask.NameToLayer("Role"); PrefabUtility.CreatePrefab(saveRootPath + fbx.name + ".prefab", go, ReplacePrefabOptions.ReplaceNameBased); GameObject.DestroyImmediate(go); modelImporter.isReadable = false; return(true); }
public void Initial(GameObject camera) { base.Initilize(); _cameraObject = camera; _cameraTransform = camera.transform; if (_cameraObject != null) { _camera = _cameraObject.GetComponent <Camera>(); _camera.enabled = true; if (_dummyObject == null) { _dummyObject = XResources.Load <GameObject>("Prefabs/DummyCamera", AssetType.Prefab); _dummyObject.name = "Dummy Camera"; } _dummyCamera = _dummyObject.transform.GetChild(0); _ator = _dummyObject.GetComponent <Animator>(); if (_overrideController == null) { _overrideController = new AnimatorOverrideController(); } _overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController; _ator.runtimeAnimatorController = _overrideController; } }
public void Initialize() { _cameraObject = GameObject.Find(@"Main Camera"); if (_cameraObject != null) { _camera = _cameraObject.GetComponent <Camera>(); _cameraTransform = _cameraObject.transform; XResources.Destroy(_dummyObject); _dummyObject = XResources.Load <GameObject>("Prefabs/DummyCamera", AssetType.Prefab); _dummyObject.name = "Dummy Camera"; _dummyCamera = _dummyObject.transform.GetChild(0); _ator = _dummyObject.GetComponent <Animator>(); _overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController; _ator.runtimeAnimatorController = _overrideController; _root_pos_inited = false; _idle_root_pos_inited = false; _status = XCameraExStatus.Idle; _status_changed = false; _idle_root_rotation_y = 0; } }
public void Effect(XCameraMotionData motion, bool overrideclip) { //must be called from UPDATE pass AnimationClip clip = XResources.Load <AnimationClip>(motion.Motion3D, AssetType.Anim); if (clip != null) { _trigger = "ToEffect"; if (overrideclip && _overrideController["CameraEffect"] != clip) { _overrideController["CameraEffect"] = clip; } _motion.LookAt_Target = motion.LookAt_Target; _motion.Follow_Position = true; _motion.Coordinate = CameraMotionSpace.World; switch (motion.Motion3DType) { case CameraMotionType.AnchorBased: _motion.AutoSync_At_Begin = true; _motion.LookAt_Target = false; break; case CameraMotionType.CameraBased: _motion.AutoSync_At_Begin = false; break; } _motion.Motion = motion.Motion3D; } }
private void LoadRoot() { GameObject temp = GameObject.Find("UIRoot"); if (temp != null) { GameObject.Destroy(temp); } string rootpath = "UI/UIRoot"; GameObject go = XResources.Load <GameObject>(rootpath, AssetType.Prefab); GameObject.DontDestroyOnLoad(go); _uiCamera = go.GetComponent <Camera>(); _canvas = go.transform.GetChild(0).GetComponent <Canvas>(); _fade = _canvas.transform.GetChild(0).GetComponent <Image>(); _fade.color = new Color(1, 1, 1, 0); _loadimg = _canvas.transform.GetChild(1).GetComponent <Image>(); _loadtxt = _loadimg.transform.GetChild(0).GetComponent <Text>(); XLoading.Show(true); XTableMgr.tableLoaded += XLoading.OnLoadFinish; go = new GameObject("EventSystem"); go.AddComponent <EventSystem>(); go.AddComponent <StandaloneInputModule>(); GameObject.DontDestroyOnLoad(go); }
public XActor(float x, float y, float z, string clip) { string path = @"Prefabs/Player"; _go = XResources.Load<GameObject>(path, AssetType.Prefab); _go.transform.position = new Vector3(x, y, z); _ator = _go.GetComponent<Animator>(); if (_ator != null) MakeActor(clip); }
public XActor(string prefab, float x, float y, float z, string clip) { _go = XResources.Load<GameObject>(prefab, AssetType.Prefab); _go.transform.position = new Vector3(x, y, z); _go.transform.rotation = Quaternion.identity; _ator = _go.GetComponent<Animator>(); if (_ator != null) MakeActor(clip); }
public static void SetImage(string name) { if (loadimg != null) { Sprite spr = XResources.Load <Sprite>(name, AssetType.PNG); loadimg.sprite = spr; } }
public void LoadDlg(IUIDlg dlg) { if (!Exist(dlg)) { if (m_recycle == null) { m_recycle = new Dictionary <uint, IUIDlg>(); } if (m_recycle.ContainsKey(dlg.id)) { m_recycle.Remove(dlg.id); dlg.innerBehaviour.gameObject.SetActive(true); } else { GameObject go = XResources.Load <GameObject>(dlg.fileName, AssetType.Prefab); go.transform.SetParent(dlg.shareCanvas ? _canvas.transform : _uiCamera.transform); if (!dlg.shareCanvas) { Canvas cans = go.GetComponent <Canvas>(); if (cans != null) { cans.worldCamera = _uiCamera; } } go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; dlg.SetBehaviour(go); dlg.OnLoad(); } if (dlg.pushStack) { m_stack.Push(dlg); _sort = dlg.innerBehaviour.SortDepth(_sort) + _gap; dlg.OnShow(); } else { m_list.Add(dlg); } } if (!dlg.pushStack) //不在栈中的ui 每次调用的时候都展示在最前 不管之前是否cache { if (dlg.type == DlgType.Top) { dlg.innerBehaviour.SortDepth(_top); } else if (dlg.type == DlgType.Surface) { _sort = dlg.innerBehaviour.SortDepth(_sort) + _gap; } dlg.OnShow(); } }
public void OverrideAnim(string key, string clippath) { if (string.IsNullOrEmpty(clippath) || m_Animator == null || m_overrideController == null) { return; } AnimationClip clip = XResources.Load <AnimationClip>("Animation/" + clippath, AssetType.Anim); OverrideAnim(key, clip); }
public XBullet(XBulletData data) { _data = data; _elapsed = 0.0f; _hits = data.Hits; _bullet = XResources.Load <GameObject>(data.Prefab, AssetType.Prefab); _bullet.transform.position = _data.BulletRay.origin; _bullet.transform.rotation = _data.Velocity > 0 ? Quaternion.LookRotation(_data.BulletRay.direction) : Quaternion.LookRotation(_data.Firer.Transform.forward); _data.Firer.ShownTransform = _bullet.transform; }
private void MakeActor(string clip) { DisablePhysic(); AnimatorOverrideController overrideController = new AnimatorOverrideController(); overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController; _ator.runtimeAnimatorController = overrideController; overrideController["Idle"] = XResources.Load<AnimationClip>(clip, AssetType.Anim); _shadow = _go.transform.Find("Shadow"); if (_shadow != null) _shadow.GetComponent<Renderer>().enabled = true; _ator.cullingMode = AnimatorCullingMode.AlwaysAnimate; }
public GameObject GetDummy(uint statictid) { XEntityStatistics.RowData row = XTableMgr.GetTable<XEntityStatistics>().GetByID((int)statictid); if (row != null) { XEntityPresentation.RowData raw_data = XTableMgr.GetTable<XEntityPresentation>().GetItemID(row.PresentID); if (raw_data == null) return null; string prefab = raw_data.Prefab; return XResources.Load<GameObject>("Prefabs/" + prefab, AssetType.Prefab); } return null; }
public void OnDied() { _state = XStateDefine.XState_Death; DetachAllComponents(); XAnimComponent an = GetComponent <XAnimComponent>(); if (an != null) { AnimationClip clip = XResources.Load <AnimationClip>(present.Death, AssetType.Anim); an.OverrideAnim(AnimTriger.ToDeath, clip); } }
public void Effect(string motion, string trigger) { AnimationClip clip = XResources.Load <AnimationClip>(motion, AssetType.Anim); if (clip != null) { _trigger = trigger; if (_overrideController["CameraEffect"] != clip) { _overrideController["CameraEffect"] = clip; } } }
private void RebuildSkillAniamtion() { AnimationClip clip = XResources.Load <AnimationClip>(_current.ClipName, AssetType.Anim); if (_current.TypeToken == 0) { string motion = XSkillData.JaOverrideMap[_current.SkillPosition]; _anim.OverrideAnim(motion, clip); } else if (_current.TypeToken == 1) { _anim.OverrideAnim(Clip.Art, clip); } _anim.Rebind(); }
void OnGUI() { GUILayout.Space(10); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Space(10); if (GUILayout.Button("AsynLoad1", option)) { XResources.LoadAsync <GameObject>(path1, AssetType.Prefab, OnLoad1Complete); } if (GUILayout.Button("Unload1", option)) { XResources.Destroy(go1); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Space(10); if (GUILayout.Button("ImmLoad2", option)) { go2 = XResources.Load <GameObject>(path2, AssetType.Prefab); go2.name = "Load2"; } if (GUILayout.Button("Unload2", option)) { XResources.Destroy(go2); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Space(10); if (GUILayout.Button("ImmLoad12", option)) { go12 = XResources.Load <GameObject>(path12, AssetType.Prefab); go12.name = "Load12"; } if (GUILayout.Button("Unload12", option)) { XResources.Destroy(go12); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public override void Load(ref FashionPositionInfo newFpi, HashSet <string> loadedPath) { bool same = IsSamePart(ref newFpi); if (!same) { if (MakePath(ref newFpi, loadedPath)) { mesh = XResources.Load <Mesh>(location, AssetType.Asset); tex = XResources.Load <Texture>(location, AssetType.TGA); if (processStatus == EProcessStatus.EProcessing) { processStatus = EProcessStatus.EPreProcess; } } } }
public bool Initialize() { _cameraObject = GameObject.Find(@"Main Camera"); if (_cameraObject != null) { _camera = _cameraObject.GetComponent <Camera>(); _cameraTransform = _cameraObject.transform; GameObject.DestroyImmediate(_dummyObject); _dummyObject = XResources.Load <GameObject>("Prefabs/DummyCamera", AssetType.Prefab); _dummyObject.name = "Dummy Camera"; _dummyCamera = _dummyObject.transform.GetChild(0); _ator = _dummyObject.GetComponent <Animator>(); _overrideController.runtimeAnimatorController = _ator.runtimeAnimatorController; _ator.runtimeAnimatorController = _overrideController; _root_pos_inited = false; } return(true); }
IEnumerator Start() { yield return(new WaitForSeconds(0.4f)); var present = XTableMgr.GetTable <XEntityPresentation>().GetItemID((uint)PresentID); var contr = new AnimatorOverrideController(); var ator = GetComponent <Animator>(); contr.runtimeAnimatorController = ator.runtimeAnimatorController; ator.runtimeAnimatorController = contr; AnimationClip clip = XResources.Load <AnimationClip>("Animation/" + present.AnimLocation + present.AttackIdle, AssetType.Anim); contr[Clip.Idle] = clip; contr[Clip.HitLanding] = present.HitFly != null && present.HitFly.Length == 0 ? null : XResources.Load <AnimationClip>("Animation/" + present.AnimLocation + present.HitFly[1], AssetType.Anim); _attr = new XHitAttribute(transform, contr, ator, present); }
private static Material GetMaterial(Shader shader) { if (shader == ShaderMgr.skin_cutout) { return(XResources.Load <Material>("Materials/Char/RimLightBlendCutout", AssetType.Mat));//mat } else if (shader == ShaderMgr.skin_nocutout) { return(XResources.Load <Material>("Materials/Char/RimLightBlendNoCutout", AssetType.Mat)); } else if (shader == ShaderMgr.skin_blend) { return(XResources.Load <Material>("Materials/Char/RimLightBlend", AssetType.Mat)); } else if (shader == ShaderMgr.skin8) { return(XResources.Load <Material>("Materials/Char/RimLightBlend8", AssetType.Mat)); } return(new Material(shader)); }
public void CreateXFx(string location, bool async) { _instanceID = GetGlobalFxID(); if (string.IsNullOrEmpty(location) || location.EndsWith("empty")) { OnLoadFinish(null); } else { if (async) { XResources.LoadAsync <GameObject>(location, AssetType.Prefab, OnLoadFinish); } else { GameObject go = XResources.Load <GameObject>(location, AssetType.Prefab); OnLoadFinish(go); } } }
public void RebuildSkillAniamtion() { AnimationClip clip = XResources.Load <AnimationClip>(SkillData.ClipName, AssetType.Anim); if (oVerrideController == null) { BuildOverride(); } if (SkillData.TypeToken == 0) { string motion = XSkillData.JaOverrideMap[SkillData.SkillPosition]; oVerrideController[motion] = clip; } else if (SkillData.TypeToken == 1) { oVerrideController[Clip.Art] = clip; } _present_data = XTableMgr.GetTable <XEntityPresentation>().GetItemID((uint)_xConfigData.Player); oVerrideController[Clip.Idle] = Resources.Load("Animation/" + _present_data.AnimLocation + _present_data.AttackIdle) as AnimationClip; oVerrideController[Clip.Run] = Resources.Load("Animation/" + _present_data.AnimLocation + _present_data.AttackRun) as AnimationClip; oVerrideController[Clip.Walk] = Resources.Load("Animation/" + _present_data.AnimLocation + _present_data.AttackWalk) as AnimationClip; }
public override void Load(ref FashionPositionInfo newFpi, HashSet <string> loadedPath) { if (!IsSamePart(ref newFpi)) { if (MakePath(ref newFpi, loadedPath)) { if (goInstance != null) { GameObject.Destroy(goInstance); } goInstance = XResources.Load <GameObject>(location, AssetType.Prefab); LoadFinish(this); ProcessTransfer(); } else { if (string.IsNullOrEmpty(location)) { processStatus = EProcessStatus.EProcessing; LoadFinish(this); } } } }
public void BuildAnimation(XHitData data) { string[] anims = null; switch (data.State) { case XBeHitState.Hit_Back: if (change_to_fly) { anims = present.HitFly != null && present.HitFly.Length > 0 ? present.HitFly : present.Hit_f; } else { switch (data.State_Animation) { case XBeHitState_Animation.Hit_Back_Front: anims = present.Hit_f; break; case XBeHitState_Animation.Hit_Back_Left: anims = present.Hit_l; break; case XBeHitState_Animation.Hit_Back_Right: anims = present.Hit_r; break; } } break; case XBeHitState.Hit_Roll: anims = change_to_fly ? present.HitFly != null && present.HitFly.Length > 0 ? present.HitFly : present.Hit_f : present.HitFly != null && present.HitFly.Length > 0 ? present.Hit_Roll : present.Hit_f; break; case XBeHitState.Hit_Fly: anims = present.HitFly != null && present.HitFly.Length > 0 ? present.HitFly : present.Hit_f; break; case XBeHitState.Hit_Freezed: if (data.FreezePresent) { string freeze = "Animation/" + present.AnimLocation + present.Freeze; AnimationClip freeze_clip = XResources.Load <AnimationClip>(freeze, AssetType.Anim); present_anim_time = freeze_clip.length; controllder[Clip.Freezed] = freeze_clip; } return; } if (anims == null) { return; } int idx = 0; string clipname = "Animation/" + present.AnimLocation + anims[idx++]; AnimationClip clip = XResources.Load <AnimationClip>(clipname, AssetType.Anim); present_anim_time = clip.length; controllder[Clip.PresentStraight] = clip; if ((change_to_fly || data.State == XBeHitState.Hit_Fly) && present.HitFly != null && present.HitFly.Length > 0) { clipname = "Animation/" + present.AnimLocation + anims[idx++]; clip = XResources.Load <AnimationClip>(clipname, AssetType.Anim); landing_time = clip.length; } else { landing_time = 0; } clipname = "Animation/" + present.AnimLocation + anims[idx++]; clip = XResources.Load <AnimationClip>(clipname, AssetType.Anim); controllder[Clip.HardStraight] = clip; loop_hard = (clip.wrapMode == WrapMode.Loop); hard_straight_time = clip.length; clipname = "Animation/" + present.AnimLocation + anims[idx++]; clip = XResources.Load <AnimationClip>(clipname, AssetType.Anim); getup_time = clip.length; controllder[Clip.GetUp] = clip; }
public static AIRuntimeTreeData Load(string name) { TextAsset ta = XResources.Load <TextAsset>("Table/AITree/" + name, AssetType.Text); return(Parse(ta.text, name)); }