private void Update() { /*if (!isLocalPlayer) { * return; * }*/ RaycastHit hit; Vector3 groundSelectionVectorPosition = new Vector3(this.transform.position.x, 0, this.transform.position.z); Ray selectionRay = new Ray(groundSelectionVectorPosition, transform.forward); Debug.DrawRay(groundSelectionVectorPosition, transform.forward * 5, Color.green); this.transform.Rotate(0, -Input.gyro.rotationRateUnbiased.z, 0); //Debug.Log ("Gravity is "+Input.gyro.gravity); //Debug.Log (-Input.gyro.rotationRateUnbiased.z); if (Physics.Raycast(selectionRay, out hit, Mathf.Infinity) && (timesYouCanVote != 0) && (Input.gyro.userAcceleration.y > 0.4f)) { timesYouCanVote--; //selected = true; arrProp = hit.transform.gameObject; arrPropInfo = arrProp.GetComponent <ArrowInfo>(); arrPropInfo.arrowsInfo.count++; Debug.Log("Selected" + arrPropInfo.arrowsInfo.POI); } arrPropNotSelected = hit.transform.gameObject; arrPropInfoNotSelected = arrPropNotSelected.GetComponent <ArrowInfo>(); Debug.Log("Not selected is" + arrPropInfoNotSelected.arrowsInfo.POI); }
public Arrow(ArrowInfo info) { _triangleSize = info.TriangleSize; _thickness = info.Thickness; _head = new ConvexShape(3) { Origin = new Vector2f(.0f, .0f), FillColor = info.Color, OutlineColor = info.LineColor, OutlineThickness = info.LineThickness }; _head.SetPoint(0, new Vector2f(.0f, .0f)); _head.SetPoint(1, new Vector2f(-_triangleSize.X, _triangleSize.Y / 2)); _head.SetPoint(2, new Vector2f(-_triangleSize.X, -_triangleSize.Y / 2)); _rect = new RectangleShape(new Vector2f(1.0f, info.Thickness)) { FillColor = info.Color, OutlineColor = info.LineColor, OutlineThickness = info.LineThickness }; Delta = new Vector2f(1.0f, 1.0f); }
void CreateJumpArrow() { jumpArrow = Instantiate(arrow, transform).GetComponent <RectTransform>(); ArrowInfo info = ArrowController.controller.ReturnInfo(); jumpArrow.anchoredPosition = new Vector2(GetComponent <RectTransform>().sizeDelta.x + 30.0f + info.distance, -8.0f); jumpArrow.sizeDelta = new Vector2(8.0f, 16.0f); jumpArrow.GetComponent <Image>().color = info.color; }
public ArrowInfo ReturnInfo() { ArrowInfo info = new ArrowInfo() { color = colors[arrowCount], distance = (arrowCount % 4) * 8.0f }; arrowCount = (arrowCount + 1) % colors.Length; return(info); }
/// <summary> /// Draws single arrow on watches /// </summary> /// <param name="canvas">Control canvas</param> /// <param name="dialFace">Parameters of the dial face</param> /// <param name="arrow">Parameters of arrow</param> private void DrawSingleArrow( PaintEventArgs canvas, DialFaceInfo dialFace, ArrowInfo arrow) { // Because arrow.Angle is clockwise diviation from x = 0 var realAngle = (Math.PI / 2) - arrow.Angle; var firstPoint = this.ConvertPolarToCartesian( arrow.CounterweightLength, realAngle + Math.PI, new Point(dialFace.CenterX, dialFace.CenterY)); var secondPoint = this.ConvertPolarToCartesian( arrow.MainPartLength, realAngle, new Point(dialFace.CenterX, dialFace.CenterY)); var arrowPen = new Pen(arrow.ArrowColor, arrow.Thickness); canvas.Graphics.DrawLine(arrowPen, firstPoint, secondPoint); }
void Start() { direction = Vector3.right; angle = (int)Vector3.Angle(Vector3.up, transform.right); arrowInfo = GetComponent <ArrowInfo>(); origSpeed = speed; if (arrowInfo.GetArrowType() == arrowType.drill) { drillArrow = true; } var g = GameObject.Find("Gamemanager"); if (g) { gm = g.GetComponent <GamemanagerScript>(); gm.AddShotArrow(playerNumber); } else { print("No gamemanager found"); } }
public void Setup(ArrowInfo info) { hasLeftScreen = false; type = info.type; position = info.position; mapObjectId = info.mapObjectId; groundLevel = 0.0f; for (int y = 0; y < (int)Enum.kNumBoostPoints; y++) { boostPointPosition[y] = Utilities.CGPointMake(info.position.x, -50 + info.position.y + ((float)y * 22)); for (int i = 0; i < (int)Enum.kBAMaxPlayers; i++) { pointHit[i, y] = false; } } ZAnimationInfo zaInfo = new ZAnimationInfo(); zaInfo.numFrames = 5; for (int i = 0; i < zaInfo.numFrames; i++) { zaInfo.frameTime[i] = 0.2f; if ((int)((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneGrass) { zaInfo.subTextureId[i] = (short)(6 + i); } else { zaInfo.subTextureId[i] = (short)(49 + i); } } zaInfo.gapType = GapType.kAnimGapTime; anim.Setup(zaInfo); anim.PlayLooping(); }