public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.DamageNearBy; audio = BackgroundSound.Instance.PlayEffectLoop("skill/loopfirelarge1"); audio.Play(); localId = obj.GetComponent <NpcAttribute>().GetLocalId(); obj.GetComponent <NpcAttribute>().StartCoroutine(DamageNear()); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.WeaponBuff; BackgroundSound.Instance.PlayEffect("emberlightningblast1"); localId = obj.GetComponent <NpcAttribute>().GetLocalId(); MyEventSystem.myEventSystem.RegisterLocalEvent(localId, MyEvent.EventType.HitTarget, OnEvent); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.FanTan; audio = BackgroundSound.Instance.PlayEffectLoop("skill/loopfirelarge1"); audio.Play(); localId = obj.GetComponent <NpcAttribute>().GetLocalId(); MyEventSystem.myEventSystem.RegisterLocalEvent(localId, MyEvent.EventType.OnHit, OnEvent); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.Relive; BackgroundSound.Instance.PlayEffect("healdrink"); var npcAttr = obj.GetComponent <NpcAttribute>(); npcAttr.ChangeHP(10); }
void MakeMonster() { Affix af = null; if (runner.Event.affix.target == Affix.TargetType.Pet) { af = runner.Event.affix; } Vector3 pos = gameObject.transform.position; if (runner.triggerEvent != null && runner.triggerEvent.type == MyEvent.EventType.EventMissileDie) { pos = runner.triggerEvent.missile.transform.position; } ObjectManager.objectManager.CreatePet(MonsterId, runner.stateMachine.attacker, af, pos); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.Ghost; renders = obj.GetComponentsInChildren <SkinnedMeshRenderer>(); materials = new List <Material>(); //Copy foreach (var r in renders) { materials.Add(r.sharedMaterial); Log.Sys("CopySharedMaterial " + r.sharedMaterial); } //Instance foreach (var r in renders) { r.material.shader = Shader.Find("Custom/GhostShader"); } obj.layer = (int)GameLayer.IgnoreCollision; }
/// <summary> /// 初始化Buff /// </summary> /// <param name="af">Af.</param> /// <param name="o">O.</param> public virtual void Init(Affix af, GameObject o) { affix = af; obj = o; attri = obj.GetComponent <NpcAttribute>(); if (affix.UnitTheme != null) { var par = GameObject.Instantiate(affix.UnitTheme) as GameObject; //par.transform.parent = obj.transform; var sync = par.AddComponent <SyncPosWithTarget>(); sync.target = obj; par.transform.localPosition = affix.ThemePos; par.transform.localRotation = Quaternion.identity; par.transform.localScale = Vector3.one; unitTheme = par; } }
/// <summary> ///相同的技能 Skill Configure来触发Buff 但是不要触发 Buff修改非表现属性 /// </summary> /// <param name="affix">Affix.</param> /// <param name="attacker">Attacker.</param> /// <param name="target">Target.</param> public static void FastAddBuff(Affix affix, GameObject attacker, GameObject target, int skillId, int evtId) { var cg = CGPlayerCmd.CreateBuilder(); var binfo = BuffInfo.CreateBuilder(); binfo.BuffType = (int)affix.effectType; binfo.Attacker = attacker.GetComponent <KBEngine.KBNetworkView>().GetServerID(); binfo.Target = target.GetComponent <KBEngine.KBNetworkView>().GetServerID(); binfo.SkillId = skillId; binfo.EventId = evtId; var pos = attacker.transform.position; binfo.AddAttackerPos((int)(pos.x * 100)); binfo.AddAttackerPos((int)(pos.y * 100)); binfo.AddAttackerPos((int)(pos.z * 100)); //Log.Net(binfo.AttackerPosCount); cg.BuffInfo = binfo.Build(); cg.Cmd = "Buff"; var sc = WorldManager.worldManager.GetActive(); sc.BroadcastMsg(cg); }
public void AddBuff(Affix affix, Vector3 attackerPos = default(Vector3)) { if (affix != null) { Log.Sys("AddBuff is " + gameObject.name + " " + affix.effectType); //只保留最旧的Buff if (affix.keepOld) { for (int i = 0; i < effectList.Count; i++) { if (effectList[i].affix.effectType == affix.effectType) { return; } } } var eft = BuffManager.buffManager.GetBuffInstance(affix.effectType); var buff = (IEffect)Activator.CreateInstance(eft); buff.Init(affix, gameObject); buff.attackerPos = attackerPos; if (affix.IsOnlyOne) { for (int i = 0; i < effectList.Count; i++) { if (effectList[i].affix.effectType == affix.effectType) { effectList[i].IsDie = true; } } } effectList.Add(buff); buff.OnActive(); } }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.OneTimeCriticalHit; }
public override void Init(Affix af, GameObject o) { base.Init(af, o); obj.layer = (int)GameLayer.IgnoreCollision2; }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.SummonDuration; }
public void CreatePet(int monsterId, GameObject owner, Affix affix, Vector3 pos) { Log.Sys("Create Pet " + monsterId + " " + owner + " " + pos); if (owner == null) { Debug.LogError("Own NotExist Pet Not Born"); return; } var unitData = Util.GetUnitData(false, monsterId, 1); var Resource = Resources.Load <GameObject> (unitData.ModelName); GameObject g = Instantiate(Resource) as GameObject; NpcAttribute npc = NGUITools.AddMissingComponent <NpcAttribute> (g); var type = Type.GetType("ChuMeng." + unitData.AITemplate); var t = typeof(NGUITools); var m = t.GetMethod("AddMissingComponent"); Log.AI("Create Certain AI " + unitData.AITemplate + " " + type); var geMethod = m.MakeGenericMethod(type); //var petAI = geMethod.Invoke(null, new object[] { g });// as AIBase; //var petAI = //NGUITools.AddMissingComponent<type> (g); g.transform.parent = transform; g.tag = owner.tag; g.layer = (int)GameLayer.Npc; npc.SetOwnerId(owner.GetComponent <KBEngine.KBNetworkView> ().GetLocalId()); npc.spawnTrigger = owner.GetComponent <NpcAttribute>().spawnTrigger; //不可移动Buff //持续时间Buff //无敌不可被攻击Buff //火焰陷阱的特点 特点组合 g.GetComponent <BuffComponent> ().AddBuff(affix); var netView = NGUITools.AddMissingComponent <KBEngine.KBNetworkView> (g); netView.SetID(new KBEngine.KBViewID(myPlayer.ID, myPlayer)); netView.IsPlayer = false; //owner.GetComponent<NpcAttribute>().AddSummon(netView.gameObject); npc.SetObjUnitData(unitData); AddObject(netView.GetServerID(), netView); npc.transform.position = pos; if (unitData.IsElite) { npc.transform.localScale = new Vector3(2, 2, 2); } if (npc.tag == GameTag.Enemy) { BattleManager.battleManager.AddEnemy(npc.gameObject); npc.SetDeadDelegate = BattleManager.battleManager.EnemyDead; } }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.KnockBack; }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.AddHPMP; BackgroundSound.Instance.PlayEffect("healdrink"); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.ReduceHP; BackgroundSound.Instance.PlayEffect("skill/fireattack3"); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.GoldSteal; BackgroundSound.Instance.PlayEffect("dropgold"); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.Fushi; BackgroundSound.Instance.PlayEffect("evilmagic"); }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.Blind; }
public override void Init(Affix af, GameObject o) { base.Init(af, o); type = Affix.EffectType.ShiXue; BackgroundSound.Instance.PlayEffect("skills/shockhit"); }