Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
        /* Last three are to override the "don't clip into walls" feature. */
        public override void ResolveCollision(RigidCollisionResponse other)
        {
            // Just overriding

            BladeTrapMovement btMovement = entity.GetComponent <BladeTrapMovement>();

            btMovement.ReverseDirection();
        }
Exemplo n.º 3
0
        public override void ResolveCollision(BladeTrapCollisionResponse other)
        {
            BladeTrapMovement btMovement = entity.GetComponent <BladeTrapMovement>();

            if (entity.GetComponent <BladeTrapMovement>().state == BladeTrapMovement.State.EXTENDING)
            {
                btMovement.ReverseDirection();
            }
        }
Exemplo n.º 4
0
 void Start()
 {
     btm1 = bt1.GetComponent <BladeTrapMovement>();
     btm2 = bt2.GetComponent <BladeTrapMovement>();
 }