Ejemplo n.º 1
0
 public BurnInfo(WhichWheelEnum whichWheel, DirectionEnum direction, Vector2 point, float power, GameObject otherGameObject, PiekaMaterial wheelMaterial)
 {
     WhichWheel      = whichWheel;
     Direction       = direction;
     Point           = point;
     Power           = power;
     OtherGameObject = otherGameObject;
     WheelMaterial   = wheelMaterial;
 }
Ejemplo n.º 2
0
 private void handleBurn(Collider2D wheelCollider, SpriteRenderer spriteRenderer, BurnInfo.WhichWheelEnum whichWheel, BurnInfo.DirectionEnum direction, float wheelKmPerH, float velocityInKmPerH, ContactPoint2D[] burnContacts, PiekaMaterial piekaMaterial)
 {
     if (wheelCollider.IsTouchingLayers(Consts.FloorLayerMask))
     {
         var carSpeedPlusAcceptableDifference = velocityInKmPerH + AcceptableSpeedDifference;
         var wheelSpeed = wheelKmPerH;
         if (wheelSpeed > carSpeedPlusAcceptableDifference)
         {
             var filter = new ContactFilter2D();
             filter.layerMask = Consts.FloorLayerMask;
             var numberOfContacts = wheelCollider.GetContacts(filter, burnContacts);
             for (int i = 0; i < numberOfContacts; i++)
             {
                 SEventSystem.FireEvent(EventNames.TEST);
                 var gameObject = burnContacts[i].collider.gameObject;
                 var point      = burnContacts[i].point;
                 var power      = Mathf.Clamp((wheelSpeed - carSpeedPlusAcceptableDifference) / BurnSpeedRange, 0, 1);
                 var burnInfo   = new BurnInfo(whichWheel, direction, point, power, gameObject, piekaMaterial);
                 SEventSystem.FireEvent(EventNames.WHEEL_BURN, new PMEventArgs(burnInfo));
             }
         }
     }
 }