Move one waypoint on iTween

I have a way point with three points, point A, B and C, I want to move the Waipoint from A to B, then, when click on the button, walk B to C, I tried to add i++ but don’t worked, take a look on my code. And thank you =).

public Transform[] waypoints;
public float m_speed;
int i = 1;

  public void Update()
    {
      if (jogador == false && Input.GetKeyDown(KeyCode.A))
      {
         i++;
         iTween.MoveTo(player1,iTween.Hash("path",waypoints*,"speed",m_speed,"easetype","linear"));* 

}

}

Note, you are passing in a Transform, but you are trying to use it like a list of waypoints. In addition you have the problem that if you hit the ‘A’ key during the time ‘player1’ is moving, you will end up with multiple iTweens on the player. Here is a bit of code that solves both issues:

using UnityEngine;
using System.Collections;
 
public class Walk : MonoBehaviour {
 
public Transform[] waypoints;
public float m_speed = 1.0f;
public GameObject player1;
private int i = 0;

private bool moving = false;
	
	public void Start() {
		transform.position = waypoints[0].position;	
	}
	
	public void Update() {
		if (!moving && i < waypoints.Length - 1 && Input.GetKeyDown(KeyCode.A)) {
			i++;
			moving = true;
			iTween.MoveTo(player1,iTween.Hash("position",waypoints*,"speed",m_speed,"easetype","linear", "oncompletetarget",gameObject, "oncomplete", "Done"));* 
  •  }*
    
  • }*

  • public void Done() {*

  •  moving = false;*
    
  • }*
    }