Exemplo n.º 1
0
        public void Start(GUnit unit, IBuffData buffData, bool removeWhenFinish)
        {
            var processData = unit.GetData <ObjectBuffProcessData>();

            if (!IsAddedBuff(processData, buffData))
            {
                processData.currentBuffDataList.Add(buffData);
                OnStart(unit, buffData as T, removeWhenFinish);
            }
            else
            {
                OnUpdate(unit, buffData as T);
            }
        }
Exemplo n.º 2
0
        bool IsAddedBuff(ObjectBuffProcessData processData, IBuffData buffData)
        {
            if (processData.currentBuffDataList.IndexOf(buffData) != -1)
            {
                return(true);
            }

            foreach (var addedBuffData in processData.currentBuffDataList)
            {
                if (addedBuffData.GetType() == buffData.GetType())
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        public void Finish(GUnit unit, IBuffData buffData, bool removeFromBuffDataList = true)
        {
            var finishResult = OnFinish(unit, buffData as T);

            if (finishResult && removeFromBuffDataList)
            {
                var processData = unit.GetData <ObjectBuffProcessData>();
                for (var i = 0; i < processData.currentBuffDataList.Count; i++)
                {
                    var addedBuffData = processData.currentBuffDataList[i];
                    if (addedBuffData.GetType() == buffData.GetType())
                    {
                        processData.currentBuffDataList.Remove(addedBuffData);
                        break;
                    }
                }
            }
        }
Exemplo n.º 4
0
 static BuffData()
 {
     SceneServer.Instance.UpdateManager.InitStaticImpl(typeof(BuffData), typeof(BuffDataDefaultImpl),
                                                       o => { mImpl = (IBuffData)o; });
 }
Exemplo n.º 5
0
 public void Stop(GUnit unit, IBuffData buffData)
 {
     OnStop(unit, buffData as T);
 }
Exemplo n.º 6
0
        public static void RemoveBuff(GUnit unit, IBuffData buffData, bool removeFromBuffDataList = true)
        {
            var buffModule = ObjectBuffModuleDict.Get(buffData.GetType().GetHashCode());

            buffModule.Finish(unit, buffData, removeFromBuffDataList);
        }
Exemplo n.º 7
0
        public static void AddBuff(GUnit unit, IBuffData buffData, bool removeWhenFinish = true)
        {
            var buffModule = ObjectBuffModuleDict.Get(buffData.GetType().GetHashCode());

            buffModule.Start(unit, buffData, removeWhenFinish);
        }