コード例 #1
0
        public override void Execute(AbstractPerson ap)
        {
            //            Debug.Log(ap.obj.GetInstanceID()+": "+ap.IsConst);
            //如果不可选定(硬直),告辞
            //数值
            //            Debug.Log( ap.name + "收到" + this.damage + "伤害");

            //   BloodChange


            if (!ap.IsConst)
            {
                ap.TakeBattleEffect(new DamageNumberEffect(this.damage, 0.3f * ap.Scanler, Color.red, this.dir, 1f, UnityEngine.Random.Range(10, 60)));
            }


            CEventCenter.BroadMessage(Message.M_BloodChange(ap.obj), -this.damage);
            ap.OnTakeDamage(this.damage);
            if (!(ap is Player))
            {
//                Debug.Log(Message.M_ChangeSmallLevel + " " + this.damage);
                CEventCenter.BroadMessage(Message.M_ChangeSmallLevel, this.damage);
            }
            this.Release(ap);
        }
コード例 #2
0
        public static void CauseDamageTo(this AbstractPerson attacker, AbstractPerson receiver)
        {
            Assert.IsTrue(attacker != null && receiver != null);
            if (receiver.IsConst)
            {
                return;
            }


            var damage = GameMath.Damage(attacker, receiver);

            //伤害数字
            new NumberTipUI(damage, 0.3f * receiver.Scanler, 24, Color.red, receiver.obj.transform, receiver.Dir, 1);

            CEventCenter.BroadMessage(Message.M_BloodChange(receiver.obj), -damage);
            receiver.OnTakeDamage(damage);
            if (!(receiver is Player))
            {
                CEventCenter.BroadMessage(Message.M_ChangeSmallLevel, damage);
            }
        }