// Update is called once per frame void Update() { if (_Touched == true) { float currentScore = _CarouselItem.CalculateScore(); float delta = Mathf.Abs(currentScore - _PrevScore); _ScoreAccumulator += delta; _PrevScore = currentScore; } }
/// <summary> /// Swap the least position to normalized most position + 1.0 /// </summary> /// <param name="least">Least valued CarouselItem</param> /// <param name="most">Most valued CarouselItem</param> /// <param name="newLeast">The new least valued CarouselItem</param> void LeastToMost(CarouselItem least, CarouselItem most, CarouselItem newLeast) { least.UpdateScore(most.CalculateScore() + most.SizeTop + most.Padding + least.SizeBottom + least.Padding); if (OnLeastToMost != null) { OnLeastToMost(newLeast.gameObject, least.gameObject); } }
/// <summary> /// Swap the most position to normalized least position - 1.0 /// </summary> /// <param name="least">Least valued CarouselItem</param> /// <param name="most">Most valued CarouselItem</param> /// <param name="newMost">The new most valued CarouselItem</param> void MostToLeast(CarouselItem least, CarouselItem most, CarouselItem newMost) { most.UpdateScore(least.CalculateScore() - least.SizeBottom - least.Padding - most.SizeTop - most.Padding); if (OnMostToLeast != null) { OnMostToLeast(most.gameObject, newMost.gameObject); } }