Пример #1
0
    public static void SetActiveState(string name)
    {
        //Debug.Log("Changing state to: " + name);

        SEventSystem.FireEvent(EventIDs.Lifecycle.StateChange, new PMEventArgs(name));
        currentState = name;

        int i = 0;

        foreach (Pieka pieka in piekas)
        {
            if (i >= piekasArray.Count)
            {
                piekasArray.Add(pieka);
            }
            else
            {
                piekasArray [i] = pieka;
            }
            i++;
        }


        for (i--; i >= 0; i--)
        {
            ((Pieka)piekasArray [i]).OnStateChange(name);
        }
    }
Пример #2
0
 void OnJointBreak2D(Joint2D brokenJoint)
 {
     if (brokenJoint is FixedJoint2D)
     {
         SEventSystem.FireEvent(EventNames.CAR_BRAKE);
         SEventSystem.FireEvent(EventNames.CAR_BRAKE_WITH_VELOCITY, new PMEventArgs(velocityInPrevFrame));
     }
 }
Пример #3
0
    public void OnPointerClick(PointerEventData eventData)
    {
        if (Event != null)
        {
            SEventSystem.FireEvent(Event.Event);
        }

        if (onClick != null)
        {
            onClick();
        }
    }
Пример #4
0
 private void rotateAndbroadcast()
 {
     rotate();
     if (onIsPressed != null)
     {
         onIsPressed(Value);
     }
     if (Event != null)
     {
         SEventSystem.FireEvent(Event.Event, new PMEventArgs(Value));
     }
 }
Пример #5
0
    public void Reset()
    {
        foreach (var resetable in resetables)
        {
            resetable.Reset();
        }

        if (Event != null)
        {
            SEventSystem.FireEvent(Event.Event);
        }
    }
Пример #6
0
 private void toggle()
 {
     state = !state;
     if (onToggle != null)
     {
         onToggle();
     }
     if (state && OnEvent != null)
     {
         SEventSystem.FireEvent(OnEvent.Event);
     }
     if (!state && OffEvent != null)
     {
         SEventSystem.FireEvent(OffEvent.Event);
     }
     setColor(state);
 }
Пример #7
0
    void Awake()
    {
        var levelData = Piekson.FromJson <LevelDto>(Level.Json);

        spawnSprites(levelData);
        spawnSpriteShapes(levelData);
        var carWasSpawned = spawnPrefabs(levelData);

        if (carWasSpawned)
        {
            SEventSystem.FireEvent(EventNames.LEVEL_INSTANTIATED);
        }
        else
        {
            Debug.Log("Car was not instantiated!");
        }
    }
Пример #8
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));
             }
         }
     }
 }
Пример #9
0
 void fireEvent()
 {
     SEventSystem.FireEvent(eventId);
 }
Пример #10
0
 private void Start()
 {
     SEventSystem.FireEvent(EventNames.LEVEL_INSTANTIATED);
 }
Пример #11
0
 protected void FireEvent(string id, PMEventArgs args)
 {
     SEventSystem.FireEvent(id, args);
 }
Пример #12
0
 protected void FireEvent(string id)
 {
     SEventSystem.FireEvent(id);
 }