This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Screenshot.cs | |
Copyright (c) 2016 Hassaku | |
This software is released under the MIT License. | |
http://opensource.org/licenses/mit-license.php | |
*/ | |
using UnityEngine; | |
using UnityEditor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
SequenceScreenshot.cs | |
Copyright (c) 2016 Hassaku | |
This software is released under the MIT License. | |
http://opensource.org/licenses/mit-license.php | |
*/ | |
using UnityEngine; | |
using UnityEditor; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[CreateAssetMenu(menuName = "ScriptableObject/Enemy", fileName = "NewEnemy")] | |
public class Enemy : ScriptableObject{ | |
public string Name; | |
public int Hp; | |
public int Power; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[CreateAssetMenu(menuName = "ScriptableObject/SubEnemy", fileName = "NewSubEnemy")] | |
public class SubEnemy : Enemy{ | |
private int damageCount = 0; | |
public override void Damage(int damageValue){ | |
base.Damage(damageValue); | |
++ damageCount; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[CreateAssetMenu(menuName = "ScriptableObject/Enemy", fileName = "NewEnemy")] | |
public class Enemy : ScriptableObject{ | |
public string Name; | |
public int HpMax; | |
public int Power; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public abstract class ScriptableObjectInstancePresenter<T> : MonoBehaviour where T : ScriptableObject{ | |
public T m_model; | |
protected T model { get; set; } | |
protected void Awake() { | |
model = ScriptableObject.Instantiate<T>(m_model); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EnemyPresenter : ScriptableObjectInstancePresenter<Enemy> { | |
//... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InitializeOnLoadMethod] | |
public static void RefreshItemAssetPath() { | |
EditorApplication.projectWindowChanged += () => { | |
foreach (string guid in AssetDatabase.FindAssets("t:Item")) { | |
string path = AssetDatabase.GUIDToAssetPath(guid); | |
Item item = AssetDatabase.LoadAssetAtPath<Item>(path); | |
Match match = new Regex(@"Assets\/Resources\/(?<resource_path>.*)\.asset").Match(path); | |
if (!match.Success) { | |
Debug.Log("Cannot extract resource Path. : " + path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
EnumLabel.cs | |
Copyright (c) 2016 Hassaku | |
This software is released under the MIT License. | |
http://opensource.org/licenses/mit-license.php | |
*/ | |
using UnityEngine; | |
using UnityEngine.Assertions; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class EnumLabelSample : MonoBehaviour{ | |
[EnumLabel(typeof(Fruit))] | |
public string[] names = new string[Enum.GetValues(typeof(Fruit)).Length]; | |
private enum Fruit { | |
Orange, |
OlderNewer