Пример #1
0
        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);
        }
Пример #2
0
 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);
 }
Пример #3
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.HideBuff;
     attr = obj.GetComponent <NpcAttribute>();
     attr.HideMe();
     obj.GetComponent <MyAnimationEvent>().AddCallBackLocalEvent(MyEvent.EventType.UseSkill, Over);
     obj.GetComponent <MyAnimationEvent>().AddCallBackLocalEvent(MyEvent.EventType.BeHit, Over);
 }
Пример #4
0
 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());
 }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        /// <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;
            }
        }
Пример #8
0
 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;
 }
Пример #9
0
        public static void FastAddBuff(Affix affix, GameObject attacker, GameObject target, int skillId, int evtId, Vector3 pos)
        {
            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));

            cg.BuffInfo = binfo.Build();
            cg.Cmd      = "Buff";
            var sc = WorldManager.worldManager.GetActive();

            sc.BroadcastMsg(cg);
        }
Пример #10
0
        public bool 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(false);
                        }
                    }
                }

                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();
                return(true);
            }
            return(false);
        }
Пример #11
0
        /// <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));

            var pos1 = NetworkUtil.ConvertPos(target.transform.position);

            binfo.X   = pos1[0];
            binfo.Y   = pos1[1];
            binfo.Z   = pos1[2];
            binfo.Dir = (int)target.transform.eulerAngles.y;

            var eft  = BuffManager.buffManager.GetBuffInstance(affix.effectType);
            var buff = (IEffect)Activator.CreateInstance(eft);

            buff.attacker = attacker;
            buff.target   = target;
            var param = buff.GetExtraParams();

            binfo.Params = param;

            cg.BuffInfo = binfo.Build();
            cg.Cmd      = "Buff";
            var sc = WorldManager.worldManager.GetActive();

            sc.BroadcastMsg(cg);
        }
Пример #12
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.ChangeDefaultSkill;
 }
Пример #13
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.Frozen;
 }
Пример #14
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.OneTimeCriticalHit;
 }
Пример #15
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.DamageHP;
 }
Пример #16
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.StaticShootBuff;
 }
Пример #17
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     this.type = Affix.EffectType.WuDi;
 }
Пример #18
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.AddHP;
     BackgroundSound.Instance.PlayEffect("healdrink");
 }
Пример #19
0
 public override void Init (Affix af, GameObject o)
 {
     base.Init (af, o);
     type = Affix.EffectType.ShiXue;
     BackgroundSound.Instance.PlayEffect("skills/shockhit");
 }
Пример #20
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.NuclearBuff;
 }
Пример #21
0
        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("MyLib." + 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(-1, 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;
            }
        }
Пример #22
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.SummonDuration;
 }
Пример #23
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.DefenseAdd;
 }
Пример #24
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.SlowDown2;
 }
Пример #25
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.ReduceHP;
     BackgroundSound.Instance.PlayEffect("skill/fireattack3");
 }
Пример #26
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.GoldSteal;
     BackgroundSound.Instance.PlayEffect("dropgold");
 }
Пример #27
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     obj.layer = (int)GameLayer.IgnoreCollision2;
 }
Пример #28
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.KnockBack;
 }
Пример #29
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.Fushi;
     BackgroundSound.Instance.PlayEffect("evilmagic");
 }