예제 #1
0
    public void RandomizeData()
    {
        int randomTruck = Random.Range(0, System.Enum.GetNames(typeof(GameEnums.Truck)).Length);

        truck.TruckData.truckType = (GameEnums.Truck)randomTruck;

        int randomFirePoint = EnemyHandler.RandomFirePointTypeFromComplexity();

        if (randomFirePoint < (int)GameEnums.FirePointType.D_FPType)
        {
            randomFirePoint = (int)GameEnums.FirePointType.D_FPType;
        }
        if (randomFirePoint > (int)GameEnums.FirePointType.DCMP_FPType)
        {
            randomFirePoint = (int)GameEnums.FirePointType.DCMP_FPType;
        }
        truck.TruckData.firePointType = (GameEnums.FirePointType)randomFirePoint;
        int[] gunDataTypes = EnemyHandler.PossibleGunDataTypesFromComplexity();
        for (int i = 0; i < truck.TruckData.firePointData.gunsConfigurations.Length; i++)
        {
            int randomGun     = Random.Range(1, System.Enum.GetNames(typeof(GameEnums.Gun)).Length);
            int randomGunData = Random.Range(0, gunDataTypes.Length);
            truck.TruckData.firePointData.gunsConfigurations[i].gunType     = (GameEnums.Gun)randomGun;
            truck.TruckData.firePointData.gunsConfigurations[i].gunDataType = (GameEnums.GunDataType)gunDataTypes[randomGunData];
        }
    }