/// <summary> /// 激活行为. /// </summary> public override void Active() { //FxAsset assert = new FxAsset(); //assert.init(URLUtil.GetResourceLibPath() + buffInfor.BuffPath); base.Active(); KParams kParams = KConfigFileManager.GetInstance().GetParams(); outColor = KingSoftCommonFunction.StringToColor(kParams.MonsterOutColor); totalTime = kParams.MonsterOutTime; MonsterOutHeight = kParams.MonsterOutHeight; if (kParams.MonsterOutFx.Length > 0) { assert.init(URLUtil.GetResourceLibPath() + kParams.MonsterOutFx); GameObject fx = assert.CloneObj(); if (null != fx) { fx.transform.position = hero.Position; fx.transform.localScale = hero.transform.localScale * kParams.MonsterOutFxScale; DestoryObject d = fx.AddComponent <DestoryObject>(); d.delta = 1f; } } hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, "idle1", AMIN_MODEL.ONCE, false); isFinish = false; hero.DispatchEvent(ControllerCommand.CLEAR_BUFF); beginTime = Time.realtimeSinceStartup; }
void SwitchWeapon(uint id) { if (id == 0) { id = Owner.heroSetting.DefaultWeapon; } if (equipInfor != null && equipInfor.ID == id) { return; } equipInfor = ItemLocator.GetInstance().GetEquip((int)id); if (equipInfor == null) { Debug.LogError("武器 " + id + "不存在"); return; } if (equipInfor.FBX.Length == 0) { Debug.LogError("武器 " + id + "没填写FBX数据"); return; } GameObject.Destroy(Owner.property.weapon[0]); GameObject.Destroy(Owner.property.weapon[1]); Owner.property.weapon[0] = null; Owner.property.weapon[1] = null; assetInfo = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + equipInfor.FBX); if (equipInfor.Fx.Length > 0) { fxInfo = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + equipInfor.Fx); } }
public UIAtlas GetUIAtlas(string resourceName) { UIAtlas atlas = null; mDictionary.TryGetValue(URLUtil.GetResourceLibPath() + "Atlas/" + resourceName + ".res", out atlas); return(atlas); }
private bool LoadEffects(string effects, int nLoadLevel) { if (effects == null) { return(true); } if (effects.Equals("")) { return(true); } string[] effectSplits = effects.Split(new char[] { '|' }); foreach (string effectSplit in effectSplits) { if (nLoadLevel == AssetLoaderLevel.IMMEDIATELY) { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + effectSplit); } else if (nLoadLevel == AssetLoaderLevel.WAIT_A_MOMENT) { AssetLoader.GetInstance().PreLoad(URLUtil.GetResourceLibPath() + effectSplit); } else if (nLoadLevel == AssetLoaderLevel.ONLY_DOWNLOAD) { AssetLoader.GetInstance().PreLoadOnlyDownload(URLUtil.GetResourceLibPath() + effectSplit); } } return(true); }
private object LoadResource(params object[] objs) { KHeroSetting heroSetting = KConfigFileManager.GetInstance().heroSetting.getData(Owner.TabID.ToString()); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Hero/h_" + heroSetting.RepresentID.ToString() + ".hero", LoadResource_OnLoadComplete, AssetType.BUNDLER); return(null); }
public void PlaySound3d(string res_path, Vector3 pos) { AudioClip clip = null; if (audios.TryGetValue(res_path, out clip)) { if (clip != null) { GameObject g = new GameObject("audio_" + res_path); //g.transform.position = pos; g.transform.position = Camera.main.transform.position; AudioSource _as = g.AddComponent <AudioSource>(); _as.volume = volume; _as.clip = clip; _as.Play(); DestoryObject dot = g.AddComponent <DestoryObject>(); dot.delta = 5f; } } else { AssetInfo infor = AssetLoader.GetInstance().Load( URLUtil.GetResourceLibPath() + "Audio/" + res_path, LoadAudioClipComplete, AssetType.BUNDLER, false, AssetLoaderLevel.IMMEDIATELY ); urls[infor] = res_path; } }
// Use this for initialization void Start() { if (hitFx.Length > 0) { AssetLoader.GetInstance().PreLoad(URLUtil.GetResourceLibPath() + hitFx); } RefreadEndPosition(); }
public void Load() { loadCount = resources.Count; while (resources.Count > 0) { string resource = resources.Dequeue(); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Atlas/" + resource + ".res", Atlas_OnLoadComplete, AssetType.BUNDLER); } }
private void LoadResource() { if (Owner.property.dropType == KDropType.dtMoney) { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Scene/Collect/baoxiang.obj", LoadResource_OnLoadComplete, AssetType.BUNDLER); } else { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Scene/Collect/jingbi.obj", LoadResource_OnLoadComplete, AssetType.BUNDLER); } }
public static void InitBuff(ushort wBuffID) { if (globalBuffsTemps.ContainsKey(wBuffID)) { return; } KBuff buffInfor = KConfigFileManager.GetInstance().buffs.getData(wBuffID.ToString()); FxAsset assert = new FxAsset(); assert.init(URLUtil.GetResourceLibPath() + buffInfor.BuffPath); BuffInfor infor = new BuffInfor(); infor.infor = buffInfor; infor.assert = assert; infor.bindPoints = buffInfor.BindPoint.Split(';'); globalBuffsTemps[wBuffID] = infor; }
void OnHit() { if (displayInfor.CameraEffect.CompareTo("SHAKE_HIT") == 0) { Shake(); } if (displayInfor.BulletEffect.Length > 0 && target != null) { hero.property.AutoAttack = false; GameObject bulletObj = null; AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + displayInfor.BulletEffect); if (inf.isDone(false)) { bulletObj = inf.CloneGameObject(); } else { bulletObj = new GameObject(); } bulletObj.transform.position = hero.transform.position; bulletObj.SetActive(true); KingSoftCommonFunction.SetLayer(bulletObj, 11); Bullet bullet = bulletObj.AddComponent <Bullet>(); bullet.msg_case = msg_case; msg_case = null; bullet.displayInfor = displayInfor; bullet.hero = hero; bullet.target = target; bullet.speed = (activeSkill.SkillFlySpeed / 100); bullet.hitFx = displayInfor.HitEffect; } else { if (displayInfor.SoundType == KSkillDisplay.ACTION_AUIDO_TYPE.Hit) { if (displayInfor.Sound.Length > 0) { AudioManager.instance.PlaySound3d(displayInfor.Sound, hero.Position); } } PopMsg(); } }
public void PlayEndFx(float second) { if (displayInfor.EndEffect.Length > 0) { AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + displayInfor.EndEffect); if (inf.isDone(false)) { EndFxObj = inf.CloneGameObject(); EndFxObj.transform.parent = hero.transform; EndFxObj.transform.localPosition = Vector3.zero; ObjectUtil.SetTagWithAllChildren(EndFxObj, CameraLayerManager.GetInstance().GetMissionSignName()); if (displayInfor.EndEffectBindPoint.Length == 0 || displayInfor.BeginEffectBindPoint.CompareTo("Ground") == 0) { EndFxObj.transform.localRotation = Quaternion.identity; EndFxObj.transform.localScale = Vector3.one; } else { Transform t = hero.GetChildTransform(displayInfor.BeginEffectBindPoint); if (null != t) { EndFxObj.transform.parent = t; EndFxObj.transform.localPosition = Vector3.zero; EndFxObj.transform.localRotation = Quaternion.identity; EndFxObj.transform.localScale = Vector3.one; EndFxObj.transform.parent = hero.transform; } } if (!displayInfor.EndEffectBind) { EndFxObj.transform.parent = hero.transform.parent; } ParticleSystemScaleManager.ScaleParticle(EndFxObj); KingSoftCommonFunction.SetLayer(EndFxObj, 11); EndFxObj.SetActive(true); DestoryObject dos = EndFxObj.AddComponent <DestoryObject>(); dos.delta = second; } } if (hitTicker.isPlaying()) { OnHit(); } }
public static void Load() { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/AttackFont.font", LoadFontCompleteHandler, AssetType.SCENE); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/CritFont.font", LoadFontCompleteHandler, AssetType.SCENE); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/MpFont.font", LoadFontCompleteHandler, AssetType.SCENE); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/ExpFont.font", LoadFontCompleteHandler, AssetType.SCENE); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/HurtFont.font", LoadFontCompleteHandler, AssetType.SCENE); AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/FightFont.font", LoadFontCompleteHandler, AssetType.SCENE); AddResource("effect_ui_shuzitanchu_putong.res"); AddResource("effect_ui_shuzitanchu_baoji2.res"); animPath = URLUtil.GetResourceLibPath() + "Effect/"; loadCount = resources.Count; while (resources.Count > 0) { string resource = resources.Dequeue(); AssetLoader.GetInstance().Load(animPath + resource, OnAnimLoadComplete, AssetType.BUNDLER); } }
//播放战斗效果 public void PlayFightEffect(ushort wSkillID, int damage, byte byAttackEvent, SceneEntity killerHero) { if (byAttackEvent == (byte)KAttackEvent.aeMiss) { if (Owner.property.isMainHero) { Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "2", "FightFont", "effect_ui_shuzitanchu_putong.res"); } else { Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "1", "FightFont", "effect_ui_shuzitanchu_putong.res"); } return; } else if (byAttackEvent == (byte)KAttackEvent.aeCrit) { Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "CritFont", "effect_ui_shuzitanchu_baoji2.res"); } else if (Owner.property.isMainHero) { Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "HurtFont", "effect_ui_shuzitanchu_putong.res", NumTip.OFFSET_TYPE.LEFT); } else { Owner.TipsCmp.CreateTip(new Vector3(0, Owner.heroSetting.TipPos0, 0), "+" + damage, "AttackFont", "effect_ui_shuzitanchu_putong.res"); } KSkillDisplay skillDisplay = KConfigFileManager.GetInstance().GetSkillDisplay(wSkillID, Owner.TabID); if (skillDisplay.OnHitAction.CompareTo("JUMP") == 0) { ActionBeAttactedAndThrowUp action = new ActionBeAttactedAndThrowUp(Owner); action.hitAnim = skillDisplay.OnHitAnim; action.time = skillDisplay.OnHitEffecTime; action.height = skillDisplay.OnHitHeight; Owner.ActiveAction = action; //action } else if (Owner.property.heroObjType == KHeroObjectType.hotMonster && Owner.heroSetting.MonsterGrade == KMonsterGrade.mgQuestBoss) { if (Owner.property.activeAction.TryFinish()) { ActiionBeAttack beAttack = new ActiionBeAttack(Owner); Owner.DispatchEvent(ControllerCommand.SetActiveAction, beAttack); } } else { Owner.DispatchEvent(ControllerCommand.BE_HIT); } Vector3 forward = Vector3.forward; if (null != killerHero) { forward = killerHero.transform.position - Owner.transform.position; forward = new Vector3(forward.x, 0, forward.z); forward.Normalize(); } if (skillDisplay.HitShakeTime > 0 && skillDisplay.HitShakeDelta > 0) { Owner.DispatchEvent(ControllerCommand.HIT_SLOW, skillDisplay.HitShakeTime, skillDisplay.HitShakeDelta); } if (null != skillDisplay && skillDisplay.HitEffect.Length > 0 /*&& skillDisplay.BulletEffect.Length == 0*/) { AssetInfo inf = AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + skillDisplay.HitEffect); if (inf.isDone(false)) { if (skillDisplay.SingleHitFx) { GameObject _hit = null; if (hitFxs.TryGetValue(skillDisplay.HitEffect, out _hit)) { GameObject.Destroy(_hit); } } GameObject hitObject = inf.CloneGameObject(); ObjectUtil.SetTagWithAllChildren(hitObject, CameraLayerManager.GetInstance().GetMissionSignName()); hitObject.transform.parent = Owner.transform.parent; hitObject.transform.position = Owner.transform.position; hitObject.transform.forward = forward; if (skillDisplay.SingleHitFx) { hitFxs[skillDisplay.HitEffect] = hitObject; } KingSoftCommonFunction.SetLayer(hitObject, 11); DestoryObject dos = hitObject.AddComponent <DestoryObject>(); dos.delta = 5; if (skillDisplay.HitBindPoint.Length > 0) { if (skillDisplay.HitBindPoint.CompareTo("Ground") != 0) { Transform t = Owner.GetChildTransform(skillDisplay.HitBindPoint); if (null != t) { hitObject.transform.parent = t; hitObject.transform.localPosition = Vector3.zero; hitObject.transform.localScale = Vector3.one; } } } hitObject.SetActive(true); } } }
public void loadMap(uint mapid) { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Scene/" + mapid + "/min.img", LoadImgComplete, AssetType.BUNDLER); infor = MinMapDataManager.instance.GetMinMap(mapid); }
private void LoadResource() { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Scene/Collect/c_" + Owner.collectInfo.nTargetID.ToString() + ".collect", LoadResource_OnLoadComplete, AssetType.BUNDLER); }
void LoadMinMapInfor() { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Scene/MinMap.xml", LoadMinMapComplete, AssetType.BINARY); }
public object OnLoadNameLabel(params object[] objs) { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "UI/HeadPanel.prefab", NameLabelGameObject_LoadComplete, AssetType.BUNDLER); return(null); }
public void Load(string fontName) { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Font/" + fontName + ".res", Font_OnLoadComplete, AssetType.BUNDLER); }
public static void StartLoad() { AssetLoader.GetInstance().Load(URLUtil.GetResourceLibPath() + "Actor/Weapon/WeaponTrailMat.res", ImageLoadImgComplete, AssetType.BUNDLER); }
public virtual void InitParam(AnimActionParam param, KSkillDisplay skillDisplay) { displayInfor = skillDisplay; WeaponPosition = displayInfor.WeaponPosition; skillId = param.skillId; targetId = param.targetId; level = param.level; target = param.target; endPosition = KingSoftCommonFunction.GetGoundHeight(KingSoftCommonFunction.NearPosition(param.position)); activeSkill = KConfigFileManager.GetInstance().GetActiveSkill(skillId, level); FirstAttackTime = 0; animArys = displayInfor.Anim.Split('|'); int [] ids = KingSoftCommonFunction.RandomAry(animArys.Length); beginFxs = displayInfor.BeginEffect.Split('|'); beginFxs = KingSoftCommonFunction.GrowArrays(beginFxs, animArys.Length); if (isRandomAnim) { animArys = KingSoftCommonFunction.RandomAryByList(animArys, ids); beginFxs = KingSoftCommonFunction.RandomAryByList(beginFxs, ids); } if (beginFxs[0].Length > 0) { AssetLoader.GetInstance().PreLoad(URLUtil.GetResourceLibPath() + beginFxs[0]); } if (displayInfor.EndEffect.Length > 0) { AssetLoader.GetInstance().PreLoad(URLUtil.GetResourceLibPath() + displayInfor.EndEffect); } if (displayInfor.BulletEffect.Length > 0) { AssetLoader.GetInstance().PreLoad(URLUtil.GetResourceLibPath() + displayInfor.BulletEffect); } try { string [] AttackTimes = activeSkill.AttackTimeList.Split(';'); if (displayInfor.CameraEffect.CompareTo("SHAKE_ALL") == 0) { foreach (string _t in AttackTimes) { try { shakeTimes.Add((float)System.Convert.ToDouble(_t)); } catch (System.Exception e) { } } if (shakeTimes.Count > 0) { FirstAttackTime = (float)shakeTimes[0]; } } else { if (AttackTimes.Length > 0) { try { FirstAttackTime = (float)System.Convert.ToDouble(AttackTimes[0]); } catch (System.Exception e) { } } } if (activeSkill.ClientCache) { KAminEvent _event = KConfigFileManager.GetInstance().GetAnimEvent(hero.property.tabID, animArys[0]); if (null == _event) { FirstAttackTime = hero.AnimCmp.GetAnimLong(animArys[0]) - 0.3f; } else { FirstAttackTime = _event.time; } } } catch (System.Exception e) { } hitTicker.SetCD(FirstAttackTime); finishTicker.SetCD(FirstAttackTime + displayInfor.hitDelay); }