Exemple #1
0
 public static VCollisionShape InitActorCollision(ActorRoot actor)
 {
     if (actor.shape == null)
     {
         SCollisionComponent sCollisionComponent = null;
         if (!VCollisionShape.s_componentCache.TryGetValue(actor.gameObject.GetInstanceID(), out sCollisionComponent))
         {
             sCollisionComponent = actor.gameObject.GetComponent <SCollisionComponent>();
             VCollisionShape.s_componentCache[actor.gameObject.GetInstanceID()] = sCollisionComponent;
         }
         VCollisionShape vCollisionShape;
         if (sCollisionComponent)
         {
             vCollisionShape = sCollisionComponent.CreateShape();
         }
         else if (actor.CharInfo != null && actor.CharInfo.collisionType != CollisionShapeType.None)
         {
             vCollisionShape = actor.CharInfo.CreateCollisionShape();
         }
         else
         {
             vCollisionShape = VCollisionShape.createFromCollider(actor.gameObject);
         }
         if (vCollisionShape != null)
         {
             vCollisionShape.Born(actor);
         }
     }
     return(actor.shape);
 }
 private void RecorveCollisionScale()
 {
     if (this.actorObj)
     {
         VCollisionShape shape = this.actorObj.handle.shape;
         if (shape != null)
         {
             if (shape is VCollisionSphere)
             {
                 VCollisionSphere vCollisionSphere = shape as VCollisionSphere;
                 if (vCollisionSphere != null)
                 {
                     vCollisionSphere.Radius = this.originalRadius;
                 }
             }
             else if (shape is VCollisionBox)
             {
                 VCollisionBox vCollisionBox = shape as VCollisionBox;
                 if (vCollisionBox != null)
                 {
                     vCollisionBox.Size = this.originalSize;
                 }
             }
         }
     }
 }
Exemple #3
0
 private void SetCollisionScale(int _scaleRate)
 {
     if (this.actorObj != 0)
     {
         VFactor         factor = new VFactor((long)this.scaleRate, 0x2710L);
         VCollisionShape shape  = this.actorObj.handle.shape;
         if (shape != null)
         {
             int roundInt = factor.roundInt;
             if (shape is VCollisionSphere)
             {
                 VCollisionSphere sphere = shape as VCollisionSphere;
                 if (sphere != null)
                 {
                     this.originalRadius = sphere.Radius;
                     sphere.Radius      *= roundInt;
                 }
             }
             else if (shape is VCollisionBox)
             {
                 VCollisionBox box = shape as VCollisionBox;
                 if (box != null)
                 {
                     VInt3 num2;
                     this.originalSize = box.Size;
                     num2.x            = box.Size.x * roundInt;
                     num2.y            = box.Size.y * roundInt;
                     num2.z            = box.Size.z * roundInt;
                     box.Size          = num2;
                 }
             }
         }
     }
 }
Exemple #4
0
        public static bool SetObjWithColVisibleByFowAttached(GameObject inObj, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp, PoolObjHandle <ActorRoot> inAttachActor)
        {
            if (inObj == null)
            {
                return(false);
            }
            if (!inAttachActor || inAttachActor.get_handle().shape == null)
            {
                return(GameFowCollector.SetObjVisibleByFow(inObj, fowMgr, inHostCamp));
            }
            VCollisionShape shape    = inAttachActor.get_handle().shape;
            VInt3           location = inAttachActor.get_handle().location;

            location = new VInt3(location.x, location.z, 0);
            bool flag = fowMgr.IsSurfaceCellVisible(location, inHostCamp);

            if (flag)
            {
                MMGame_Math.SetLayer(inObj, "Actor", "Particles", true);
            }
            else
            {
                flag = shape.AcceptFowVisibilityCheck(inHostCamp, fowMgr);
                if (flag)
                {
                    MMGame_Math.SetLayer(inObj, "Actor", "Particles", true);
                }
                else
                {
                    MMGame_Math.SetLayer(inObj, "Hide", true);
                }
            }
            return(flag);
        }
Exemple #5
0
    public static VCollisionShape InitActorCollision(ActorRoot actor)
    {
        VCollisionShape shape = null;

        if (actor.shape == null)
        {
            SCollisionComponent component = actor.gameObject.GetComponent <SCollisionComponent>();
            if (component != null)
            {
                shape = component.CreateShape();
            }
            else if ((actor.CharInfo != null) && (actor.CharInfo.collisionType != CollisionShapeType.None))
            {
                shape = actor.CharInfo.CreateCollisionShape();
            }
            else
            {
                shape = createFromCollider(actor.gameObject);
            }
            if (shape != null)
            {
                shape.Born(actor);
            }
        }
        return(actor.shape);
    }
 private void SetCollisionScale(int _scaleRate)
 {
     if (this.actorObj)
     {
         VFactor         vFactor = new VFactor((long)this.scaleRate, 10000L);
         VCollisionShape shape   = this.actorObj.handle.shape;
         if (shape != null)
         {
             int roundInt = vFactor.roundInt;
             if (shape is VCollisionSphere)
             {
                 VCollisionSphere vCollisionSphere = shape as VCollisionSphere;
                 if (vCollisionSphere != null)
                 {
                     this.originalRadius      = vCollisionSphere.Radius;
                     vCollisionSphere.Radius *= roundInt;
                 }
             }
             else if (shape is VCollisionBox)
             {
                 VCollisionBox vCollisionBox = shape as VCollisionBox;
                 if (vCollisionBox != null)
                 {
                     this.originalSize = vCollisionBox.Size;
                     VInt3 size;
                     size.x             = vCollisionBox.Size.x * roundInt;
                     size.y             = vCollisionBox.Size.y * roundInt;
                     size.z             = vCollisionBox.Size.z * roundInt;
                     vCollisionBox.Size = size;
                 }
             }
         }
     }
 }
Exemple #7
0
 public override void Born(ActorRoot owner)
 {
     base.Born(owner);
     this.originalPos = base.actor.location;
     if (base.actor.ActorMesh != null)
     {
         this.originalMeshScale = base.actor.ActorMesh.transform.localScale;
     }
     base.actor.isMovable         = base.actor.ObjLinker.CanMovable;
     base.actor.MovementComponent = base.actor.CreateLogicComponent <PlayerMovement>(base.actor);
     base.actor.MatHurtEffect     = base.actor.CreateActorComponent <MaterialHurtEffect>(base.actor);
     base.actor.ShadowEffect      = base.actor.CreateActorComponent <UpdateShadowPlane>(base.actor);
     VCollisionShape.InitActorCollision(base.actor);
     this.cfgInfo = MonsterDataHelper.GetDataCfgInfo(base.actor.TheActorMeta.ConfigId, base.actor.TheActorMeta.Difficuty);
     if ((this.cfgInfo != null) && (this.cfgInfo.bIsBoss > 0))
     {
         this.isBoss = true;
     }
     else
     {
         this.isBoss = false;
     }
     base.actorSubType        = this.cfgInfo.bMonsterType;
     base.actorSubSoliderType = this.cfgInfo.bSoldierType;
     if (this.cfgInfo.iDropProbability == 0x65)
     {
         BattleMisc.BossRoot = base.actorPtr;
     }
 }
 public override void Born(ActorRoot owner)
 {
     base.Born(owner);
     this.originalPos = this.actor.location;
     if (this.actor.ActorMesh != null)
     {
         this.originalMeshScale = this.actor.ActorMesh.transform.localScale;
     }
     this.actor.isMovable         = this.actor.ObjLinker.CanMovable;
     this.actor.MovementComponent = this.actor.CreateLogicComponent <PlayerMovement>(this.actor);
     this.actor.MatHurtEffect     = this.actor.CreateActorComponent <MaterialHurtEffect>(this.actor);
     this.actor.ShadowEffect      = this.actor.CreateActorComponent <UpdateShadowPlane>(this.actor);
     VCollisionShape.InitActorCollision(this.actor);
     this.cfgInfo = MonsterDataHelper.GetDataCfgInfo(this.actor.TheActorMeta.ConfigId, (int)this.actor.TheActorMeta.Difficuty);
     if (this.cfgInfo != null)
     {
         this.endurance = this.cfgInfo.iPursuitE;
     }
     DebugHelper.Assert(this.cfgInfo != null, "Failed find monster cfg by id {0}", new object[]
     {
         this.actor.TheActorMeta.ConfigId
     });
     if (this.cfgInfo != null && this.cfgInfo.bIsBoss > 0)
     {
         this.isBoss = true;
     }
     else
     {
         this.isBoss = false;
     }
     this.actorSubType        = this.cfgInfo.bMonsterType;
     this.actorSubSoliderType = this.cfgInfo.bSoldierType;
 }
Exemple #9
0
    public static VCollisionShape InitActorCollision(ActorRoot actor, GameObject gameObj, string actionName)
    {
        VCollisionShape shape = null;

        if (actor.shape == null)
        {
            SCollisionComponent component = (gameObj == null) ? null : gameObj.GetComponent <SCollisionComponent>();
            if (component != null)
            {
                shape = component.CreateShape();
            }
            else if ((actor.CharInfo != null) && (actor.CharInfo.collisionType != CollisionShapeType.None))
            {
                shape = actor.CharInfo.CreateCollisionShape();
            }
            else if (gameObj != null)
            {
                shape = createFromCollider(gameObj);
            }
            if (shape != null)
            {
                shape.Born(actor);
            }
        }
        return(actor.shape);
    }
Exemple #10
0
    public static VCollisionShape InitActorCollision(ActorRoot actor, GameObject gameObj, string actionName)
    {
        VCollisionShape vCollisionShape = null;

        if (actor.shape == null)
        {
            SCollisionComponent sCollisionComponent = null;
            if (null != gameObj && !VCollisionShape.s_componentCache.TryGetValue(actor.gameObject.GetInstanceID(), out sCollisionComponent))
            {
                sCollisionComponent = gameObj.GetComponent <SCollisionComponent>();
                VCollisionShape.s_componentCache[actor.gameObject.GetInstanceID()] = sCollisionComponent;
            }
            if (sCollisionComponent)
            {
                vCollisionShape = sCollisionComponent.CreateShape();
            }
//          else if (actor.CharInfo != null && actor.CharInfo.collisionType != CollisionShapeType.None)
//          {
//              vCollisionShape = actor.CharInfo.CreateCollisionShape();
//          }
            else if (gameObj)
            {
                vCollisionShape = VCollisionShape.createFromCollider(gameObj);
            }
            if (vCollisionShape != null)
            {
                vCollisionShape.Born(actor);
            }
        }
        return(actor.shape);
    }
        public static bool SetObjWithColVisibleByFow(PoolObjHandle <ActorRoot> inActor, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp)
        {
            if (!inActor)
            {
                return(false);
            }
            ActorRoot       handle = inActor.handle;
            VCollisionShape shape  = handle.shape;

            if (shape == null)
            {
                return(GameFowCollector.SetObjVisibleByFow(inActor, handle.gameObject, fowMgr, inHostCamp));
            }
            VInt3 location = handle.location;

            location = new VInt3(location.x, location.z, 0);
            bool flag = fowMgr.IsVisible(location, inHostCamp);

            if (flag)
            {
                handle.Visible = true;
            }
            else
            {
                flag           = shape.AcceptFowVisibilityCheck(inHostCamp, fowMgr);
                handle.Visible = flag;
            }
            return(flag);
        }
Exemple #12
0
    public void GetCoord(ref Coordinate coord, VCollisionShape shape)
    {
        VInt2 num;
        VInt2 num2;

        shape.GetAabb2D(out num, out num2);
        this.GetCoord(ref coord, num, num2);
    }
Exemple #13
0
 private static bool Intersects(ActorRoot _actor, VCollisionShape _shape, bool bEdge)
 {
     if (bEdge)
     {
         return(_actor.shape.EdgeIntersects(_shape));
     }
     return(_actor.shape.Intersects(_shape));
 }
Exemple #14
0
    public void GetCoord(ref SceneManagement.Coordinate coord, VCollisionShape shape)
    {
        VInt2 origin;
        VInt2 size;

        shape.GetAabb2D(out origin, out size);
        this.GetCoord(ref coord, origin, size);
    }
 public override void OnUse()
 {
     base.OnUse();
     this.bCheckSight                   = false;
     this.shape                         = null;
     this.bActOnCallMonster             = false;
     this.bFindTargetByRotateBodyBullet = false;
 }
Exemple #16
0
 private VCollisionShape GetCollisionShape()
 {
     SCollisionComponent component = base.gameObject.GetComponent<SCollisionComponent>();
     if (component != null)
     {
         return component.CreateShape();
     }
     return VCollisionShape.createFromCollider(base.gameObject);
 }
Exemple #17
0
        public override string[] DeSerilize(string str)
        {
            var strs = base.DeSerilize(str);

            Center   = new VInt3(int.Parse(strs[0]), int.Parse(strs[1]), int.Parse(strs[2]));
            Radius   = float.Parse(strs[3]);
            Collider = VCollisionShape.CreateSphereColliderShape(Center, Radius);

            return(null);
        }
        public override string[] DeSerilize(string str)
        {
            var strs = base.DeSerilize(str);

            Center   = new VInt3(int.Parse(strs[0]), int.Parse(strs[1]), int.Parse(strs[2]));
            Size     = new VInt3(int.Parse(strs[3]), int.Parse(strs[4]), int.Parse(strs[5]));
            Collider = VCollisionShape.CreateBoxColliderShape(Center, Size);

            return(null);
        }
 public override void OnUse()
 {
     base.OnUse();
     this.name               = string.Empty;
     this.isMovable          = true;
     this.isRotatable        = true;
     this.myTransform        = null;
     this.ActorMesh          = null;
     this.ActorMeshAnimation = null;
     this._bVisible          = true;
     this._bInitVisibleDelay = 0;
     this._bInCamera         = false;
     this.ObjID              = 0u;
     this.TheActorMeta       = default(ActorMeta);
     this.TheStaticData      = default(ActorStaticData);
     this.SelfPtr.Release();
     this.ObjLinker                   = null;
     this.ActorControl                = null;
     this.ActorAgent                  = null;
     this.MovementComponent           = null;
     this.SkillControl                = null;
     this.ValueComponent              = null;
     this.HurtControl                 = null;
     this.HudControl                  = null;
     this.AnimControl                 = null;
     this.BuffHolderComp              = null;
     this.MatHurtEffect               = null;
     this.ShadowEffect                = null;
     this.EquipComponent              = null;
     this.DefaultAttackModeControl    = null;
     this.LockTargetAttackModeControl = null;
     this.PetControl                  = null;
     this.OriginalActorMesh           = null;
     this.OriginalMeshAnim            = null;
     this.shape = null;
     this.slotList.Clear();
     this.bChildUpdate             = false;
     this.SMNode                   = null;
     this._location                = VInt3.zero;
     this._forward                 = VInt3.forward;
     this._rotation                = Quaternion.identity;
     this.groundY                  = 0;
     this.hasReachedNavEdge        = false;
     this.pickFlyY                 = 0;
     this.AttackOrderReady         = true;
     this.bOneKiller               = false;
     this.CharInfo                 = null;
     this.HorizonMarker            = null;
     this.BornPos                  = VInt3.zero;
     this.isRecycled               = false;
     this.BornPos                  = VInt3.zero;
     this.PositionRecords          = null;
     this.PositionRecordsLastStamp = 0f;
 }
Exemple #20
0
 public override void Born(ActorRoot owner)
 {
     base.Born(owner);
     this.actor.MovementComponent = this.actor.CreateLogicComponent <PlayerMovement>(this.actor);
     this.actor.MatHurtEffect     = this.actor.CreateActorComponent <MaterialHurtEffect>(this.actor);
     this.actor.EffectControl     = this.actor.CreateLogicComponent <EffectPlayComponent>(this.actor);
     this.actor.EquipComponent    = this.actor.CreateLogicComponent <EquipComponent>(this.actor);
     this.actor.ShadowEffect      = this.actor.CreateActorComponent <UpdateShadowPlane>(this.actor);
     VCollisionShape.InitActorCollision(this.actor);
     this.actor.DefaultAttackModeControl    = this.actor.CreateLogicComponent <DefaultAttackMode>(this.actor);
     this.actor.LockTargetAttackModeControl = this.actor.CreateLogicComponent <LockTargetAttackMode>(this.actor);
 }
 private static bool Intersects(ActorRoot _actor, VCollisionShape _shape, bool bEdge)
 {
     if (_actor == null || _actor.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbiliity_CollisionDetection))
     {
         return(false);
     }
     if (bEdge)
     {
         return(_actor.shape.EdgeIntersects(_shape));
     }
     return(_actor.shape.Intersects(_shape));
 }
        public List <PoolObjHandle <ActorRoot> > GetCollidedActorList(Action _action, PoolObjHandle <ActorRoot> InActor, PoolObjHandle <ActorRoot> triggerActor)
        {
            VCollisionShape vCollisionShape = null;

            if (triggerActor)
            {
                vCollisionShape = triggerActor.get_handle().shape;
            }
            this.triggerHeroList.Clear();
            this.triggerMonsterList.Clear();
            this.triggerOrganList.Clear();
            this.triggerEyeList.Clear();
            this.triggerPriority.Clear();
            this.collidedActors.Clear();
            if (vCollisionShape == null && this.bUseTriggerObj)
            {
                return(null);
            }
            if (this.bUseTriggerObj)
            {
                this._coordInActor = InActor;
                this._coordShape   = vCollisionShape;
                SceneManagement instance = Singleton <SceneManagement> .GetInstance();

                SceneManagement.Coordinate coord = default(SceneManagement.Coordinate);
                instance.GetCoord(ref coord, vCollisionShape);
                instance.UpdateDirtyNodes();
                instance.ForeachActors(coord, this._coordHandler);
                this._coordInActor.Release();
                this._coordShape = null;
            }
            else
            {
                List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .get_instance().GameActors;

                int count = gameActors.get_Count();
                for (int i = 0; i < count; i++)
                {
                    PoolObjHandle <ActorRoot> poolObjHandle = gameActors.get_Item(i);
                    if (poolObjHandle)
                    {
                        ActorRoot handle = poolObjHandle.get_handle();
                        if (!this.TargetObjTypeFilter(ref InActor, handle) && !this.TargetCollideTimeFiler(handle) && !this.TargetCollideCountFilter(handle) && !this.TargetMoveDirectionFilter(ref InActor, ref poolObjHandle))
                        {
                            this.collidedActors.Add(poolObjHandle);
                            this.type_actorList[(int)handle.TheActorMeta.ActorType].Add(poolObjHandle);
                        }
                    }
                }
            }
            return(this.collidedActors);
        }
 private void UpdateCollisionShape()
 {
     if (this.m_shape == null && !this.m_bShaped)
     {
         this.m_shape = this.GetCollisionShape();
         if (this.m_shape != null)
         {
             this.m_shape.UpdateShape((VInt3)base.transform.position, ((VInt3)base.transform.forward).NormalizeTo(1000));
             Singleton <SceneManagement> .GetInstance().GetCoord(ref this.m_shapeCoord, this.m_shape);
         }
         this.m_bShaped = true;
     }
 }
        private List <PoolObjHandle <ActorRoot> > FilterTargetByTriggerRegion(Action _action, PoolObjHandle <ActorRoot> _attackActor, BaseSkill _skill)
        {
            if (!_attackActor || _skill == null)
            {
                return(null);
            }
            HitTriggerTick.targetActors.Clear();
            if (this.bFindTargetByRotateBodyBullet)
            {
                PoolObjHandle <ActorRoot> poolObjHandle = default(PoolObjHandle <ActorRoot>);
                _action.refParams.GetRefParam("FindEnemyActor", ref poolObjHandle);
                if (poolObjHandle)
                {
                    HitTriggerTick.targetActors.Add(poolObjHandle);
                }
                return(HitTriggerTick.targetActors);
            }
            PoolObjHandle <ActorRoot> targetActor = _skill.GetTargetActor();

            if (targetActor && !targetActor.handle.ActorControl.IsDeadState)
            {
                HitTriggerTick.targetActors.Add(targetActor);
            }
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.triggerId);

            if (!actorHandle)
            {
                return(HitTriggerTick.targetActors);
            }
            this.shape = AGE_Helper.GetCollisionShape(actorHandle);
            if (this.shape != null)
            {
                Singleton <TargetSearcher> .instance.BeginCollidedActorList(_attackActor, this.shape, false, true, null, this.bCheckSight);

                List <PoolObjHandle <ActorRoot> > collidedActors = Singleton <TargetSearcher> .instance.GetCollidedActors();

                if (collidedActors != null && collidedActors.get_Count() > 0)
                {
                    List <PoolObjHandle <ActorRoot> > .Enumerator enumerator = collidedActors.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        if (HitTriggerTick.targetActors.IndexOf(enumerator.get_Current()) == -1)
                        {
                            HitTriggerTick.targetActors.Add(enumerator.get_Current());
                        }
                    }
                }
                Singleton <TargetSearcher> .instance.EndCollidedActorList();
            }
            return(HitTriggerTick.targetActors);
        }
Exemple #25
0
        public List <PoolObjHandle <ActorRoot> > GetCollidedActorList(AGE.Action _action, PoolObjHandle <ActorRoot> InActor, PoolObjHandle <ActorRoot> triggerActor)
        {
            VCollisionShape shape = null;

            if (triggerActor != 0)
            {
                shape = triggerActor.handle.shape;
            }
            this.triggerHeroList.Clear();
            this.triggerMonsterList.Clear();
            this.triggerOrganList.Clear();
            this.triggerEyeList.Clear();
            this.triggerPriority.Clear();
            this.collidedActors.Clear();
            if ((shape == null) && this.bUseTriggerObj)
            {
                return(null);
            }
            if (this.bUseTriggerObj)
            {
                this._coordInActor = InActor;
                this._coordShape   = shape;
                SceneManagement instance = Singleton <SceneManagement> .GetInstance();

                SceneManagement.Coordinate coord = new SceneManagement.Coordinate();
                instance.GetCoord(ref coord, shape);
                instance.UpdateDirtyNodes();
                instance.ForeachActors(coord, this._coordHandler);
                this._coordInActor.Release();
                this._coordShape = null;
            }
            else
            {
                List <PoolObjHandle <ActorRoot> > gameActors = Singleton <GameObjMgr> .instance.GameActors;
                int count = gameActors.Count;
                for (int i = 0; i < count; i++)
                {
                    PoolObjHandle <ActorRoot> item = gameActors[i];
                    if (item != 0)
                    {
                        ActorRoot handle = item.handle;
                        if ((!this.TargetObjTypeFilter(ref InActor, handle) && !this.TargetCollideTimeFiler(handle)) && !this.TargetCollideCountFilter(handle))
                        {
                            this.collidedActors.Add(item);
                            this.type_actorList[(int)handle.TheActorMeta.ActorType].Add(item);
                        }
                    }
                }
            }
            return(this.collidedActors);
        }
Exemple #26
0
    public bool Intersects(VCollisionShape shape)
    {
        bool flag = false;

        if (shape == null)
        {
            return(flag);
        }
        if (shape.isBox)
        {
            return(this.Intersects((VCollisionBox)shape));
        }
        return(this.Intersects((VCollisionSphere)shape));
    }
        private List <PoolObjHandle <ActorRoot> > FilterTargetByTriggerRegion(Action _action, PoolObjHandle <ActorRoot> _attackActor, BaseSkill _skill)
        {
            if ((_attackActor == 0) || (_skill == null))
            {
                return(null);
            }
            List <PoolObjHandle <ActorRoot> > list        = null;
            PoolObjHandle <ActorRoot>         targetActor = _skill.GetTargetActor();

            if ((targetActor != 0) && !targetActor.handle.ActorControl.IsDeadState)
            {
                if (list == null)
                {
                    list = new List <PoolObjHandle <ActorRoot> >();
                }
                list.Add(targetActor);
            }
            PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.triggerId);

            if (actorHandle != 0)
            {
                this.shape = AGE_Helper.GetCollisionShape((ActorRoot)actorHandle);
                if (this.shape == null)
                {
                    return(list);
                }
                Singleton <TargetSearcher> .instance.BeginCollidedActorList(_attackActor, this.shape, false, true, null);

                List <PoolObjHandle <ActorRoot> > collidedActors = Singleton <TargetSearcher> .instance.GetCollidedActors();

                if ((collidedActors != null) && (collidedActors.Count > 0))
                {
                    if (list == null)
                    {
                        list = new List <PoolObjHandle <ActorRoot> >();
                    }
                    List <PoolObjHandle <ActorRoot> > .Enumerator enumerator = collidedActors.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        if (list.IndexOf(enumerator.Current) == -1)
                        {
                            list.Add(enumerator.Current);
                        }
                    }
                }
                Singleton <TargetSearcher> .instance.EndCollidedActorList();
            }
            return(list);
        }
Exemple #28
0
    public static VCollisionShape createFromCollider(GameObject gameObject)
    {
        DebugHelper.Assert(!Singleton <BattleLogic> .instance.isFighting || Singleton <GameLogic> .instance.bInLogicTick || Singleton <FrameSynchr> .instance.isCmdExecuting);
        Collider collider = null;

        if (!VCollisionShape.s_colliderCache.TryGetValue(gameObject.GetInstanceID(), out collider))
        {
            collider = gameObject.GetComponent <Collider>();
            VCollisionShape.s_colliderCache[gameObject.GetInstanceID()] = collider;
        }
        if (collider == null)
        {
            return(null);
        }
        VCollisionShape result = null;

        if (collider is BoxCollider)
        {
            BoxCollider boxCollider = collider as BoxCollider;
            result = new VCollisionBox
            {
                Pos  = (VInt3)boxCollider.center,
                Size = (VInt3)boxCollider.size
            };
        }
        else if (collider is CapsuleCollider)
        {
            CapsuleCollider  capsuleCollider  = collider as CapsuleCollider;
            VCollisionSphere vCollisionSphere = new VCollisionSphere();
            Vector3          center           = capsuleCollider.center;
            center.y               -= capsuleCollider.height * 0.5f;
            vCollisionSphere.Pos    = (VInt3)center;
            vCollisionSphere.Radius = ((VInt)capsuleCollider.radius).i;
            result = vCollisionSphere;
        }
        else if (collider is SphereCollider)
        {
            SphereCollider sphereCollider = collider as SphereCollider;
            result = new VCollisionSphere
            {
                Pos    = (VInt3)sphereCollider.center,
                Radius = ((VInt)sphereCollider.radius).i
            };
        }
        return(result);
    }
        protected override void CopyData(BaseEvent src)
        {
            base.CopyData(src);
            HitTriggerTick tick = src as HitTriggerTick;

            this.targetId             = tick.targetId;
            this.triggerId            = tick.triggerId;
            this.victimId             = tick.victimId;
            this.lastHit              = tick.lastHit;
            this.SelfSkillCombineID_1 = tick.SelfSkillCombineID_1;
            this.SelfSkillCombineID_2 = tick.SelfSkillCombineID_2;
            this.SelfSkillCombineID_3 = tick.SelfSkillCombineID_3;
            this.TargetSkillCombine_1 = tick.TargetSkillCombine_1;
            this.TargetSkillCombine_2 = tick.TargetSkillCombine_2;
            this.TargetSkillCombine_3 = tick.TargetSkillCombine_3;
            this.shape = tick.shape;
        }
Exemple #30
0
    public bool EdgeIntersects(VCollisionShape shape)
    {
        bool flag = false;

        if (shape != null)
        {
            if (shape is VCollisionSphere)
            {
                return(this.EdgeIntersects(shape as VCollisionSphere));
            }
            if (shape is VCollisionBox)
            {
                flag = this.EdgeIntersects(shape as VCollisionBox);
            }
        }
        return(flag);
    }