Exemple #1
0
		void Start() {
			regionCreater.SetAllPoolSize();
			charAnime.anime.CrossFade("Run");

			distanceSum = 0;
			regionCount = 0;
			nextRegion = CreateNextRegion();
			nextRegion.transform.localPosition = new Vector3(0, 0, 0);

			GoNextRegion();
		}
Exemple #2
0
		/// <summary>
		/// Make the character go to next region and switch current region to the last one
		/// </summary>
		public void GoNextRegion() {
			if (lastRegion != null) {
				lastRegion.Deactive();
			}

			lastRegion = currentRegion;
			if (lastRegion != null) {
				lastRegion.clickArea.gameObject.SetActive(false);
			}
			currentRegion = nextRegion;
			nextRegion = CreateNextRegion();
			nextRegion.transform.localPosition = currentRegion.transform.localPosition + new Vector3(currentRegion.Length, 0, 0);

			nextPosition = distanceSum + currentRegion.Length;
			distanceSum += currentRegion.Length;

			var tween = UIAnimation.TweenPosition(charAnime.gameObject,
				currentRegion.Length / GameConsts.Inst.characterMoveSpeed,
				charAnime.transform.localPosition,
				currentRegion.transform.localPosition + new Vector3(currentRegion.KeyPointOffset, 0, 0));
			charAnime.anime.CrossFade("Run");
			UIAnimator.Begin(gameObject, tween, RegionAction);
		}