Created
June 14, 2015 00:16
-
-
Save yasuakiohama/a4fd3fc1fae0cd37502a to your computer and use it in GitHub Desktop.
NameCreatorSample.cs
This file contains 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; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class NameCreatorSample : MonoBehaviour | |
{ | |
void Start () | |
{ | |
AudioManager.Instance.PlayBGM (BGMName.thunderstorm1); | |
SpriteLoad (); | |
SpriteSampleCreate (); | |
InvokeRepeating ("Test", 1, 1); | |
} | |
Dictionary<string, Sprite> _sprite = new Dictionary<string, Sprite> (); | |
void SpriteLoad() | |
{ | |
object[] _spriteList = Resources.LoadAll<Sprite> ("Sprites"); | |
_sprite = new Dictionary<string, Sprite> (); | |
foreach (Sprite sprite in _spriteList) { | |
Debug.Log (sprite.name); | |
_sprite [sprite.name] = sprite; | |
} | |
} | |
void SpriteSampleCreate() | |
{ | |
GameObject test = new GameObject (); | |
test.AddComponent<SpriteRenderer> (); | |
test.GetComponent<SpriteRenderer> ().sprite = _sprite [SpriteName.face]; | |
} | |
void Test() | |
{ | |
AudioManager.Instance.PlaySE (SEName.A1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment