Пример #1
0
 /// <summary>
 /// 添加操作数据
 /// </summary>
 /// <param name="operateType"></param>
 /// <param name="operateData"></param>
 public void AddOperateData(OperateType operateType, OperateData operateData)
 {
     if (AllOperates.TryGetValue(operateType, out var operateDatasStack))
     {
         operateDatasStack.Push(operateData);
     }
     else
     {
         Stack <OperateData> operateDatas = new Stack <OperateData>();
         operateDatas.Push(operateData);
         AllOperates.Add(operateType, operateDatas);
     }
 }
Пример #2
0
        public bool CheckUnitKilledBySpecialMethodAction()
        {
            Unit unit = UnitComponent.Instance.Get(this.TargetUnitId.GetBlackBoardValue <long>(this.BelongtoRuntimeTree.GetBlackboard()));
            //伤害栈顶数据为指定数据且攻击者是自己即返回true,否则返回false
            Stack <OperateData> operateDataStack = unit.GetComponent <OperatesComponent>().GetOperateDatas(OperatesComponent.OperateType.BeDamaged);

            if (operateDataStack != null)
            {
                OperateData stackTopItem = operateDataStack.Peek();
                if (stackTopItem.OperateCaster == UnitComponent.Instance.Get(this.Unitid) &&
                    (stackTopItem as DamageData).CustomData == this.SpecialInfo)
                {
                    return(true);
                }
            }

            return(false);
        }