// Update is called once per frame void FixedUpdate() { if (nextlocation != location) { dt += Time.fixedDeltaTime * 5f; transform.position = Vector3.Lerp(location.anchorpoint, nextlocation.anchorpoint, dt); if (Vector3.Distance(transform.position, nextlocation.anchorpoint) < Globals.kEpsilon) { SetPositionImmediate(nextlocation); // -- check for breakable items if (GridController.IsBreakable(nextlocation)) { if (nextlocation.RemoveBreakable()) { GridController.BreakFX(nextlocation.anchorpoint); } } } } // -- play some walking noises if we are walking if (animcontroller.currentanimation.name.Contains("Walk")) { walknoisetick--; if (walknoisetick % 10 == 0) { GameObject smoke = GameObject.Instantiate(feetsmokeprefab, this.transform.position + Vector3.down * 0.075f, Quaternion.identity); GameObject.Destroy(smoke, 3f); } if (walknoisetick == 0) { walknoisetick = walknoisetickR; int r = Random.Range(0, walknoises.Length); AudioManager.PlaySoundEffect(walknoises[r]); } } else if (prevanimation.Contains("Walk")) { walknoisetick = walknoisetickR; } prevanimation = animcontroller.currentanimation.name; }