Skip to content

Instantly share code, notes, and snippets.

@yuw-unknown
Created August 16, 2017 11:37
Show Gist options
  • Save yuw-unknown/c13cd8e974e17671d1ec058c41ab5c82 to your computer and use it in GitHub Desktop.
Save yuw-unknown/c13cd8e974e17671d1ec058c41ab5c82 to your computer and use it in GitHub Desktop.
Arbor2でSpriteRendererの色を変更します
using UnityEngine;
using System.Collections;
using Arbor;
/**
* Spriteの色を変更します
*/
// MenuのComponentにメニューを追加する
[AddComponentMenu("Arbor/Sprite色変更")]
// 挙動追加のメニューを追加する
[AddBehaviourMenu("Original/Sprite/色ちぇんじ")]
[BuiltInBehaviour]
// StateBehaviourはMonoBehaviourを継承しているので、UnityのBehaviour機能をそのまま使える
public class ArborChangeSpriteColor : StateBehaviour {
[SerializeField] private SpriteRenderer _SpriteRenderer;
[SerializeField] private Color _Color;
void Start () {
}
// Use this for awake state
public override void OnStateAwake() {
}
// Use this for enter state
public override void OnStateBegin() {
_SpriteRenderer.color = _Color;
}
// Use this for exit state
public override void OnStateEnd() {
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment