AcademyPopcorn.UnstoppableBall.RespondToCollision C# (CSharp) Method

RespondToCollision() public method

public RespondToCollision ( CollisionData collisionData ) : void
collisionData CollisionData
return void
        public override void RespondToCollision(CollisionData collisionData)
        {
            for (int i = 0; i < collisionData.hitObjectsCollisionGroupStrings.Count; i++)
            {
                if (collisionData.hitObjectsCollisionGroupStrings[i] == "unpassableBlock" || 
                    collisionData.hitObjectsCollisionGroupStrings[i] == "racket" ||
                    collisionData.hitObjectsCollisionGroupStrings[i] == "indestructibleBlock")
                {
                    if (collisionData.CollisionForceDirection.Row * this.Speed.Row < 0)
                    {
                        this.Speed.Row *= -1;
                    }
                    if (collisionData.CollisionForceDirection.Col * this.Speed.Col < 0)
                    {
                        this.Speed.Col *= -1;
                    }
                }
            }
        }