Beispiel #1
0
    // Initialize function
    public void Init(int objectCount)
    {
        activeDirection             = Direction.Center;
        objectSpawnIndex            = new List <int> [(int)Direction.Count];
        objectTypeSpawnIndex        = new int[(int)Direction.Count][];
        lastLocalIndex              = new int[(int)Direction.Count][];
        lastObjectTypeSpawnDistance = new float[(int)Direction.Count][];
        lastObjectSpawnDistance     = new List <float> [(int)Direction.Count];

        objectDirectionAngle = new float[(int)Direction.Count];

        totalDistance      = new float[(int)Direction.Count];
        totalSceneDistance = new float[(int)Direction.Count];

        platformDistanceDataMap = new PlatformDistanceDataMap[(int)Direction.Count];

        topPlatformObjectSpawned    = new BasicObject[(int)Direction.Count];
        bottomPlatformObjectSpawned = new BasicObject[(int)Direction.Count];
        topSceneObjectSpawned       = new BasicObject[(int)Direction.Count];
        bottomSceneObjectSpawned    = new BasicObject[(int)Direction.Count];

        previousPlatformSection          = new int[(int)Direction.Count];
        previousSceneSection             = new int[(int)Direction.Count];
        spawnedPlatformSectionTransition = new bool[(int)Direction.Count];
        spawnedSceneSectionTransition    = new bool[(int)Direction.Count];

        for (int i = 0; i < (int)Direction.Count; ++i)
        {
            objectSpawnIndex[i]            = new List <int>();
            objectTypeSpawnIndex[i]        = new int[(int)ObjectType.Count];
            lastLocalIndex[i]              = new int[(int)ObjectType.Count];
            lastObjectTypeSpawnDistance[i] = new float[(int)ObjectType.Count];

            lastObjectSpawnDistance[i] = new List <float>();

            platformDistanceDataMap[i] = new PlatformDistanceDataMap();

            for (int j = 0; j < objectCount; ++j)
            {
                objectSpawnIndex[i].Add(-1);
                lastObjectSpawnDistance[i].Add(0);
            }
            for (int j = 0; j < (int)ObjectType.Count; ++j)
            {
                objectTypeSpawnIndex[i][j]        = -1;
                lastLocalIndex[i][j]              = -1;
                lastObjectTypeSpawnDistance[i][j] = -1;
            }
        }
    }
    public void init(int objectCount)
    {
        activeObjectLocation = ObjectLocation.Center;
        objectSpawnIndex = new List<int>[(int)ObjectLocation.Last];
        objectTypeSpawnIndex = new int[(int)ObjectLocation.Last][];
        lastLocalIndex = new int[(int)ObjectLocation.Last][];
        latestObjectTypeSpawnDistance = new float[(int)ObjectLocation.Last][];
        lastObjectSpawnDistance = new List<float>[(int)ObjectLocation.Last];

        objectLocationAngle = new float[(int)ObjectLocation.Last];

        totalDistance = new float[(int)ObjectLocation.Last];
        totalSceneDistance = new float[(int)ObjectLocation.Last];

        platformDistanceDataMap = new PlatformDistanceDataMap[(int)ObjectLocation.Last];

        topPlatformObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
        bottomPlatformObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
        topSceneObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];
        bottomSceneObjectSpawned = new InfiniteObject[(int)ObjectLocation.Last];

        previousPlatformSection = new int[(int)ObjectLocation.Last];
        previousSceneSection = new int[(int)ObjectLocation.Last];
        spawnedPlatformSectionTransition = new bool[(int)ObjectLocation.Last];
        spawnedSceneSectionTransition = new bool[(int)ObjectLocation.Last];

        for (int i = 0; i < (int)ObjectLocation.Last; ++i) {
            objectSpawnIndex[i] = new List<int>();
            objectTypeSpawnIndex[i] = new int[(int)ObjectType.Last];
            lastLocalIndex[i] = new int[(int)ObjectType.Last];
            latestObjectTypeSpawnDistance[i] = new float[(int)ObjectType.Last];

            lastObjectSpawnDistance[i] = new List<float>();

            platformDistanceDataMap[i] = new PlatformDistanceDataMap();

            for (int j = 0; j < objectCount; ++j) {
                objectSpawnIndex[i].Add(-1);
                lastObjectSpawnDistance[i].Add(0);
            }
            for (int j = 0; j < (int)ObjectType.Last; ++j) {
                objectTypeSpawnIndex[i][j] = -1;
                lastLocalIndex[i][j] = -1;
                latestObjectTypeSpawnDistance[i][j] = -1;
            }
        }

        infiniteObjectManager = InfiniteObjectManager.instance;
    }
Beispiel #3
0
 // Copy from another PlatformDistanceDataMap object
 public void CopyFrom(PlatformDistanceDataMap other)
 {
     distances    = other.distances.GetRange(0, other.distances.Count);
     localIndexes = other.localIndexes.GetRange(0, other.localIndexes.Count);
     sections     = other.sections.GetRange(0, other.sections.Count);
 }