コード例 #1
0
ファイル: DetourManager.cs プロジェクト: slb1988/agame
        private bool GetTargetCorner(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition, ref Vector3 targetCorner)
        {
            DetourElement element;

            this._detours.TryGetValue(entity.GetRuntimeID(), out element);
            if (element == null)
            {
                return(false);
            }
            if (Miscs.DistancForVec3IgnoreY(targetPosition, element.targetPosition) > this._getPathDisThreshold)
            {
                this._detours.Remove(entity.GetRuntimeID());
                return(false);
            }
            if (Miscs.DistancForVec3IgnoreY(element.corners[element.targetCornerIndex], sourcePosition) <= element.disReachCornerThreshold)
            {
                if (element.targetCornerIndex == (element.corners.Length - 1))
                {
                    this._detours.Remove(entity.GetRuntimeID());
                    targetCorner = targetPosition;
                    return(true);
                }
                element.targetCornerIndex++;
                targetCorner = element.corners[element.targetCornerIndex];
                return(true);
            }
            targetCorner = element.corners[element.targetCornerIndex];
            return(true);
        }
コード例 #2
0
ファイル: MonoTriggerBullet.cs プロジェクト: slb1988/agame
 private void OnTriggerEnter(Collider other)
 {
     if (((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0) && this._collisionEnabled)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (Singleton <RuntimeIDManager> .Instance.ParseCategory(componentInParent.GetRuntimeID()) == 4)
         {
             if (this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
             {
                 return;
             }
         }
         else if (!componentInParent.IsActive() || this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
         {
             return;
         }
         BaseMonoEntity owner = componentInParent;
         if (componentInParent is BaseMonoDynamicObject)
         {
             BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent;
             if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null))
             {
                 this._enteredIDs.Add(obj2.owner.GetRuntimeID());
             }
         }
         else if (componentInParent is MonoBodyPartEntity)
         {
             owner = ((MonoBodyPartEntity)componentInParent).owner;
         }
         if (!(owner is BaseMonoAbilityEntity) || !((BaseMonoAbilityEntity)owner).isGhost)
         {
             this._enteredIDs.Add(owner.GetRuntimeID());
             EvtBulletHit evt = new EvtBulletHit(base._runtimeID, owner.GetRuntimeID())
             {
                 ownerID = base.ownerID
             };
             Vector3 position = base.transform.position - ((Vector3)((Time.deltaTime * this.BulletTimeScale) * this._rigidbody.velocity));
             AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                 hitPoint = other.ClosestPointOnBounds(position),
                 hitDir   = this.CreateHitForward()
             };
             evt.hitCollision = collsion;
             Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);
         }
     }
 }
コード例 #3
0
ファイル: EventManager.cs プロジェクト: slb1988/agame
        public T CreateActor <T>(BaseMonoEntity entity) where T : BaseActor, new()
        {
            T item = Activator.CreateInstance <T>();

            item.runtimeID  = entity.GetRuntimeID();
            item.gameObject = entity.gameObject;
            item.Init(entity);
            this._actorList.Add(item);
            this._actors.Add(entity.GetRuntimeID(), item);
            ushort index = Singleton <RuntimeIDManager> .Instance.ParseCategory(item.runtimeID);

            this._categoryActors[index].Add(item);
            this.ProcessInitedActor(item);
            Singleton <LevelManager> .Instance.gameMode.RegisterRuntimeID(item.runtimeID);

            return(item);
        }
コード例 #4
0
ファイル: DetourManager.cs プロジェクト: slb1988/agame
 public bool GetTargetPosition(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition, ref Vector3 targetCorner)
 {
     if (!this.Raycast(entity.GetRuntimeID(), sourcePosition, targetPosition))
     {
         targetCorner = targetPosition;
         return(true);
     }
     return(this.GetCornerAndCalcPathWhenNeed(entity, sourcePosition, targetPosition, ref targetCorner));
 }
コード例 #5
0
 private void OnTriggerEnter(Collider other)
 {
     if ((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (Singleton <RuntimeIDManager> .Instance.ParseCategory(componentInParent.GetRuntimeID()) == 4)
         {
             if (this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
             {
                 return;
             }
         }
         else if (!componentInParent.IsActive() || this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
         {
             return;
         }
         if (componentInParent is MonoDummyDynamicObject)
         {
             BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent;
             if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null))
             {
                 this._enteredIDs.Add(obj2.owner.GetRuntimeID());
             }
         }
         this._enteredIDs.Add(componentInParent.GetRuntimeID());
         this.OnEntityEntered(other, componentInParent);
         if (this._stopOnFirstContact)
         {
             this._animation.Stop();
             this._rigidbody.detectCollisions = false;
         }
         if (this.triggerEnterCallback != null)
         {
             if (this._follow)
             {
                 base.StartCoroutine(this.WaitEndOfFrameTriggerHit(other, componentInParent));
             }
             else
             {
                 this.FireTriggerCallback(other, componentInParent);
             }
         }
     }
 }
コード例 #6
0
 private static bool IsEntityAlreadyInResults(List <CollisionResult> results, BaseMonoEntity entity)
 {
     for (int i = 0; i < results.Count; i++)
     {
         if (results[i].entity.GetRuntimeID() == entity.GetRuntimeID())
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #7
0
        private void HitBoxTriggerEnterCallback(MonoAnimatedHitboxDetect hitbox, Collider other)
        {
            if (hitbox.entryName == this.config.ColliderEntryName)
            {
                BaseMonoEntity   componentInParent = other.GetComponentInParent <BaseMonoEntity>();
                BaseAbilityActor actor             = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(componentInParent.GetRuntimeID());

                if (actor != null)
                {
                    switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(componentInParent.GetRuntimeID()))
                    {
                    case 3:
                    case 4:
                    {
                        HashSet <BaseAbilityActor> set = new HashSet <BaseAbilityActor>(Singleton <EventManager> .Instance.GetEnemyActorsOf <BaseAbilityActor>(actor));
                        if (set.Contains(base.actor))
                        {
                            bool flag = false;
                            foreach (Tuple <MonoAnimatedHitboxDetect, HashSet <BaseAbilityActor> > tuple in this._draggedEnemyList)
                            {
                                if (tuple.Item1 == hitbox)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (flag)
                            {
                                HashSet <uint> set2 = null;
                                foreach (Tuple <MonoAnimatedHitboxDetect, HashSet <uint> > tuple2 in this._touchedEnemyList)
                                {
                                    if (tuple2.Item1 == hitbox)
                                    {
                                        set2 = tuple2.Item2;
                                        if (tuple2.Item2.Contains(actor.runtimeID))
                                        {
                                            return;
                                        }
                                    }
                                }
                                if (set2 != null)
                                {
                                    set2.Add(actor.runtimeID);
                                }
                            }
                        }
                        break;
                    }
                    }
                }
            }
        }
コード例 #8
0
        private void TriggerAbility(BaseMonoEntity target, string ability)
        {
            EvtAbilityStart evt = new EvtAbilityStart(base.entity.GetRuntimeID(), null)
            {
                abilityName = ability
            };

            if (target != null)
            {
                evt.otherID = target.GetRuntimeID();
            }
            Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);
        }
コード例 #9
0
 private void OnTriggerEnter(Collider other)
 {
     if ((this._collisionMask.value & (((int)1) << other.gameObject.layer)) != 0)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (componentInParent.IsActive() && !this._enteredIDs.Contains(componentInParent.GetRuntimeID()))
         {
             if (componentInParent is MonoDummyDynamicObject)
             {
                 BaseMonoDynamicObject obj2 = (BaseMonoDynamicObject)componentInParent;
                 if ((obj2.dynamicType == BaseMonoDynamicObject.DynamicType.EvadeDummy) && (obj2.owner != null))
                 {
                     this._enteredIDs.Add(obj2.owner.GetRuntimeID());
                 }
             }
             this._enteredIDs.Add(componentInParent.GetRuntimeID());
             if (this.triggerEnterCallback != null)
             {
                 this.triggerEnterCallback(other);
             }
         }
     }
 }
コード例 #10
0
ファイル: DetourManager.cs プロジェクト: slb1988/agame
        private DetourElement FillDetourElement(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition)
        {
            uint          runtimeID = entity.GetRuntimeID();
            DetourElement element   = this.GetNewDetourElement(entity, sourcePosition, targetPosition);

            if (element == null)
            {
                this.RemoveDetourElement(runtimeID);
                return(null);
            }
            if (this._detours.ContainsKey(runtimeID))
            {
                this._detours[runtimeID] = element;
                return(element);
            }
            this._detours.Add(runtimeID, element);
            return(element);
        }
コード例 #11
0
ファイル: MonoTriggerProp.cs プロジェクト: slb1988/agame
        protected virtual void OnEffectiveTriggerEnter(Collider other)
        {
            for (int i = 0; i < this._insideColliders.Count; i++)
            {
                if (((this._insideColliders[i] != null) && (this._insideColliders[i].Item1 != null)) && (this._insideColliders[i].Item1.gameObject == other.gameObject))
                {
                    return;
                }
            }
            BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();

            if ((componentInParent != null) && componentInParent.IsActive())
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtFieldEnter(base._runtimeID, componentInParent.GetRuntimeID()), MPEventDispatchMode.Normal);

                int num2 = this._insideColliders.SeekAddPosition <Tuple <Collider, uint> >();
                this._insideColliders[num2] = Tuple.Create <Collider, uint>(other, componentInParent.GetRuntimeID());
            }
        }
コード例 #12
0
ファイル: MonoDamageText.cs プロジェクト: slb1988/agame
        public void SetupView(DamageType type, float damage, Vector3 pos, BaseMonoEntity attackee)
        {
            this._type              = type;
            this._attackee          = attackee;
            this._positionOffset    = pos - attackee.XZPosition;
            this._uiPositionXOffset = 0f;
            if (this._textList == null)
            {
                this.Init();
            }
            base.transform.position = Singleton <CameraManager> .Instance.GetMainCamera().WorldToUIPoint(pos);

            base.transform.SetLocalPositionZ(0f);
            bool flag = Singleton <AvatarManager> .Instance.IsLocalAvatar(attackee.GetRuntimeID());

            for (int i = 0; i < this._textList.Count; i++)
            {
                if (i == this._type)
                {
                    this._textList[i].gameObject.SetActive(true);
                    int num2 = UIUtil.FloorToIntCustom(damage);
                    this._textList[i].text = (!flag ? num2 : -num2).ToString();
                }
                else
                {
                    this._textList[i].gameObject.SetActive(false);
                }
            }
            if (flag)
            {
                this._animation.Play("DisplayAvatarHPDown");
            }
            else if (type == DamageType.Critical)
            {
                this._animation.Play("DamageTextCrit");
            }
            else
            {
                this._animation.Play("DamageTextMove");
            }
            this._speedX = UnityEngine.Random.Range((float)-1f, (float)1f);
        }
コード例 #13
0
ファイル: DetourManager.cs プロジェクト: slb1988/agame
        private bool GetCornerAndCalcPathWhenNeed(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition, ref Vector3 targetCorner)
        {
            DetourElement element;
            uint          runtimeID = entity.GetRuntimeID();

            if (this._getPathNumPerFrame >= this._getPathMaxNumPerFrame)
            {
                return(this.GetTargetCorner(entity, sourcePosition, targetPosition, ref targetCorner));
            }
            this._detours.TryGetValue(runtimeID, out element);
            if (element == null)
            {
                DetourElement element2 = this.FillDetourElement(entity, sourcePosition, targetPosition);
                if (element2 != null)
                {
                    targetCorner = element2.corners[element2.targetCornerIndex];
                    return(true);
                }
                targetCorner = targetPosition;
                return(true);
            }
            bool flag = this.GetTargetCorner(entity, sourcePosition, targetPosition, ref targetCorner);

            if (flag)
            {
                return(flag);
            }
            if ((Time.time - element.lastGetPathTime) <= this._getPathTimeThreshold)
            {
                return(flag);
            }
            DetourElement element3 = this.FillDetourElement(entity, sourcePosition, targetPosition);

            if (element3 != null)
            {
                targetCorner = element3.corners[element3.targetCornerIndex];
                return(true);
            }
            targetCorner = targetPosition;
            return(true);
        }
コード例 #14
0
        public override void OnAbilityTriggered(EvtAbilityStart evt)
        {
            BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar();

            if (localAvatar != null)
            {
                int count = localAvatar.SubAttackTargetList.Count;
                for (int i = 0; i < count; i++)
                {
                    BaseMonoEntity  entity = localAvatar.SubAttackTargetList[i];
                    EvtAbilityStart start  = new EvtAbilityStart(base.entity.GetRuntimeID(), null)
                    {
                        abilityName = this.config.AbilityName
                    };
                    if (entity != null)
                    {
                        start.otherID = entity.GetRuntimeID();
                    }
                    Singleton <EventManager> .Instance.FireEvent(start, MPEventDispatchMode.Normal);
                }
            }
        }
コード例 #15
0
ファイル: DetourManager.cs プロジェクト: slb1988/agame
        private DetourElement GetNewDetourElement(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition)
        {
            NavMeshPath path = new NavMeshPath();
            bool        flag = NavMesh.CalculatePath(sourcePosition, targetPosition, this._stageAreaWalkMask, path);

            for (int i = 0; i < (path.corners.Length - 1); i++)
            {
                Debug.DrawLine(path.corners[i], path.corners[i + 1], Color.green, 0.1f);
            }
            this._getPathNumPerFrame++;
            DetourElement element = new DetourElement {
                id              = entity.GetRuntimeID(),
                targetPosition  = targetPosition,
                isCompletePath  = flag,
                lastGetPathTime = Time.time
            };

            Vector3[] vectorArray = this.SimplifyPath(sourcePosition, path);
            if (vectorArray.Length == 0)
            {
                return(null);
            }
            CapsuleCollider componentInChildren = entity.GetComponentInChildren <CapsuleCollider>();

            if (componentInChildren != null)
            {
                element.disReachCornerThreshold = componentInChildren.radius;
            }
            else
            {
                element.disReachCornerThreshold = this._disReachCornerThreshold;
            }
            element.corners           = vectorArray;
            element.targetCornerIndex = 0;
            return(element);
        }
コード例 #16
0
ファイル: MonoGoods.cs プロジェクト: slb1988/agame
        public void OnTriggerEnter(Collider other)
        {
            if (!this._hasTriggerEntered)
            {
                BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
                if ((componentInParent != null) && Singleton <AvatarManager> .Instance.IsLocalAvatar(componentInParent.GetRuntimeID()))
                {
                    Singleton <EventManager> .Instance.FireEvent(new EvtFieldEnter(base._runtimeID, componentInParent.GetRuntimeID()), MPEventDispatchMode.Normal);

                    this._hasTriggerEntered = true;
                }
            }
        }
コード例 #17
0
ファイル: HintArrowManager.cs プロジェクト: slb1988/agame
        private void SetHintArrowByScreenPos(MonoHintArrow arrow, BaseMonoEntity entity)
        {
            bool flag = (((entity != null) && entity.IsActive()) && !Singleton <AvatarManager> .Instance.IsLocalAvatar(entity.GetRuntimeID())) && !Singleton <CameraManager> .Instance.GetMainCamera().IsEntityVisible(entity);

            bool isArrowVisibleBefore = (arrow.state == MonoHintArrow.State.Visible) || (arrow.state == MonoHintArrow.State.FadingIn);
            bool flag3 = (entity == null) || entity.IsToBeRemove();

            if ((arrow.state == MonoHintArrow.State.Hidden) && flag3)
            {
                UnityEngine.Object.Destroy(arrow.gameObject);
            }
            else if (isArrowVisibleBefore && !flag)
            {
                arrow.SetVisible(false);
                if (flag3)
                {
                    arrow.SetDestroyUponFadeOut();
                }
            }
            else if (!isArrowVisibleBefore && flag)
            {
                arrow.SetVisible(true);
            }
            if (flag)
            {
                this.UpdateHintArrow(arrow.transform, entity.XZPosition, isArrowVisibleBefore);
            }
        }
コード例 #18
0
ファイル: HintArrowManager.cs プロジェクト: slb1988/agame
        public void AddHintArrow(uint listenRuntimeID)
        {
            BaseMonoEntity listenEntity = Singleton <EventManager> .Instance.GetEntity(listenRuntimeID);

            string path = string.Empty;

            if (Singleton <RuntimeIDManager> .Instance.ParseCategory(listenRuntimeID) == 4)
            {
                path = "UI/HintArrowAlt/HintArrowMonsterAlt";
            }
            else if (Singleton <RuntimeIDManager> .Instance.ParseCategory(listenRuntimeID) == 3)
            {
                path = "UI/HintArrowAlt/HintArrowAvatarAlt";
            }
            else
            {
                if (!(listenEntity is BaseMonoDynamicObject) || (Singleton <EventManager> .Instance.GetActor(listenEntity.GetRuntimeID()) == null))
                {
                    throw new Exception("Invalid Type or State!");
                }
                path = "UI/HintArrowAlt/HintArrowExitAlt";
            }
            MonoHintArrow component = UnityEngine.Object.Instantiate <GameObject>(Miscs.LoadResource <GameObject>(path, BundleType.RESOURCE_FILE)).GetComponent <MonoHintArrow>();

            component.Init(listenRuntimeID, listenEntity);
            component.transform.SetParent(this._hintRing.transform, false);
            this._hintArrowLs.Add(component);
        }
コード例 #19
0
 public override void Init(BaseMonoEntity entity)
 {
     base.runtimeID = entity.GetRuntimeID();
 }
コード例 #20
0
        protected override bool ListenBulletHit(EvtBulletHit evt)
        {
            if (!base._bulletAttackDatas.ContainsKey(evt.targetID))
            {
                return(false);
            }
            BaseMPIdentity identity = Singleton <MPManager> .Instance.TryGetIdentity(evt.otherID);

            if (((identity != null) && !identity.isAuthority) && !identity.remoteMode.IsRemoteReceive())
            {
                return(false);
            }
            AttackData attackData = base._bulletAttackDatas[evt.targetID];

            attackData.isFromBullet = true;
            bool           flag   = base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage;
            bool           flag2  = (base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDoExplodeDamage) || (base.baseConfig.BulletHitType == BulletHitBehavior.DestroyAndDamageHitTarget);
            bool           flag3  = true;
            bool           flag4  = base.baseConfig.BulletHitType == BulletHitBehavior.NoDestroyAndRefresh;
            BaseMonoEntity entity = Singleton <EventManager> .Instance.GetEntity(evt.otherID);

            BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor(evt.otherID) as BaseAbilityActor;

            if ((entity is MonoDummyDynamicObject) || ((identity != null) && !identity.remoteMode.IsRemoteReceive()))
            {
                flag2 = false;
                flag  = false;
                flag3 = false;
                flag4 = false;
            }
            else if (evt.hitEnvironment)
            {
                flag2 = true;
                flag4 = false;
            }
            else if ((!evt.cannotBeReflected && (actor != null)) && actor.abilityState.ContainsState(AbilityState.ReflectBullet))
            {
                Singleton <EventManager> .Instance.FireEvent(new EvtAfterBulletReflected(evt.otherID, evt.targetID, base.actor.runtimeID, base._bulletAttackDatas[evt.targetID]), MPEventDispatchMode.Normal);

                return(false);
            }
            AbilityTriggerBullet bulletActor = Singleton <EventManager> .Instance.GetActor <AbilityTriggerBullet>(evt.targetID);

            if (flag2)
            {
                bulletActor.Kill();
                base._bulletAttackDatas.Remove(evt.targetID);
            }
            else
            {
                attackData = attackData.Clone();
            }
            if (flag4)
            {
                bulletActor.triggerBullet.ResetInside(base.baseConfig.ResetTime);
            }
            base._evtsLs.Clear();
            if (evt.hitEnvironment)
            {
                if (!evt.hitGround)
                {
                    return(true);
                }
                EvtHittingOther item = new EvtHittingOther(base.actor.runtimeID, evt.otherID, attackData)
                {
                    hitCollision = evt.hitCollision
                };
                base._evtsLs.Add(item);
            }
            else
            {
                attackData.hitCollision = evt.hitCollision;
                base._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, evt.otherID, base.baseConfig.HitAnimEventID, attackData));
            }
            if (flag)
            {
                List <CollisionResult> list = CollisionDetectPattern.CylinderCollisionDetectBySphere(evt.hitCollision.hitPoint, evt.hitCollision.hitPoint, base.instancedAbility.Evaluate(base.baseConfig.HitExplodeRadius), 1f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, base.baseConfig.Targetting));
                float y = evt.hitCollision.hitPoint.y;
                for (int j = 0; j < list.Count; j++)
                {
                    CollisionResult result = list[j];
                    BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                    if ((collisionResultEntity != null) && (collisionResultEntity.GetRuntimeID() != evt.otherID))
                    {
                        result.hitPoint.y = y;
                        AttackData data2 = attackData.Clone();
                        AttackResult.HitCollsion collsion = new AttackResult.HitCollsion {
                            hitDir   = result.hitForward,
                            hitPoint = result.hitPoint
                        };
                        data2.hitCollision = collsion;
                        base._evtsLs.Add(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), base.baseConfig.HitAnimEventID, data2));
                    }
                }
            }
            if (flag3)
            {
                Vector3 hitPoint = evt.hitCollision.hitPoint;
                if (base.baseConfig.ExplodeEffectGround)
                {
                    hitPoint.y = 0f;
                }
                Vector3 hitDir = evt.hitCollision.hitDir;
                hitDir.y = 0f;
                base.FireTriggerBulletHitExplodeEffect(bulletActor, hitPoint, hitDir, false);
            }
            if (base.baseConfig.HitExplodeActions.Length > 0)
            {
                for (int k = 0; k < base._evtsLs.Count; k++)
                {
                    base.actor.abilityPlugin.HandleActionTargetDispatch(base.baseConfig.HitExplodeActions, base.instancedAbility, base.instancedModifier, Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(base._evtsLs[k].toID), evt);
                }
            }
            for (int i = 0; i < base._evtsLs.Count; i++)
            {
                EvtHittingOther other2 = base._evtsLs[i];
                AttackPattern.SendHitEvent(base.actor.runtimeID, other2.toID, other2.animEventID, other2.hitCollision, other2.attackData, false, MPEventDispatchMode.CheckRemoteMode);
            }
            return(true);
        }
コード例 #21
0
        private void SelectSubTargets(int targetAmount)
        {
            BaseMonoEntity attackTarget = base.actor.entity.GetAttackTarget();

            if ((attackTarget != null) && !this._subSelectTargetList.Contains(attackTarget))
            {
                this._subSelectTargetList.Add(attackTarget);
                this.AddSubAttackTarget(attackTarget);
                if (attackTarget is BaseMonoMonster)
                {
                    MonsterActor actor = Singleton <EventManager> .Instance.GetActor <MonsterActor>(attackTarget.GetRuntimeID());

                    if ((actor != null) && !string.IsNullOrEmpty(this.config.SubTargetModifierName))
                    {
                        actor.abilityPlugin.ApplyModifier(base.instancedAbility, this.config.SubTargetModifierName);
                    }
                }
            }
            List <BaseMonoMonster> allMonsters = Singleton <MonsterManager> .Instance.GetAllMonsters();

            allMonsters.Sort(new Comparison <BaseMonoMonster>(this.NearestTargetCompare));
            for (int i = 0; i < allMonsters.Count; i++)
            {
                BaseMonoMonster item   = allMonsters[i];
                MonsterActor    actor2 = Singleton <EventManager> .Instance.GetActor <MonsterActor>(item.GetRuntimeID());

                if (((item != attackTarget) && (actor2 != null)) && ((this._subSelectTargetList.Count < targetAmount) && !this._subSelectTargetList.Contains(item)))
                {
                    if (!string.IsNullOrEmpty(this.config.SubTargetModifierName))
                    {
                        actor2.abilityPlugin.ApplyModifier(base.instancedAbility, this.config.SubTargetModifierName);
                    }
                    this._subSelectTargetList.Add(item);
                    this.AddSubAttackTarget(item);
                }
            }
        }
コード例 #22
0
        public override void OnStart()
        {
            BaseMonoEntity component = base.GetComponent <BaseMonoEntity>();

            this._actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(component.GetRuntimeID());
        }
コード例 #23
0
ファイル: MonoTriggerProp.cs プロジェクト: slb1988/agame
 protected override void OnDurationTimeOut()
 {
     for (int i = 0; i < this._insideColliders.Count; i++)
     {
         if ((this._insideColliders[i] != null) && (this._insideColliders[i].Item1 != null))
         {
             BaseMonoEntity componentInParent = this._insideColliders[i].Item1.GetComponentInParent <BaseMonoEntity>();
             if (componentInParent != null)
             {
                 Singleton <EventManager> .Instance.FireEvent(new EvtFieldExit(base._runtimeID, componentInParent.GetRuntimeID()), MPEventDispatchMode.Normal);
             }
         }
     }
     this._insideColliders.Clear();
     base.OnDurationTimeOut();
 }
コード例 #24
0
ファイル: Miscs.cs プロジェクト: slb1988/agame
 public static string GetDebugEntityName(BaseMonoEntity entity)
 {
     if (entity == null)
     {
         return("<!null>");
     }
     return(string.Format("<{0}({1:x})>", Truncate(entity.gameObject.name, 10), entity.GetRuntimeID()));
 }
コード例 #25
0
        public override void OnAbilityTriggered(EvtAbilityStart evt)
        {
            BaseMonoEntity attackTarget = base.actor.entity.GetAttackTarget();

            if (attackTarget != null)
            {
                this._pullActor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(attackTarget.GetRuntimeID());
            }
            if (this._pullActor != null)
            {
                this._pullActor.entity.SetHasAdditiveVelocity(true);
                Vector3 vector = base.entity.transform.position - attackTarget.transform.position;
                if (vector.magnitude < base.instancedAbility.Evaluate(this.config.PullRadius))
                {
                    vector.Normalize();
                    this._pullActor.entity.SetAdditiveVelocity((Vector3)(vector * base.instancedAbility.Evaluate(this.config.PullVelocity)));
                }
            }
        }
コード例 #26
0
ファイル: MonoTriggerProp.cs プロジェクト: slb1988/agame
 protected virtual void OnEffectiveTriggerExit(Collider other)
 {
     if (other != null)
     {
         BaseMonoEntity componentInParent = other.GetComponentInParent <BaseMonoEntity>();
         if (componentInParent != null)
         {
             Singleton <EventManager> .Instance.FireEvent(new EvtFieldExit(base._runtimeID, componentInParent.GetRuntimeID()), MPEventDispatchMode.Normal);
         }
         int num = -1;
         for (int i = 0; i < this._insideColliders.Count; i++)
         {
             if (((this._insideColliders[i] != null) && (this._insideColliders[i].Item1 != null)) && (this._insideColliders[i].Item1.gameObject == other.gameObject))
             {
                 num = i;
             }
         }
         if (num >= 0)
         {
             this._insideColliders[num] = null;
         }
     }
 }
コード例 #27
0
        private void KillBlackHole(bool doExplodeHit)
        {
            if ((this._fieldActor != null) && (this._fieldActor.triggerField != null))
            {
                List <uint> insideRuntimeIDs = this._fieldActor.GetInsideRuntimeIDs();
                this._fieldActor.triggerField.transform.position.y = 1f;
                for (int i = 0; i < insideRuntimeIDs.Count; i++)
                {
                    uint             runtimeID = insideRuntimeIDs[i];
                    BaseAbilityActor actor     = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(runtimeID);

                    if (((actor != null) && (actor.gameObject != null)) && ((this.config.ModifierNames != null) && (this.config.ModifierNames.Length > 0)))
                    {
                        int index  = 0;
                        int length = this.config.ModifierNames.Length;
                        while (index < length)
                        {
                            if (actor.abilityPlugin != null)
                            {
                                actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.ModifierNames[index]);
                            }
                            index++;
                        }
                    }
                }
                if (doExplodeHit && (this.config.ExplodeAnimEventID != null))
                {
                    List <CollisionResult> list2 = CollisionDetectPattern.CylinderCollisionDetectBySphere(this._fieldActor.triggerField.XZPosition, this._fieldActor.triggerField.XZPosition, base.instancedAbility.Evaluate(this.config.Radius), 2f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, MixinTargetting.Enemy));
                    for (int j = 0; j < list2.Count; j++)
                    {
                        CollisionResult result = list2[j];
                        BaseMonoEntity  collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity);
                        if (collisionResultEntity != null)
                        {
                            Singleton <EventManager> .Instance.FireEvent(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), this.config.ExplodeAnimEventID, result.hitPoint, result.hitForward), MPEventDispatchMode.Normal);
                        }
                    }
                }
                base.FireMixinEffect(this.config.DestroyEffect, this._fieldActor.triggerField, false);
                this._fieldActor.Kill();
                this._blackHoleTimer.timespan = base.instancedAbility.Evaluate(this.config.Duration);
                this._blackHoleTimer.Reset(false);
                if ((this.config.CreationEffect != null) && (this.config.CreationEffect.EffectPattern != null))
                {
                    Singleton <EffectManager> .Instance.SetDestroyIndexedEffectPattern(this._blackHoleEffectIx);
                }
                foreach (KeyValuePair <BaseAbilityActor, int> pair in this._addedVelocityActorsAndIndexDic)
                {
                    if ((pair.Key != null) && (pair.Key.entity != null))
                    {
                        pair.Key.entity.SetAdditiveVelocityOfIndex(Vector3.zero, pair.Value);
                        pair.Key.entity.SetHasAdditiveVelocity(false);
                    }
                }
                this._addedVelocityActorsAndIndexDic.Clear();
            }
        }
コード例 #28
0
        private void OnUpdateAttackTarget(BaseMonoEntity entity)
        {
            if ((entity != null) && this._isTutorialAvailable)
            {
                MonsterActor attackee = Singleton <EventManager> .Instance.GetActor <MonsterActor>(entity.GetRuntimeID());

                BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar();

                AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID());

                EntityNature attackerNature = (EntityNature)attackee.metaConfig.nature;
                EntityNature attribute      = (EntityNature)actor.avatarDataItem.Attribute;
                float        num            = DamageModelLogic.GetNatureDamageBonusRatio(attackerNature, attribute, attackee);
                if (((((attackee != null) && (actor != null)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep))) && ((!this.IsAllStepDone() && (num > 1f)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep)))) && !this.IsAllStepDone())
                {
                    this.ActiveCurrentStep();
                    this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep0));
                }
                if ((((attackee != null) && (actor != null)) && ((this._killAmount >= 2) && (this._monsterCreatedAmount > 2))) && (((num > 1f) && (base.step == 2)) && ((base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep) && !this.IsAllStepDone())))
                {
                    this.ActiveCurrentStep();
                    this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep2));
                }
            }
        }
コード例 #29
0
ファイル: AttackPattern.cs プロジェクト: slb1988/agame
        public static void TestAndActHit(string attackName, ConfigEntityAttackPattern patternConfig, IAttacker attacker, List <CollisionResult> results)
        {
            AttackResult.HitCollsion collsion4;
            List <CollisionResult>   list = FilterRealAttackeesByBodyParts(attackName, patternConfig, attacker, results);

            switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(attacker.GetRuntimeID()))
            {
            case 3:
                foreach (CollisionResult result in list)
                {
                    BaseMonoEntity entity = result.entity;
                    if (((entity != null) && (entity.GetRuntimeID() != attacker.GetRuntimeID())) && (entity.IsActive() || (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity.GetRuntimeID()) == 4)))
                    {
                        switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity.GetRuntimeID()))
                        {
                        case 3:
                        case 4:
                        case 6:
                        case 7:
                            if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity.GetRuntimeID()))
                            {
                                goto Label_0103;
                            }
                            break;
                        }
                    }
                    continue;
Label_0103:
                    collsion4          = new AttackResult.HitCollsion();
                    collsion4.hitDir   = result.hitForward;
                    collsion4.hitPoint = result.hitPoint;
                    AttackResult.HitCollsion hitCollision = collsion4;
                    SendHitEvent(attacker.GetRuntimeID(), entity.GetRuntimeID(), attackName, hitCollision, null, false, MPEventDispatchMode.CheckRemoteMode);
                }
                return;

            case 4:
                foreach (CollisionResult result2 in list)
                {
                    BaseMonoEntity entity2 = result2.entity;
                    if (((entity2 != null) && (entity2.GetRuntimeID() != attacker.GetRuntimeID())) && entity2.IsActive())
                    {
                        switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity2.GetRuntimeID()))
                        {
                        case 3:
                        case 4:
                        case 6:
                            if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity2.GetRuntimeID()))
                            {
                                goto Label_021F;
                            }
                            break;
                        }
                    }
                    continue;
Label_021F:
                    collsion4          = new AttackResult.HitCollsion();
                    collsion4.hitDir   = result2.hitForward;
                    collsion4.hitPoint = result2.hitPoint;
                    AttackResult.HitCollsion collsion2 = collsion4;
                    SendHitEvent(attacker.GetRuntimeID(), entity2.GetRuntimeID(), attackName, collsion2, null, false, MPEventDispatchMode.CheckRemoteMode);
                }
                return;

            case 7:
                foreach (CollisionResult result3 in list)
                {
                    BaseMonoEntity entity3 = result3.entity;
                    if (((entity3 != null) && (entity3.GetRuntimeID() != attacker.GetRuntimeID())) && entity3.IsActive())
                    {
                        switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(entity3.GetRuntimeID()))
                        {
                        case 3:
                        case 4:
                        case 6:
                            if (Singleton <LevelManager> .Instance.gameMode.IsEnemy(attacker.GetRuntimeID(), entity3.GetRuntimeID()))
                            {
                                goto Label_033F;
                            }
                            break;
                        }
                    }
                    continue;
Label_033F:
                    collsion4          = new AttackResult.HitCollsion();
                    collsion4.hitDir   = result3.hitForward;
                    collsion4.hitPoint = result3.hitPoint;
                    AttackResult.HitCollsion collsion3 = collsion4;
                    SendHitEvent(attacker.GetRuntimeID(), entity3.GetRuntimeID(), attackName, collsion3, null, false, MPEventDispatchMode.CheckRemoteMode);
                }
                return;
            }
            throw new Exception("Invalid Type or State!");
        }
コード例 #30
0
        private void ClearSubTargets()
        {
            if (this._subSelectTargetList.Count > 0)
            {
                for (int i = 0; i < this._subSelectTargetList.Count; i++)
                {
                    BaseMonoEntity entity = this._subSelectTargetList[i];
                    if (entity != null)
                    {
                        MonsterActor actor = Singleton <EventManager> .Instance.GetActor <MonsterActor>(entity.GetRuntimeID());

                        if ((actor != null) && !string.IsNullOrEmpty(this.config.SubTargetModifierName))
                        {
                            actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.SubTargetModifierName);
                        }
                    }
                }
                this._subSelectTargetList.Clear();
            }
            this.ClearAllSubAttackTargets();
        }