public void InitializeMovement(List<Vector2> points) { _points = points; _tween = new LinearTween(points[0], points[1], getStandardSpeed(points[0], points[1]), Ease.None); _tween.Ended += tween_Ended; _targetPointIndex = 1; _colorTween = new ColorTween(Color.Transparent, Color.White, 1000, Ease.None); }
public void Animate() { bool a = m_tween0.Animate(); bool b = m_tween1.Animate(); m_animated = a || b; if (m_revert && !m_animated && !m_reverting) { m_tween0 = new LinearTween(m_piece.transform, m_piece.transform.position, GameController.Instance.GetPiecePosition(m_piece.Row, m_piece.Col), m_speed); m_tween1 = new LinearTween(m_other.transform, m_other.transform.position, GameController.Instance.GetPiecePosition(m_other.Row, m_other.Col), m_speed); m_reverting = true; m_animated = true; } }
public SwapJob(PieceController piece, PieceController other, float speed, bool revert = false) { m_piece = piece; m_other = other; m_speed = speed; m_revert = revert; if (m_revert) { m_tween0 = new LinearTween(piece.transform, piece.transform.position, GameController.Instance.GetPiecePosition(other.Row, other.Col), speed); m_tween1 = new LinearTween(other.transform, other.transform.position, GameController.Instance.GetPiecePosition(piece.Row, piece.Col), speed); } else { m_tween0 = new LinearTween(piece.transform, piece.transform.position, GameController.Instance.GetPiecePosition(piece.Row, piece.Col), speed); m_tween1 = new LinearTween(other.transform, other.transform.position, GameController.Instance.GetPiecePosition(other.Row, other.Col), speed); } }
private void tween_Ended(object sender, System.EventArgs e) { if (_targetPointIndex + 1 < _points.Count) { Vector2 start = _points[_targetPointIndex]; Vector2 stop = _points[_targetPointIndex + 1]; _tween = new LinearTween(start, stop, getStandardSpeed(start, stop), Ease.None); _tween.Ended += tween_Ended; if (_targetPointIndex + 2 >= _points.Count) _colorTween = new ColorTween(Color.White, Color.Transparent, 1000, Ease.None); _targetPointIndex += 1; } else { Vector2 start = _points[0]; Vector2 stop = _points[1]; _tween = new LinearTween(start, stop, getStandardSpeed(start, stop), Ease.None); _tween.Ended += tween_Ended; _colorTween = new ColorTween(Color.Transparent, Color.White, 1000, Ease.None); _targetPointIndex = 1; } }
public void InitializeMovement(Vector2 from, Vector2 to, float speedScalar = 1.0f) { _tween = new LinearTween(from, to, getStandardSpeed(from, to) * speedScalar, Ease.None); _tween.Loop = true; }