示例#1
0
    protected override void Awake()
    {
        base.Awake();
        obj_entity.m_Id    = 10000000 + obj_entity.m_Id;
        obj_entity.Fight   = 10;
        obj_entity.Defence = 10;
        obj_entity.Name    = "战舰" + attribute.Name;

        skill           = new Skill();
        skill.Attribute = attribute;
        List <Buff>   list = new List <Buff>();
        AttributeBuff b    = new AttributeBuff();

        b.m_BuffName  = "buff001";
        b.m_DelayTime = 5;
        b.m_BuffTime  = 5;
        b.m_Fight     = 500;
        b.m_Value     = 500;
        list.Add(b);
        AttributeBuff b2 = new AttributeBuff();

        b2.m_BuffName = "buff002";
        b.m_DelayTime = 30;
        b2.m_BuffTime = 5;
        b2.m_Fight    = 20;
        b.m_Value     = 100;
        list.Add(b2);
        skill.Attribute.m_BuffList.AddRange(list);
        obj_entity.AddBuff(b);
        obj_entity.AddBuff(b2);
        sm.InitSkillList();
        Debug.Log("1.初始Hp:" + obj_entity.Hp);
        GlobalEventsMgr.GetInstance().RegEvent(obj_Id, EventsType.Skill_DamageEnd, HpValue);
    }
示例#2
0
        public override void Start()
        {
            base.Start();
            //to-do 这里需要根据技能类型创建不同类型的伤害计算,这里简单的已处理加固定血量来模拟计算
            SkillAttack sa = new SkillAttack();

            sa.Target = new List <Entity>();
            sa.Target.Add(m_Skill.Target);
            int result = this.m_Skill.Caculate(sa);

            //int result = this.m_Skill.Caculate(new FixAddHp());
            if (m_Result != null)
            {
                m_Result(result);
            }
            //注意: 伤害计算结束后需要触发伤害计算结束的事件,来终止任务的执行
            //EventsMgr.GetInstance().TriigerEvent(EventsType.Skill_EndDmg, null);

            GlobalEventsMgr.GetInstance().SendEvent(m_Id, EventsType.Skill_DamageEnd, result);
        }