Copie depuis Unity VCS vers GitHub

This commit is contained in:
Denis L.
2025-12-10 18:51:40 +01:00
parent 5cfd9de581
commit 7383621db3
902 changed files with 588195 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
using System;
using System.Linq;
using CharacterCustomizationTool.Editor.Character;
using CharacterCustomizationTool.Editor.Randomizer.Steps;
using CharacterCustomizationTool.Editor.Randomizer.Steps.Impl;
namespace CharacterCustomizationTool.Editor.Randomizer
{
public class RandomCharacterGenerator
{
private readonly IRandomizerStep[] _randomizerSteps =
{
new FaceStep(),
new BodyStep(),
new CostumesStep(),
new MascotsStep(),
new OutfitStep(),
new OutwearStep(),
new PantsStep(),
new ShortsStep(),
new SocksStep(),
new HatStep(),
new HatSingleStep(),
new FaceAccessoriesStep(),
new GlassesStep(),
new ShoesStep(),
new HairstyleSingleStep(),
new HairstyleStep(),
new GlovesStep(),
};
public void Randomize(CustomizableCharacter character)
{
character.ToDefault();
var groups = Enum.GetValues(typeof(GroupType)).Cast<GroupType>().ToArray();
foreach (var step in _randomizerSteps)
{
var variantsCount = character.GetVariantsCountInGroup(step.GroupType);
var stepResult = step.Process(variantsCount, groups);
groups = stepResult.AvailableGroups;
character.PickGroup(step.GroupType, stepResult.Index, stepResult.IsActive);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 90f894f9feef4ac9997c9a681333e648
timeCreated: 1736350992
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/RandomCharacterGenerator.cs
uploadId: 780839

View File

@@ -0,0 +1,16 @@
namespace CharacterCustomizationTool.Editor.Randomizer
{
public class StepResult
{
public int Index { get; }
public bool IsActive { get; }
public GroupType[] AvailableGroups { get; }
public StepResult(int index, bool isActive, GroupType[] availableGroups)
{
Index = index;
IsActive = isActive;
AvailableGroups = availableGroups;
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cd07b1e4f88a4af696f5614472c15f13
timeCreated: 1736972446
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/StepResult.cs
uploadId: 780839

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 13350f8e69d34f0ab019a0b7ce981866
timeCreated: 1736674860

View File

@@ -0,0 +1,9 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps
{
public interface IRandomizerStep
{
GroupType GroupType { get; }
StepResult Process(int count, GroupType[] groups);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c471afe9dd44d074f99841183c4cf278
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/IRandomizerStep.cs
uploadId: 780839

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fe8f5cfcc1874a58b1af97c477b086f4
timeCreated: 1736674865

View File

@@ -0,0 +1,17 @@
using System.Linq;
using UnityEngine;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class BodyStep : IRandomizerStep
{
public GroupType GroupType => GroupType.Body;
public StepResult Process(int count, GroupType[] groups)
{
var newGroups = groups.Where(g => g != GroupType.Body).ToArray();
return new StepResult(Random.Range(0, count), true, newGroups);
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: da95423e69334f7e96f7fe9f3db0ef5f
timeCreated: 1736599151
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/BodyStep.cs
uploadId: 780839

View File

@@ -0,0 +1,22 @@
using System;
using Random = UnityEngine.Random;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class CostumesStep : StepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Costumes;
protected override float Probability => .2f;
public override StepResult Process(int count, GroupType[] groups)
{
if (Random.value > Probability)
{
return new StepResult(0, false, RemoveSelf(groups));
}
return new StepResult(Random.Range(0, count), true, Array.Empty<GroupType>());
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f1cd3103d9d741ff9aed903f55545928
timeCreated: 1736674915
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/CostumesStep.cs
uploadId: 780839

View File

@@ -0,0 +1,16 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class FaceAccessoriesStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.FaceAccessories;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Glasses,
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f44888e8146b4a57b11907b4ef3f6d22
timeCreated: 1736681858
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/FaceAccessoriesStep.cs
uploadId: 780839

View File

@@ -0,0 +1,17 @@
using System.Linq;
using UnityEngine;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class FaceStep : IRandomizerStep
{
public GroupType GroupType => GroupType.Faces;
public StepResult Process(int count, GroupType[] groups)
{
var newGroups = groups.Where(g => g != GroupType.Faces).ToArray();
return new StepResult(Random.Range(0, count), true, newGroups);
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9d3b7299fb554507b6a7aa4398dd60db
timeCreated: 1736350792
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/FaceStep.cs
uploadId: 780839

View File

@@ -0,0 +1,15 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class GlassesStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Glasses;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 42b88327cc4b4059a9900d7451f2b1ad
timeCreated: 1736681911
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/GlassesStep.cs
uploadId: 780839

View File

@@ -0,0 +1,11 @@
using System;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class GlovesStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Gloves;
protected override GroupType[] CompatibleGroups => Array.Empty<GroupType>();
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 369aa049cb934312955bdfbcbfb0cf6c
timeCreated: 1736682133
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/GlovesStep.cs
uploadId: 780839

View File

@@ -0,0 +1,12 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class HairstyleSingleStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.HairstyleSingle;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4dbf3a338f2e4959976c21ad98480d91
timeCreated: 1736682038
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/HairstyleSingleStep.cs
uploadId: 780839

View File

@@ -0,0 +1,12 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class HairstyleStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Hairstyle;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: bd5070c46d6e4eba9378623e5ab9b2b0
timeCreated: 1736682092
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/HairstyleStep.cs
uploadId: 780839

View File

@@ -0,0 +1,14 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class HatSingleStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.HatSingle;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.FaceAccessories,
GroupType.Shoes,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7b225042b1974444979dbc9e3040da4a
timeCreated: 1736681763
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/HatSingleStep.cs
uploadId: 780839

View File

@@ -0,0 +1,15 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class HatStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Hat;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 030380cece0448e394e70c7c7022f2a8
timeCreated: 1736681665
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/HatStep.cs
uploadId: 780839

View File

@@ -0,0 +1,17 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class MascotsStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Mascots;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Pants,
GroupType.Shorts,
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 793ebe74e68a4bf0afaa3eb68e2387c9
timeCreated: 1736676749
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/MascotsStep.cs
uploadId: 780839

View File

@@ -0,0 +1,19 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class OutfitStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Outfit;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Hat,
GroupType.HatSingle,
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a9f1c016b047465b971475eddd6d9e6f
timeCreated: 1736677982
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/OutfitStep.cs
uploadId: 780839

View File

@@ -0,0 +1,21 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class OutwearStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Outwear;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Pants,
GroupType.Shorts,
GroupType.Hat,
GroupType.HatSingle,
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 74f9991652aa46348c881d0e7908b073
timeCreated: 1736678464
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/OutwearStep.cs
uploadId: 780839

View File

@@ -0,0 +1,19 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class PantsStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Pants;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Hat,
GroupType.HatSingle,
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2967f0c46bdd4c818e3a8a951b2652a2
timeCreated: 1736678855
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/PantsStep.cs
uploadId: 780839

View File

@@ -0,0 +1,14 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class ShoesStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Shoes;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 10cfdcedf32c4647a6b2f6c62d9529c4
timeCreated: 1736681964
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/ShoesStep.cs
uploadId: 780839

View File

@@ -0,0 +1,39 @@
using System.Linq;
using UnityEngine;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class ShortsStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Shorts;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Hat,
GroupType.HatSingle,
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
public override StepResult Process(int count, GroupType[] groups)
{
var cannotProcess = !groups.Contains(GroupType);
groups = RemoveSelf(groups);
if (cannotProcess || Random.value > Probability)
{
return new StepResult(0, false, groups);
}
var newGroups = groups.Where(g => CompatibleGroups.Contains(g)).ToArray();
var finalGroups = newGroups.ToList();
finalGroups.Add(GroupType.Socks);
return new StepResult(Random.Range(0, count), true, finalGroups.ToArray());
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2b73523352e7483bbe87c1ebc732a1ff
timeCreated: 1736679843
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/ShortsStep.cs
uploadId: 780839

View File

@@ -0,0 +1,25 @@
using System.Linq;
using UnityEngine;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public abstract class SlotStepBase : StepBase, IRandomizerStep
{
protected abstract GroupType[] CompatibleGroups { get; }
public override StepResult Process(int count, GroupType[] groups)
{
var cannotProcess = !groups.Contains(GroupType);
groups = RemoveSelf(groups);
if (cannotProcess || Random.value > Probability)
{
return new StepResult(0, false, groups);
}
var newGroups = groups.Where(g => CompatibleGroups.Contains(g)).ToArray();
return new StepResult(Random.Range(0, count), true, newGroups);
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c680eeb9d4824f80853cbb97cd228aab
timeCreated: 1736678645
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/SlotStepBase.cs
uploadId: 780839

View File

@@ -0,0 +1,21 @@
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public class SocksStep : SlotStepBase, IRandomizerStep
{
public override GroupType GroupType => GroupType.Socks;
protected override float Probability => .5f;
protected override GroupType[] CompatibleGroups => new[]
{
GroupType.Hat,
GroupType.HatSingle,
GroupType.FaceAccessories,
GroupType.Glasses,
GroupType.Shoes,
GroupType.HairstyleSingle,
GroupType.Hairstyle,
GroupType.Gloves,
};
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 246406a9e2694ee199d27d33b1a5abd2
timeCreated: 1736681519
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/SocksStep.cs
uploadId: 780839

View File

@@ -0,0 +1,18 @@
using System.Linq;
namespace CharacterCustomizationTool.Editor.Randomizer.Steps.Impl
{
public abstract class StepBase : IRandomizerStep
{
public abstract GroupType GroupType { get; }
protected virtual float Probability => .35f;
public abstract StepResult Process(int count, GroupType[] groups);
protected GroupType[] RemoveSelf(GroupType[] groups)
{
return groups.Where(g => g != GroupType).ToArray();
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3e2f5ffd08ce455b937d13c7d07ece65
timeCreated: 1736685991
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/Randomizer/Steps/Impl/StepBase.cs
uploadId: 780839