- Home /
Timer indication and flight Log Information
" />
Red circle=Helicopter icon, point1 is the location for helicopter to fly to follow by point2
Basically i am doing this new function(make New Flight log) This image show the places for helicopter to fly to. So i wanted to create somethings able to on/off the log. The log is able to display the distance from the helicopter starting point to the point1. as well for other point2 .... and also to display the time around that to reach it any1 has any idea. pls help me Thx below is script for the when i click to add waypoint 1 and formore.
//mouseclick to add waypoints
if (Helicopter_Script.flightState == 0)
{
if (Input.GetMouseButtonDown(0))
{
position = Input.mousePosition;
if (position != prevMousePosition)
{
prevMousePosition = position;
// Debug.Log("MouseClicked: mousePosition (x) - "+position.x + ", (y) - "+position.y);
if ((position.x>=20 && position.x<=570) && (position.y>=150 && position.y<=780))
{
if (helicopter.GetComponent( "Helicopter_Script" ).wayPoints.length == 0)
GameObject.Find("Home").renderer.enabled = true;
if (helicopter.GetComponent( "Helicopter_Script" ).wayPoints.length < maxWaypoints)
{
points1.push(position);
linePoints = new Vector2 [points1.length + 1];
points1.ToBuiltin(Vector2).CopyTo(linePoints,0);
linePoints[linePoints.length-1] = points1[0];
if (line1 != null) Vector.DestroyLine(line1);
line1 = new VectorLine("Line1", linePoints , Color.red, null, 2.0, LineType.Continuous);
Vector.DrawLine(line1);
mapPosition.z = (position.y - 150) * (3300.656 + 1327.897) / (780 - 150) + (-1327.897);
mapPosition.x = (position.x - 20) * (824.0381 + 3285.686) / (570 - 20) + (-3285.686);
object = "p"+(helicopter.GetComponent( "Helicopter_Script" ).wayPoints.length+1);
GameObject.Find(object).transform.localPosition.x = mapPosition.x;
GameObject.Find(object).transform.localPosition.z = mapPosition.z;
GameObject.Find(object).renderer.enabled = true;
Helicopter_Script.wayPoints.Push(mapPosition);
Helicopter_Script.isNewWayPoint = true;
Debug.Log("numWaypont - "+Helicopter_Script.wayPoints.length +", mapPosition - "+mapPosition);
}
}
}
}
}
//draw lines to waypoints
// pathPoints[pathIndex] = thisTransform.position;
// pathLine.maxDrawIndex = pathIndex-1;
// Vector.DrawLine (pathLine);
// Vector.SetTextureScale (pathLine, 1.0);
Your answer
Follow this Question
Related Questions
pause menu on android phone 1 Answer
Audio after Audio Loop 1 Answer
One GameObjects Script Activating Another GameObjects Script 1 Answer
Explosive like in COD 4? 1 Answer
Timer activates script 1 Answer