예제 #1
0
        public bool MoveVExact(int moveV, Collision onCollide = null, Solid pusher = null)
        {
            Vector2 position = this.transform.position;
            Vector2 vector2  = position + Vector2.down * (float)moveV;
            int     num1     = Math.Sign(moveV);
            int     num2     = 0;

            while ((uint)moveV > 0U)
            {
                Collider2D platform1 = ColliderUtil.OverlapBox(mCollider, Vector2.down, (float)num1, 0, Player.PLATFORM_MASK);
                if (platform1 != null)
                {
                    this.movementCounter.y = 0.0f;
                    if (onCollide != null)
                    {
                        onCollide(new CollisionData()
                        {
                            Direction      = Vector2.down * (float)num1,
                            Moved          = Vector2.down * (float)num2,
                            TargetPosition = vector2,
                            //Hit = platform1,
                            //Pusher = pusher
                        });
                    }
                    return(true);
                }
                num2  += num1;
                moveV -= num1;
                this.transform.position += Vector3.down * (float)num1;
            }
            return(false);
        }
예제 #2
0
        public bool MoveHExact(int moveH, Collision onCollide = null, Solid pusher = null)
        {
            Vector2 position       = this.transform.position;
            Vector2 targetPosition = position + Vector2.right * (float)moveH;
            int     num1           = Math.Sign(moveH);
            int     num2           = 0;

            while ((uint)moveH > 0U)
            {
                Collider2D platform1 = ColliderUtil.OverlapBox(mCollider, Vector2.right, (float)num1, 0, Player.PLATFORM_MASK);
                if (platform1 != null)
                {
                    //Debug.Log(mCollider.transform.position+"--"+ mCollider.size);
                    this.movementCounter.x = 0f;
                    bool flag2 = onCollide != null;
                    if (flag2)
                    {
                        onCollide(new CollisionData
                        {
                            Direction      = Vector2.right * (float)num1,
                            Moved          = Vector2.right * (float)num2,
                            TargetPosition = targetPosition,
                            //Hit = solid,
                            //Pusher = pusher
                        });
                    }
                    return(true);
                }
                num2  += num1;
                moveH -= num1;
                this.transform.position += Vector3.right * (float)num1;
            }
            return(false);
        }
예제 #3
0
 protected bool CollideCheck()
 {
     return(ColliderUtil.CollideCheck(mCollider, this.transform.position, PLATFORM_MASK));
 }
예제 #4
0
 protected bool CollideCheck(Vector2 poisition)
 {
     return(ColliderUtil.CollideCheck(mCollider, poisition, PLATFORM_MASK));
 }