Created
August 15, 2017 13:54
-
-
Save yuw-unknown/33d331af03ee959ceee10f2b7fe24b08 to your computer and use it in GitHub Desktop.
Arbor2Sample 条件を見て、State先を切り替える
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 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