Beispiel #1
0
        public virtual void OnCreate(BaseCoreMono self, BaseCoreMono cast, BaseCoreMono target)
        {
            SelfMono   = self;
            CastMono   = cast;
            TargetMono = target;
            Self       = self as BaseUnit;
            Cast       = cast as BaseUnit;
            Target     = target as BaseUnit;
            if (UseFollow)
            {
                SetFollow();
            }
            TouchGround();
            SetLifeTime(LifeTime);
            OnPlaySFX();
            LastedPos = Pos;

            if (DispearType == PerformDispearType.Flicker)
            {
                effectFlicker = BaseCoreMono.GetUnityComponet <EffectFlicker>(this);
                effectFlicker.StopEffect();
            }
            else if (DispearType == PerformDispearType.Scale)
            {
                Trans.localScale = Vector3.one;
            }
            Callback_OnCreated?.Invoke(this);
        }
Beispiel #2
0
        T Spawn <T>(GameObject temp, BaseCoreMono self, BaseCoreMono cast, BaseCoreMono target, Vector3?position, Quaternion?quaternion)
            where T : BasePerform
        {
            if (temp == null)
            {
                return(null);
            }
            if (position.HasValue)
            {
                temp.transform.position = position.Value;
            }
            if (quaternion.HasValue)
            {
                temp.transform.rotation = quaternion.Value;
            }
            T temPerform = BaseCoreMono.GetUnityComponet <T>(temp);

            //特效创建之时先将碰撞合都设为禁用,因为这个时候回掉函数还没注册
            temPerform.SetCollidersActive(false);
            if (position.HasValue || quaternion.HasValue)
            {
                temPerform.UseFollow = false;
            }
            else
            {
                temPerform.UseFollow = true;
            }
            ClearEvent(temPerform);
            temPerform.PerformMgr = this;
            temPerform.OnCreate(self == null? SelfBaseUnit: self, cast == null ? SelfBaseUnit : cast, target);
            //回掉函数注册完以后开启碰撞盒
            temPerform.SetCollidersActive(true);
            Data.Add(temPerform);
            return(temPerform);
        }
Beispiel #3
0
        private T Spawn <T>(BaseCoreMono castMono, Vector3?position, Quaternion?quaternion, GameObject temp, params object[] ps) where T : BasePerform
        {
            if (temp == null)
            {
                return(null);
            }
            if (position.HasValue)
            {
                temp.transform.position = position.Value;
            }
            if (quaternion.HasValue)
            {
                temp.transform.rotation = quaternion.Value;
            }
            T temPerform = BaseCoreMono.GetUnityComponet <T>(temp);

            //特效创建之时先将碰撞合都设为禁用,因为这个时候回掉函数还没注册
            temPerform.SetCollidersActive(false);
            if (position.HasValue || quaternion.HasValue)
            {
                temPerform.UseFollow = false;
            }
            else
            {
                temPerform.UseFollow = true;
            }
            temPerform.OnCreate(Mono, castMono == null? Mono: castMono, ps);
            //回掉函数注册完以后开启碰撞盒
            temPerform.SetCollidersActive(true);
            temPerform.Callback_OnDoDestroy += OnPerformDoDestroy;
            data.Add(temPerform);
            return(temPerform);
        }
Beispiel #4
0
        //检测组件和Mono是否有冲突
        public static bool IsFit(BaseCoreMono main, BaseMgr com)
        {
            if (main.MonoType == MonoType.None ||
                main.MonoType == MonoType.Normal)
            {
                return(false);
            }

            if (com.MgrType == MgrType.All)
            {
                return(true);
            }

            if (main.MonoType == MonoType.Global ||
                main.MonoType == MonoType.View)
            {
                if (com.MgrType == MgrType.Global)
                {
                    return(true);
                }
                return(false);
            }

            if (main.MonoType == MonoType.Unit)
            {
                if (com.MgrType == MgrType.Unit)
                {
                    return(true);
                }
                return(false);
            }

            return(false);
        }
Beispiel #5
0
 bool IsPause(BaseCoreMono mono)
 {
     if (mono.IsEnable == false)
     {
         return(true);
     }
     return((GlobalMonoMgr.PauseType & mono.MonoType) != 0);
 }
Beispiel #6
0
 /// <summary>
 /// obj1:来源对象
 /// obj2:来源技能
 /// </summary>
 /// <param name="mono"></param>
 /// <param name="obj"></param>
 public override void OnBeAdded(BaseCoreMono mono, params object[] obj)
 {
     base.OnBeAdded(mono, obj);
     R_Caster  = GetAddedObjData <BaseUnit>(0);
     R_Skill   = GetAddedObjData <TDBaseSkillData>(1);
     R_Attr    = AttrMgr.Add(Attr);
     R_Convert = AttrMgr.Add(Convert);
     CurTime   = 0;
 }
Beispiel #7
0
 public virtual void Init(BaseCoreMono mono)
 {
     SelfMono       = mono;
     SelfBaseGlobal = BaseGlobal.Ins;
     if (SelfMono is BaseUnit)
     {
         SelfBaseUnit = SelfMono as BaseUnit;
     }
 }
Beispiel #8
0
 public override void OnBeAdded(BaseCoreMono selfMono, params object[] obj)
 {
     base.OnBeAdded(selfMono, obj);
     if (PlotMgr != null && PlotPause)
     {
         PlotMgr.SetPlotPause(true);
     }
     updateTimer = new Timer(UpdateTime);
 }
Beispiel #9
0
        public virtual T Spawn <T>(GameObject prefab, BaseCoreMono castMono, Vector3?position = null, Quaternion?quaternion = null, params object[] ps) where T : BasePerform
        {
            if (prefab == null)
            {
                return(null);
            }
            var temp = SelfBaseGlobal.PoolMgr.Perform.Spawn(prefab, position, quaternion);

            return(Spawn <T>(castMono, position, quaternion, temp, ps));
        }
Beispiel #10
0
 // 组建被添加到mono的时候
 public virtual void OnBeAdded(IMono mono)
 {
     SelfMono = (BaseCoreMono)mono;
     if (mono is BaseUnit)
     {
         SelfBaseUnit = (BaseUnit)mono;
     }
     foreach (var item in subComponets)
     {
         item.OnBeAdded(SelfMono);
     }
 }
Beispiel #11
0
 public override void OnBeAdded(BaseCoreMono selfMono, params object[] obj)
 {
     base.OnBeAdded(selfMono, obj);
     AudioMgr.PlayPlUI(SFX, SelfBaseUnit);
     foreach (var item in Options)
     {
         foreach (var reward in item.Rewards)
         {
             reward.SetTarget(SelfBaseUnit);
         }
     }
 }
Beispiel #12
0
 public override void OnBeAdded(BaseCoreMono mono, params object[] obj)
 {
     base.OnBeAdded(mono, obj);
     InitParam();
     if (Tree == null)
     {
         RebiuldTree();
     }
     else
     {
         CLog.Error("没有移除:Tree");
     }
 }
Beispiel #13
0
        public virtual T Spawn <T>(string performName, BaseCoreMono castMono, Vector3?position = null, Quaternion?quaternion = null, params object[] ps) where T : BasePerform
        {
            if (performName.IsInvStr())
            {
                return(null);
            }
            if (SelfBaseGlobal.PoolMgr.Perform == null)
            {
                return(null);
            }
            GameObject temp = null;

            temp = SelfBaseGlobal.PoolMgr.Perform.Spawn(SelfBaseGlobal.GRMgr.GetPerform(performName), position, quaternion);
            return(Spawn <T>(castMono, position, quaternion, temp, ps));
        }
Beispiel #14
0
        public virtual T Spawn <T>(string performName, BaseCoreMono cast, BaseCoreMono target, Vector3?position = null, Quaternion?quaternion = null)
            where T : BasePerform
        {
            if (performName.IsInv())
            {
                return(null);
            }
            if (BaseGlobal.PoolMgr.Perform == null)
            {
                return(null);
            }
            var temp = BaseGlobal.PoolMgr.Perform.Spawn(BaseGlobal.GRMgr.Perfome.Get(performName), position, quaternion);

            return(Spawn <T>(temp, SelfBaseUnit, cast, target, position, quaternion));
        }
Beispiel #15
0
        public virtual TUnit Spawn(string id, Vector3 spwanPoint, Quaternion?quaternion = null, int team = 0, params object[] ps)
        {
            if (id.IsInvStr())
            {
                return(null);
            }
            GameObject prefab    = GetPrefab(id, ps);
            GameObject charaGO   = Pool().Spawn(prefab, spwanPoint, quaternion);
            TUnit      unitChara = BaseCoreMono.GetUnityComponet <TUnit>(charaGO);

            OnSpawned(id, unitChara);
            unitChara.OnSpawnInit(id, team);
            Data.Add(unitChara);
            Callback_OnSpawn?.Invoke(unitChara);
            return(unitChara);
        }
Beispiel #16
0
 public override void OnBeAdded(BaseCoreMono mono, params object[] obj)
 {
     Phase = SkillPhase.None;
     OnStart_InteraputType =
         SkillInteraputType.Attack |
         SkillInteraputType.Move |
         SkillInteraputType.Passive |
         SkillInteraputType.Skill;
     OnCast_InteraputType    = SkillInteraputType.None;
     OnCastEnd_InteraputType =
         SkillInteraputType.Attack |
         SkillInteraputType.Move |
         SkillInteraputType.Passive |
         SkillInteraputType.Skill;
     CurCDTime = RealMaxCDTime;
     base.OnBeAdded(mono, obj);
 }
        public virtual TUnit Spawn(string tdid, Vector3?spwanPoint = null, Quaternion?quaternion = null, int?team = null, long?rtid = null, string prefab = null)
        {
            if (tdid.IsInv())
            {
                return(null);
            }

            //获得配置数据
            TConfig config = TDLuaMgr?.Get <TConfig>(tdid);

            if (config == null)
            {
                CLog.Error("配置错误,没有这个配置TDID:" + tdid);
                return(null);
            }

            //获得prefab
            GameObject goPrefab;

            if (!prefab.IsInv())
            {
                goPrefab = BundleCacher.Get(prefab);
            }
            else
            {
                goPrefab = config?.GetPrefab();
            }
            if (goPrefab == null)
            {
                if (prefab != null)
                {
                    CLog.Error("没有这个CustomPrefab:{0}", prefab);
                }
                return(null);
            }

            GameObject charaGO = SpawnPool.Spawn(goPrefab, spwanPoint, quaternion);

            charaGO.name = tdid;
            TUnit unitChara = BaseCoreMono.GetUnityComponet <TUnit>(charaGO);

            SpawnAdd(unitChara, tdid, rtid, team);
            Callback_OnSpawn?.Invoke(unitChara);
            return(unitChara);
        }
Beispiel #18
0
        public override void OnBeAdded(BaseCoreMono selfMono, params object[] obj)
        {
            base.OnBeAdded(selfMono, obj);
            SelfArticle   = new List <TDBaseArticleData>();
            TargetArticle = new List <TDBaseArticleData>();
            CurTurn       = 0;
            if (TipStr.IsInv())
            {
                if (!TipKey.IsInv())
                {
                    TipStr = GetStr(TipKey);
                }
                else if (OnGetTip != null)
                {
                    TipStr = OnGetTip?.Invoke(this);
                }
                else
                {
                    TipStr = GetStr(TDID);
                }
            }
            if (DetailStr.IsInv())
            {
                DetailStr = OnGetDetail?.Invoke(this);
            }
            if (TitleStr.IsInv())
            {
                TitleStr = GetStr(TDID);
            }

            //播放音效
            if (SelfBaseUnit == null)
            {
                return;
            }
            if (SelfBaseUnit.IsPlayer())
            {
                if (!SFX.IsInv())
                {
                    AudioMgr.PlaySFX2D(SFX);
                }
            }
        }
Beispiel #19
0
 public static void RemoveMono(BaseCoreMono mono)
 {
     if (mono.NeedUpdate)
     {
         update_removeList.Add(mono);
     }
     if (mono.NeedLateUpdate)
     {
         lateupdate_removeList.Add(mono);
     }
     if (mono.NeedGUI)
     {
         gui_removeList.Add(mono);
     }
     if (mono.NeedFixedUpdate)
     {
         fixedupdate_removeList.Add(mono);
     }
 }
Beispiel #20
0
 // obj1:来源对象
 // obj2:来源技能
 public override void OnBeAdded(BaseCoreMono mono, params object[] obj)
 {
     base.OnBeAdded(mono, obj);
     R_Caster   = GetAddedObjData <BaseUnit>(0);
     R_Skill    = GetAddedObjData <TDBaseSkillData>(1);
     R_Attr     = AttrMgr.Add(Attr);
     R_Convert  = AttrMgr.Add(Convert);
     R_Performs = new List <BasePerform>();
     CurTime    = 0;
     RTMaxTime  = MaxTime;
     Valid      = true;
     if (PerformMgr != null)
     {
         foreach (var item in Performs)
         {
             R_Performs.Add(PerformMgr.Spawn(item));
         }
     }
 }
Beispiel #21
0
 public static void RemoveMono(BaseCoreMono mono)
 {
     if (mono.MonoType == MonoType.Unit)
     {
         Unit.RemoveMono(mono);
     }
     else if (mono.MonoType == MonoType.Global)
     {
         Global.RemoveMono(mono);
     }
     else if (mono.MonoType == MonoType.View)
     {
         View.RemoveMono(mono);
     }
     else if (mono.MonoType == MonoType.Normal)
     {
         Normal.RemoveMono(mono);
     }
 }
Beispiel #22
0
 public override void OnBeAdded(BaseCoreMono mono, params object[] obj)
 {
     base.OnBeAdded(mono, obj);
     if (RootState == null)
     {
         RootState = CreateRootState();
         if (!DefaultState.IsInv())
         {
             RootState.ChangeState(new StrHash(DefaultState));
         }
         else
         {
             RootState.ChangeDefaultState();
         }
     }
     else
     {
         CLog.Error("没有移除:RootState");
     }
 }
Beispiel #23
0
 public void AddMono(BaseCoreMono mono)
 {
     if (mono.NeedUpdate)
     {
         update_addList.Add(mono);
     }
     if (mono.NeedLateUpdate)
     {
         lateupdate_addList.Add(mono);
     }
     if (mono.NeedGUI)
     {
         gui_addList.Add(mono);
     }
     if (mono.NeedFixedUpdate)
     {
         fixedupdate_addList.Add(mono);
     }
     if (mono.NeedGameLogicTurn)
     {
         turnLogic_addList.Add(mono);
     }
 }
Beispiel #24
0
        public virtual void OnCreate(BaseCoreMono selfMono, BaseCoreMono castMono, params object[] ps)
        {
            SelfMono = selfMono;
            CastMono = castMono;
            if (UseFollow)
            {
                SetFollow();
            }
            TouchGround();
            SetLifeTime(LifeTime);
            OnPlaySFX();
            LastedPos = Pos;

            if (DispearType == PerformDispearType.Flicker)
            {
                flickerEffect = BaseCoreMono.GetUnityComponet <FlickerEffect>(this);
                flickerEffect.StopEffect();
            }
            else if (DispearType == PerformDispearType.Scale)
            {
                Trans.localScale = Vector3.one;
            }
            Callback_OnCreated?.Invoke(this);
        }
Beispiel #25
0
 /// <summary>
 /// 被添加的时候触发:手动调用
 /// </summary>
 /// <param name="mono"></param>
 /// <param name="obj"></param>
 public virtual void OnBeAdded(BaseCoreMono selfMono, params object[] obj)
 {
     AddedObjs    = obj;
     SelfBaseUnit = selfMono as BaseUnit;
 }
Beispiel #26
0
 public static bool IsRight(BaseCoreMono self, BaseCoreMono target)
 {
     return(Vector3.Cross(self.Forward, target.Pos).y > 0);
 }
Beispiel #27
0
 // 是否面对
 public static bool IsFace(BaseCoreMono self, Vector3 target)
 {
     return(Vector3.Dot(self.Forward, target - self.Pos) >= 0 ? true : false);
 }
Beispiel #28
0
 public virtual T FindDeeapCopy(K id)
 {
     return((T)BaseCoreMono.GetDeepCopy(Find(id)));
 }
Beispiel #29
0
 public static void ActiveMono(BaseCoreMono mono) => mono.IsEnable   = true;
Beispiel #30
0
 public static void DeactiveMono(BaseCoreMono mono) => mono.IsEnable = false;