Esempio n. 1
0
    public override bool EdgeIntersects(VCollisionSphere s)
    {
        base.ConditionalUpdateShape();
        s.ConditionalUpdateShape();
        long num  = (long)(this.worldRadius + s.worldRadius);
        long num2 = (long)(this.worldRadius - s.worldRadius);
        long sqrMagnitudeLong2D = (this.worldPos - s.worldPos).sqrMagnitudeLong2D;

        return(sqrMagnitudeLong2D <= num * num && sqrMagnitudeLong2D >= num2 * num2);
    }
    public override bool Intersects(VCollisionSphere s)
    {
        base.ConditionalUpdateShape();
        s.ConditionalUpdateShape();
        VInt3 rhs         = s.WorldPos;
        int   worldRadius = s.WorldRadius;
        int   num         = this.height >> 1;
        int   num2        = this.worldPos.y - num;
        int   num3        = this.worldPos.y + num;

        if (rhs.y + worldRadius <= num2 || rhs.y - worldRadius >= num3)
        {
            return(false);
        }
        int num4 = worldRadius;

        if (rhs.y > num3 || rhs.y < num2)
        {
            int num5 = (rhs.y <= num3) ? (num2 - rhs.y) : (rhs.y - num3);
            int num6 = worldRadius * worldRadius - num5 * num5;
            //DebugHelper.Assert(num6 >= 0);
            num4 = IntMath.Sqrt((long)num6);
        }
        long num7 = (long)(num4 + this.radius);

        if ((this.worldPos - rhs).sqrMagnitudeLong2D >= num7 * num7)
        {
            return(false);
        }
        int   num8 = worldRadius * worldRadius;
        VInt3 lhs  = VCollisionCylinderSector.ClosestPoint(ref rhs, ref this.worldPos, ref this.leftDir, this.radius);

        if ((lhs - rhs).sqrMagnitudeLong2D <= (long)num8)
        {
            return(true);
        }
        lhs = VCollisionCylinderSector.ClosestPoint(ref rhs, ref this.worldPos, ref this.rightDir, this.radius);
        if ((lhs - rhs).sqrMagnitudeLong2D <= (long)num8)
        {
            return(true);
        }
        if (this.degree <= 180)
        {
            if (VCollisionCylinderSector.CalcSide(ref rhs, ref this.worldPos, ref this.leftDir) <= 0 && VCollisionCylinderSector.CalcSide(ref rhs, ref this.worldPos, ref this.rightDir) >= 0)
            {
                return(true);
            }
        }
        else if (VCollisionCylinderSector.CalcSide(ref rhs, ref this.worldPos, ref this.leftDir) <= 0 || VCollisionCylinderSector.CalcSide(ref rhs, ref this.worldPos, ref this.rightDir) >= 0)
        {
            return(true);
        }
        return(false);
    }
Esempio n. 3
0
    public override bool EdgeIntersects(VCollisionSphere s)
    {
        base.ConditionalUpdateShape();
        s.ConditionalUpdateShape();
        long  num  = this.worldRadius + s.worldRadius;
        long  num2 = this.worldRadius - s.worldRadius;
        VInt3 num4 = this.worldPos - s.worldPos;
        long  num3 = num4.sqrMagnitudeLong2D;

        return((num3 <= (num * num)) && (num3 >= (num2 * num2)));
    }
        private void CreateEye(SkillUseContext skillContext)
        {
            if (this.actorRoot && this.bEyeObj)
            {
                this.actorRoot.handle.ObjLinker.CanMovable = false;
                Singleton <GameObjMgr> .instance.AddActor(this.actorRoot);

                EyeWrapper eyeWrapper = this.actorRoot.handle.ActorControl as EyeWrapper;
                if (eyeWrapper != null)
                {
                    int num = 0;
                    if (skillContext.Originator)
                    {
                        SkillSlot skillSlot = skillContext.Originator.handle.SkillControl.GetSkillSlot(skillContext.SlotType);
                        if (skillSlot != null)
                        {
                            int skillLevel = skillSlot.GetSkillLevel();
                            num = Mathf.Max(skillLevel - 1, 0);
                        }
                    }
                    int num2 = this.EyeLifeTime;
                    num2 += this.EyeLiftTimeGrowth * num;
                    if (num2 < 0)
                    {
                        num2 = 0;
                    }
                    eyeWrapper.LifeTime = num2;
                    eyeWrapper.SetPerishTime(this.EyePerishAdvTime);
                    if (this.actorRoot.handle.HorizonMarker != null)
                    {
                        int num3 = this.sightRadius;
                        num3 += this.SightRadiusGrowth * num;
                        if (num3 < 0)
                        {
                            num3 = 0;
                        }
                        this.actorRoot.handle.HorizonMarker.SightRadius = num3;
                    }
                    if (this.actorRoot.handle.SMNode != null)
                    {
                        VCollisionSphere vCollisionSphere = new VCollisionSphere();
                        vCollisionSphere.Born(this.actorRoot);
                        vCollisionSphere.Pos    = VInt3.zero;
                        vCollisionSphere.Radius = 500;
                        vCollisionSphere.dirty  = true;
                        vCollisionSphere.ConditionalUpdateShape();
                        this.actorRoot.handle.SMNode.Attach();
                    }
                }
            }
        }
    public override bool Intersects(VCollisionSphere s)
    {
        base.ConditionalUpdateShape();
        s.ConditionalUpdateShape();
        this._tempRadius = (long)(this.worldRadius + s.WorldRadius);
        this._tempDist   = this.worldPos - s.WorldPos;
        if (this._tempDist.sqrMagnitudeLong > this._tempRadius * this._tempRadius)
        {
            return(false);
        }
        VInt3 vInt = s.WorldPos;
        long  num  = (long)s.WorldRadius;
        VInt3 rhs  = this.ClosestPoint(vInt);

        return((vInt - rhs).sqrMagnitudeLong <= num * num);
    }
Esempio n. 6
0
    public override bool Intersects(VCollisionSphere s)
    {
        base.ConditionalUpdateShape();
        s.ConditionalUpdateShape();
        this._tempRadius = this.worldRadius + s.WorldRadius;
        this._tempDist   = this.worldPos - s.WorldPos;
        if (this._tempDist.sqrMagnitudeLong > (this._tempRadius * this._tempRadius))
        {
            return(false);
        }
        VInt3 worldPos    = s.WorldPos;
        long  worldRadius = s.WorldRadius;
        VInt3 num3        = this.ClosestPoint(worldPos);
        VInt3 num4        = worldPos - num3;

        return(num4.sqrMagnitudeLong <= (worldRadius * worldRadius));
    }
Esempio n. 7
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);
    }
Esempio n. 8
0
    public static VCollisionShape createFromCollider(GameObject gameObject)
    {
        DebugHelper.Assert((!Singleton <BattleLogic> .instance.isFighting || Singleton <GameLogic> .instance.bInLogicTick) || Singleton <FrameSynchr> .instance.isCmdExecuting);
        Collider collider = (gameObject.GetComponent <Collider>() == null) ? null : gameObject.GetComponent <Collider>();

        if (collider == null)
        {
            return(null);
        }
        VCollisionShape shape = null;

        if (collider is BoxCollider)
        {
            BoxCollider collider2 = collider as BoxCollider;
            return(new VCollisionBox {
                Pos = (VInt3)collider2.center, Size = (VInt3)collider2.size
            });
        }
        if (collider is CapsuleCollider)
        {
            CapsuleCollider  collider3 = collider as CapsuleCollider;
            VCollisionSphere sphere    = new VCollisionSphere();
            Vector3          center    = collider3.center;
            center.y  -= collider3.height * 0.5f;
            sphere.Pos = (VInt3)center;
            VInt radius = (VInt)collider3.radius;
            sphere.Radius = radius.i;
            return(sphere);
        }
        if (collider is SphereCollider)
        {
            SphereCollider   collider4 = collider as SphereCollider;
            VCollisionSphere sphere2   = new VCollisionSphere {
                Pos = (VInt3)collider4.center
            };
            VInt num2 = (VInt)collider4.radius;
            sphere2.Radius = num2.i;
            shape          = sphere2;
        }
        return(shape);
    }
        private void CreateEye(COM_PLAYERCAMP _camp)
        {
            if ((this.actorRoot != 0) && (this.sightRadius > 0))
            {
                this.actorRoot.handle.TheActorMeta.ActorCamp = _camp;
                if (this.actorRoot.handle.HorizonMarker != null)
                {
                    this.actorRoot.handle.HorizonMarker.SightRadius = this.sightRadius;
                }
                this.actorRoot.handle.ObjID = Singleton <GameObjMgr> .GetInstance().NewActorID;

                this.actorRoot.handle.ObjLinker.Invincible = true;
                Singleton <GameObjMgr> .instance.AddActor(this.actorRoot);

                VCollisionSphere sphere = new VCollisionSphere();
                sphere.Born((ActorRoot)this.actorRoot);
                sphere.Pos    = VInt3.zero;
                sphere.Radius = 500;
                sphere.dirty  = true;
                sphere.ConditionalUpdateShape();
            }
        }
Esempio n. 10
0
    public VCollisionShape CreateShape()
    {
        DebugHelper.Assert(!Singleton <BattleLogic> .get_instance().isFighting || Singleton <GameLogic> .get_instance().bInLogicTick || Singleton <FrameSynchr> .get_instance().isCmdExecuting);
        VCollisionShape result = null;

        switch (this.shapeType)
        {
        case CollisionShapeType.Box:
            result = new VCollisionBox
            {
                Size = this.Size,
                Pos  = this.Pos
            };
            break;

        case CollisionShapeType.Sphere:
            result = new VCollisionSphere
            {
                Pos    = this.Pos,
                Radius = this.Size.x
            };
            break;

        case CollisionShapeType.CylinderSector:
        {
            VCollisionCylinderSector vCollisionCylinderSector = new VCollisionCylinderSector();
            vCollisionCylinderSector.Pos      = this.Pos;
            vCollisionCylinderSector.Radius   = this.Size.x;
            vCollisionCylinderSector.Height   = this.Size.y;
            vCollisionCylinderSector.Degree   = this.Size.z;
            vCollisionCylinderSector.Rotation = this.Size2.x;
            break;
        }
        }
        return(result);
    }
Esempio n. 11
0
 public override void UpdateShape(VInt3 location, VInt3 forward)
 {
     VCollisionSphere.UpdatePosition(ref this.worldPos, ref this.localPos, ref location, ref forward);
     this.worldRadius = this.localRadius;
     this.dirty       = false;
 }
 public override bool EdgeIntersects(VCollisionSphere s)
 {
     return(this.Intersects(s));
 }
Esempio n. 13
0
 public abstract bool EdgeIntersects(VCollisionSphere s);
 public override bool EdgeIntersects(VCollisionSphere s)
 {
     return(false);
 }
        public override void Process(Action _action, Track _track)
        {
            this.actor = _action.GetActorHandle(this.targetId);
            if (!this.actor)
            {
                if (ActionManager.Instance.isPrintLog)
                {
                }
                return;
            }
            ActorRoot       handle         = this.actor.handle;
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            int             num            = 1;

            if (refParamObject != null && refParamObject.Originator)
            {
                SkillSlot skillSlot;
                refParamObject.Originator.handle.SkillControl.TryGetSkillSlot(refParamObject.SlotType, out skillSlot);
                if (skillSlot != null)
                {
                    num = skillSlot.GetSkillLevel();
                }
                BaseSkill refParamObject2 = _action.refParams.GetRefParamObject <BaseSkill>("SkillObj");
                if (refParamObject2 != null)
                {
                    BuffSkill buffSkill = refParamObject2.isBuff ? ((BuffSkill)refParamObject2) : null;
                    if (buffSkill != null)
                    {
                        byte b = buffSkill.cfgData.bGrowthType;
                        b %= 10;
                        if (b > 0 && (SkillSlotType)b != refParamObject.SlotType + 1)
                        {
                            SSkillFuncContext sSkillFuncContext = default(SSkillFuncContext);
                            sSkillFuncContext.inOriginator = refParamObject.Originator;
                            sSkillFuncContext.inBuffSkill  = new PoolObjHandle <BuffSkill>(buffSkill);
                            sSkillFuncContext.inTargetObj  = refParamObject.TargetActor;
                            sSkillFuncContext.inUseContext = refParamObject;
                            num = sSkillFuncContext.iSkillLevel;
                        }
                    }
                }
            }
            if (this.type == SetCollisionTick.ColliderType.Box)
            {
                VCollisionBox collisionShape = SetCollisionTick.GetCollisionShape <VCollisionBox>(handle, CollisionShapeType.Box);
                collisionShape.Pos   = this.Pos;
                collisionShape.Size  = this.Size + this.SizeGrowthValue * (num - 1);
                collisionShape.dirty = true;
                collisionShape.ConditionalUpdateShape();
            }
            else if (this.type == SetCollisionTick.ColliderType.Sphere)
            {
                VCollisionSphere collisionShape2 = SetCollisionTick.GetCollisionShape <VCollisionSphere>(handle, CollisionShapeType.Sphere);
                collisionShape2.Pos    = this.Pos;
                collisionShape2.Radius = this.Radius + this.RadiusGrowthValue * (num - 1);
                collisionShape2.dirty  = true;
                collisionShape2.ConditionalUpdateShape();
            }
            else if (this.type == SetCollisionTick.ColliderType.CylinderSector)
            {
                VCollisionCylinderSector collisionShape3 = SetCollisionTick.GetCollisionShape <VCollisionCylinderSector>(handle, CollisionShapeType.CylinderSector);
                collisionShape3.Pos      = this.Pos;
                collisionShape3.Radius   = this.SectorRadius + this.SectorRadiusGrow * (num - 1);
                collisionShape3.Height   = this.Height + this.HeightGrow * (num - 1);
                collisionShape3.Degree   = this.Degree + this.DegreeGrow * (num - 1);
                collisionShape3.Rotation = this.Rotation + this.RotationGrow * (num - 1);
                collisionShape3.dirty    = true;
                collisionShape3.ConditionalUpdateShape();
            }
        }