Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Arbor2Sample 条件を見て、State先を切り替える
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Arbor {
/**
* 戸棚があいていればTransitionします
*/
[AddComponentMenu("")]
[AddBehaviourMenu("ぱたぱたう〜のん/Transition/戸棚が開いていればTransition")]
[BuiltInBehaviour]
public class ArborOpenDoorTransition : StateBehaviour {
[SerializeField] private GamaManager _GameManager;
[SerializeField] private StateLink _NextOpenState;
[SerializeField] private StateLink _NextCloseState;
// 前回の状態を覚えておく
bool _LastOpend = false;
void Start () {}
void Update () {
if (_LastOpend == _GameManager.IsOpenDoor()) {
return;
}
_LastOpend = _GameManager.IsOpenDoor();
if (_GameManager.IsOpenDoor()) {
Transition(_NextOpenState);
} else {
Transition(_NextCloseState);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.