Пример #1
0
        public override void ResolveCollision(WallCollisionResponse other)
        {
            // Console.WriteLine("BladeTrap detected wall collision!");
            BladeTrapMovement btMovement = entity.GetComponent <BladeTrapMovement>();

            // If this isn't a collision with one of the far walls, get out
            // Top-Left Blade Trap colliding with top or left walls
            if (entity.GetComponent <BladeTrapMovement>().homePos.X < 400 && entity.GetComponent <BladeTrapMovement>().homePos.Y < 400 &&
                (other.entity.GetComponent <Transform>().position.Y < 400 || other.entity.GetComponent <Transform>().position.X < 200))
            {
                return;
            }

            // Top-Right Blade Trap colliding with top or right walls
            if (entity.GetComponent <BladeTrapMovement>().homePos.X > 400 && entity.GetComponent <BladeTrapMovement>().homePos.Y < 400 &&
                (other.entity.GetComponent <Transform>().position.Y < 400 || other.entity.GetComponent <Transform>().position.X > 600))
            {
                return;
            }

            // I have ZERO clue why I only need to do it for the top two blade traps. I spent two hours debugging it. Don't ask.

            // Mandate it's currently extending and isn't colliding with the wall right next to homePos
            if (entity.GetComponent <BladeTrapMovement>().state == BladeTrapMovement.State.EXTENDING)
            // && Vector2.Distance(entity.GetComponent<BladeTrapMovement>().homePos, entity.GetComponent<Transform>().position) >= 5)
            {
                btMovement.ReverseDirection();
            }
        }
Пример #2
0
        public override void ResolveCollision(WallCollisionResponse other)
        {
            entity.GetComponent <Collider>().CollidingWithRigid = true;
            var transform = entity.GetComponent <Transform>();

            transform.position = transform.lastPosition;
        }
        public override void ResolveCollision(WallCollisionResponse other)
        {
            if (isProjectile)
            {
                Entity.Destroy(entity);
            }

            var transform = entity.GetComponent <Transform>();

            transform.position = transform.lastPosition;
        }
        public override void ResolveCollision(WallCollisionResponse other)
        {
            var transform = entity.GetComponent <Transform>();

            transform.position = transform.lastPosition;
        }
 public override void ResolveCollision(WallCollisionResponse other)
 {
     Entity.Destroy(entity);
 }
Пример #6
0
 public override void ResolveCollision(WallCollisionResponse other)
 {
     entity.GetComponent <Collider>().CollidingWithRigid = true;
 }