Ejemplo n.º 1
0
        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.get_handle();
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            PoolObjHandle <ActorRoot> originator     = refParamObject.Originator;
            int num = 0;

            if (originator && refParamObject != null)
            {
                SkillComponent skillControl = originator.get_handle().SkillControl;
                SkillSlot      skillSlot;
                if (skillControl.TryGetSkillSlot(refParamObject.SlotType, out skillSlot) && skillSlot != null)
                {
                    num = skillSlot.GetSkillLevel() - 1;
                }
            }
            if (num < 0)
            {
                num = 0;
            }
            if (this.type == SetCollisionTick.ColliderType.Box)
            {
                VCollisionBox collisionShape = SetCollisionTick.GetCollisionShape <VCollisionBox>(handle, CollisionShapeType.Box);
                collisionShape.Pos   = this.Pos;
                collisionShape.Size  = new VInt3(this.Size.x + this.SizeGrowthValue.x * num, this.Size.y + this.SizeGrowthValue.y * num, this.Size.z + this.SizeGrowthValue.z * num);
                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;
                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;
                collisionShape3.Height   = this.Height;
                collisionShape3.Degree   = this.Degree;
                collisionShape3.Rotation = this.Rotation;
                collisionShape3.dirty    = true;
                collisionShape3.ConditionalUpdateShape();
            }
        }
Ejemplo n.º 2
0
    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);
    }
        public static bool VisitFowVisibilityCheck(VCollisionCylinderSector cylinder, PoolObjHandle <ActorRoot> inActor, COM_PLAYERCAMP inHostCamp, GameFowManager fowMgr)
        {
            VInt2 zero = VInt2.zero;

            fowMgr.WorldPosToGrid(new VInt3(cylinder.WorldPos.x, cylinder.WorldPos.z, 0), out zero.x, out zero.y);
            float num = (float)cylinder.Radius;

            num *= 0.001f;
            num *= num;
            Vector3 vector = (Vector3)cylinder.WorldPos;
            float   num2   = (float)cylinder.Degree;

            num2 *= 0.5f;
            num2  = Mathf.Cos(num2);
            Vector3  vector2   = (Vector3)cylinder.WorldPos;
            Vector3  vector3   = (Vector3)inActor.handle.forward;
            FieldObj pFieldObj = fowMgr.m_pFieldObj;
            int      num3      = 0;

            pFieldObj.UnrealToGridX(cylinder.Radius, out num3);
            int num4 = zero.x - num3;

            num4 = Math.Max(0, num4);
            int num5 = zero.x + num3;

            num5 = Math.Min(num5, pFieldObj.NumX - 1);
            int num6 = zero.y - num3;

            num6 = Math.Max(0, num6);
            int num7 = zero.y + num3;

            num7 = Math.Min(num7, pFieldObj.NumY - 1);
            for (int i = num4; i <= num5; i++)
            {
                for (int j = num6; j <= num7; j++)
                {
                    bool flag = Singleton <GameFowManager> .instance.IsVisible(i, j, inHostCamp);

                    if (flag && GameFowCollector.IsPointInCircularSector2(vector.x, vector.z, vector3.x, vector3.z, num, num2, vector2.x, vector2.z))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 4
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);
    }
Ejemplo n.º 5
0
 public override bool Intersects(VCollisionCylinderSector cs)
 {
     return(cs.Intersects(this));
 }
Ejemplo n.º 6
0
 public override bool EdgeIntersects(VCollisionCylinderSector s)
 {
     return(false);
 }
Ejemplo n.º 7
0
 public abstract bool EdgeIntersects(VCollisionCylinderSector cs);
        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();
            }
        }