Exemplo n.º 1
0
 /// <summary>
 /// 新增一条CD数据
 /// </summary>
 /// <param name="id"></param>
 /// <param name="cdInfo"></param>
 public void AddCDData(long id, CDInfo cdInfo)
 {
     if (this.CDInfos.TryGetValue(id, out var cdInfoDic))
     {
         cdInfoDic.Add(cdInfo.Name, cdInfo);
     }
     else
     {
         CDInfos.Add(id, new Dictionary <string, CDInfo>()
         {
             { cdInfo.Name, cdInfo }
         });
     }
 }
        public void Awake()
        {
            //此处填写Awake逻辑
            m_StackFsmComponent          = this.Entity.GetComponent <StackFsmComponent>();
            this.CancellationTokenSource = new CancellationTokenSource();
            this.CancellationTokenSource = null;

            CDInfo attackCDInfo = ReferencePool.Acquire <CDInfo>();

            attackCDInfo.Name     = "CommonAttack";
            attackCDInfo.Interval = 750;

            CDInfo moveCDInfo = ReferencePool.Acquire <CDInfo>();

            moveCDInfo.Name     = "MoveToAttack";
            moveCDInfo.Interval = 300;

            CDComponent.Instance.AddCDData(this.Entity.Id, attackCDInfo);
            CDComponent.Instance.AddCDData(this.Entity.Id, moveCDInfo);
        }