예제 #1
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());
 }
예제 #2
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);
        }
예제 #3
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);
 }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
파일: Ghost.cs 프로젝트: itcodes/unityRpg
 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;
 }
예제 #7
0
파일: IEffect.cs 프로젝트: itcodes/unityRpg
        /// <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
        /// <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);
        }
예제 #9
0
        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();
            }
        }
예제 #10
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.OneTimeCriticalHit;
 }
예제 #11
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     obj.layer = (int)GameLayer.IgnoreCollision2;
 }
예제 #12
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.SummonDuration;
 }
예제 #13
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("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;
            }
        }
예제 #14
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.KnockBack;
 }
예제 #15
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.AddHPMP;
     BackgroundSound.Instance.PlayEffect("healdrink");
 }
예제 #16
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.ReduceHP;
     BackgroundSound.Instance.PlayEffect("skill/fireattack3");
 }
예제 #17
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.GoldSteal;
     BackgroundSound.Instance.PlayEffect("dropgold");
 }
예제 #18
0
파일: Fushi.cs 프로젝트: itcodes/unityRpg
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.Fushi;
     BackgroundSound.Instance.PlayEffect("evilmagic");
 }
예제 #19
0
파일: Blind.cs 프로젝트: itcodes/unityRpg
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.Blind;
 }
예제 #20
0
 public override void Init(Affix af, GameObject o)
 {
     base.Init(af, o);
     type = Affix.EffectType.ShiXue;
     BackgroundSound.Instance.PlayEffect("skills/shockhit");
 }