bool GoTo(Hexagone hex) { float vitesse = 0.05f; if (slowTime > 0) { vitesse/=5; } transform.position = Vector3.MoveTowards (transform.position, hex.centre()+new Vector3 (0f, 0.5f,0.0f), vitesse/hex.cost); return Vector3.SqrMagnitude (hex.centre ()+new Vector3 (0f, 0.5f,0.0f) - transform.position)<0.01; }
void instanciate(GameObject tourelle,Hexagone hex) { if (hex.mur) { return; } hex.mur = true; if (!checkPath ()) { hex.mur=false; return; } GameObject.Instantiate(tourelle,hex.centre (),Quaternion.identity); updatePath (); }