// Update is called once per frame void Update() { if (state == UnitychanState.IDLE) { return; } var distance = GetDistance(); if (state == UnitychanState.WALK && distance < 7.5f) { provider.StartRun(); state = UnitychanState.RUN; } if (GameManager.gameMode == GameMode.ESCAPE) { var isLeftAtPlayerPos = (playerTrans.position.x + 1) < transform.position.x ? true : false; if (!isLeftAtPlayerPos) { return; } StopMove(); provider.PlayEscapedAnimation(); isCry = true; } //Debug.Log("Distance:"+GetDistance()); }
public void StartMove() { if (state != UnitychanState.IDLE) { return; } maxDistance = GetDistance(); state = UnitychanState.WALK; StartCoroutine(FootStep(GetDistance())); }
public void StopMove() { state = UnitychanState.IDLE; }
// Use this for initialization void Awake() { provider = GetComponent <UnitychanProvider>(); state = UnitychanState.IDLE; }