MOD!
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
using System.Linq;
|
||||
using Assets.PixelFantasy.Common.Scripts.CollectionScripts;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.PixelFantasy.Common.Scripts.CharacterScripts
|
||||
{
|
||||
public abstract class CharacterBuilderBase : MonoBehaviour
|
||||
{
|
||||
public SpriteCollection SpriteCollection;
|
||||
public string Head = "Human";
|
||||
public string Ears = "Human";
|
||||
public string Eyes = "Human";
|
||||
public string Body = "Human";
|
||||
public string Hair;
|
||||
public string Armor;
|
||||
public string Helmet;
|
||||
public string Weapon;
|
||||
public string Firearm;
|
||||
public string Shield;
|
||||
public string Cape;
|
||||
public string Back;
|
||||
public string Mask;
|
||||
public string Horns;
|
||||
|
||||
public Texture2D Texture { get; protected set; }
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
public abstract void Rebuild(bool forceMerge = false);
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Head = Ears = Eyes = Body = Hair = Armor = Helmet = Weapon = Firearm = Shield = Cape = Back = Mask = Horns = "";
|
||||
Head = "Human";
|
||||
Ears = "Human";
|
||||
Eyes = "Human";
|
||||
Body = "Human";
|
||||
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
public void Randomize()
|
||||
{
|
||||
Eyes = Randomize("Eyes");
|
||||
Helmet = Randomize("Helmet", 20);
|
||||
Armor = Randomize("Armor", 20);
|
||||
Weapon = Randomize("Weapon");
|
||||
Shield = Randomize("Shield", 50);
|
||||
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
private string Randomize(string part, int emptyChance = 0)
|
||||
{
|
||||
var options = SpriteCollection.Layers.Single(i => i.Name == part).Textures;
|
||||
|
||||
if (Random.Range(0, 100) < emptyChance && Random.Range(0, options.Count + 1) == 0) return "";
|
||||
|
||||
return options[Random.Range(0, options.Count)].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 458285bdd5777e74683cec519cf7a1f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 250116
|
||||
packageName: Pixel Hero Maker
|
||||
packageVersion: 3.4
|
||||
assetPath: Assets/OtherPlugins/PixelFantasy/Common/Scripts/CharacterScripts/CharacterBuilderBase.cs
|
||||
uploadId: 777185
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.U2D.Animation;
|
||||
|
||||
namespace Assets.PixelFantasy.Common.Scripts.CharacterScripts
|
||||
{
|
||||
public class SpriteLibraryAssetDumper : MonoBehaviour
|
||||
{
|
||||
public string Output;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
var spriteLibraryAsset = GetComponentInChildren<SpriteLibrary>().spriteLibraryAsset;
|
||||
var categoryNames = spriteLibraryAsset.GetCategoryNames();
|
||||
var data = new Dictionary<string, int[]>();
|
||||
|
||||
foreach (var category in categoryNames)
|
||||
{
|
||||
var labels = spriteLibraryAsset.GetCategoryLabelNames(category);
|
||||
|
||||
foreach (var label in labels)
|
||||
{
|
||||
var sprite = spriteLibraryAsset.GetSprite(category, label);
|
||||
|
||||
data.Add(category + "_" + label, new[] { (int)sprite.rect.x, (int)sprite.rect.y, (int)sprite.rect.width, (int)sprite.rect.height, (int)sprite.pivot.x, (int)sprite.pivot.y });
|
||||
}
|
||||
}
|
||||
|
||||
Output = $"new() {{ {string.Join(',', data.Select(i => $"{{ \"{i.Key}\", new[] {{ {string.Join(',', i.Value)} }} }}"))} }};";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a77b73af12857f4e96b95882bf4754c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 250116
|
||||
packageName: Pixel Hero Maker
|
||||
packageVersion: 3.4
|
||||
assetPath: Assets/OtherPlugins/PixelFantasy/Common/Scripts/CharacterScripts/SpriteLibraryAssetDumper.cs
|
||||
uploadId: 777185
|
||||
Reference in New Issue
Block a user