Skip to content

Instantly share code, notes, and snippets.

@yuw-unknown
Created August 14, 2017 07:52
Show Gist options
  • Save yuw-unknown/3427035f85fe41fe87514a220e67503a to your computer and use it in GitHub Desktop.
Save yuw-unknown/3427035f85fe41fe87514a220e67503a to your computer and use it in GitHub Desktop.
Arbor2の他のオブジェクトの状態を監視するSample
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Arbor
{
/**
* 猫が茂みに居るStatusになった際に、次のStateを呼び出します
*/
[AddComponentMenu("")]
[AddBehaviourMenu("ぱたぱたう〜のん/Transition/猫が茂みにいる時にTransition")]
[BuiltInBehaviour]
public class ArborCatStateStageIn : StateBehaviour {
[SerializeField] private Cat _Cat; // 猫Object, GameObjectまで不要なのでComponentを取得
[SerializeField] private StateLink _NextState; // 次のState
void Start() {}
void Update() {
if (_Cat.CurrentState == Cat.CatState.Stay_StageIn) {
Transition(_NextState);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment