コード例 #1
0
ファイル: GrabLevel.cs プロジェクト: hilvi/MimmitAndroid
    public FallingObjectSettings[] GetFallingObjects()
    {
        FallingObjectSettings[] fallingObjects = new FallingObjectSettings[numberOfCollectable+numberOfAvoidable];

        Texture2D[] collectableObjects = _objects.collectable;
        Texture2D[] avoidableObjects = _objects.avoidable;

        _ShuffleObjects(ref collectableObjects);
        _ShuffleObjects(ref avoidableObjects);

        int id = 0;

        for(int i = 0; i < collectableObjects.Length && i < numberOfCollectable; i++, id++) {
            FallingObjectSettings fallingObject = _CreateObject();

            fallingObject.numberToCollect = numberToCollect;
            fallingObject.texture = collectableObjects[i];
            fallingObject.collect = true;

            fallingObjects[id] = fallingObject;
        }

        for(int i = 0; i < avoidableObjects.Length && i < numberOfAvoidable; i++, id++) {
            FallingObjectSettings fallingObject = _CreateObject();

            fallingObject.texture = avoidableObjects[i];
            fallingObject.numberToCollect = 1;
            fallingObject.collect = false;

            fallingObjects[id] = fallingObject;
        }

        return fallingObjects;
    }
コード例 #2
0
ファイル: GrabLevel.cs プロジェクト: hilvi/MimmitAndroid
    FallingObjectSettings _CreateObject()
    {
        FallingObjectSettings fallingObject = new FallingObjectSettings();

        fallingObject.maxSpeed = maxSpeed;
        fallingObject.minSpeed = minSpeed;
        fallingObject.maxOscillationAmplitude = maxOscillation;
        fallingObject.minOscillationAmplitude = minOscillation;

        return fallingObject;
    }