Exemple #1
0
 protected override void Execute(List <GameEntity> entities)
 {
     foreach (var entity in entities)
     {
         CreatePositiveItemService.CreateRandomPositiveItem(entity.gridPosition.value);
     }
 }
Exemple #2
0
    private void CreatePositiveItem(int touchedCubeId)
    {
        var touchedCube = _contexts.game.GetEntityWithId(touchedCubeId);

        Debug.Assert(touchedCube != null);

        var matchCount  = touchedCube.matchGroup.Count;
        var pos         = touchedCube.gridPosition.value;
        var color       = touchedCube.color.Value;
        var posItemType = CreatePositiveItemService.PositiveItem.Rotor;

        if (matchCount >= 9)
        {
            posItemType = CreatePositiveItemService.PositiveItem.Puzzle;
        }
        else if (matchCount >= 7)
        {
            posItemType = CreatePositiveItemService.PositiveItem.Tnt;
        }
        else if (matchCount >= 5)
        {
            posItemType = CreatePositiveItemService.PositiveItem.Rotor;
        }

        var id      = CreatePositiveItemService.CreatePositiveItem(posItemType, pos, color);
        var posItem = _contexts.game.GetEntityWithId(id);

        posItem.isCreatedFromMatch = true;
    }