public void StartFly(string score, Vector3 wPos) { scoreText.text = score; Canvas c = GameObject.Find("CanvasMain").GetComponent <Canvas>(); rTransform.SetParent(c.transform); rTransform.anchoredPosition = Coordinats.WorldToCanvasCenterCenter(wPos, c); Vector2 pos = rTransform.anchoredPosition; float dist = Random.Range(300, 500); float time = Random.Range(1.2f, 2.2f); SimpleTween.Value(gameObject, 0f, dist, time).SetOnUpdate((float val) => { Vector2 npos = pos + new Vector2(0, val); if (this) { rTransform.anchoredPosition = npos; } }).SetEase(EaseAnim.EaseOutCubic). SetDelay(Random.Range(0.0f, 0.1f)). AddCompleteCallBack(() => { if (this) { Destroy(gameObject); } }); }
static void Main(string[] args) { Coordinats CoordinatsSafe = new Coordinats(); decimal[] rectanglesAndChecks = Console.ReadLine() .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select(decimal.Parse) .ToArray(); decimal rectanglesCount = rectanglesAndChecks[0]; decimal checksCount = rectanglesAndChecks[1]; //rectangles information for (int index = 0; index < rectanglesCount; index++) { string[] rectangleInfo = Console.ReadLine() .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries) .ToArray(); string ID = rectangleInfo[0]; decimal width = decimal.Parse(rectangleInfo[1]); decimal height = decimal.Parse(rectangleInfo[2]); decimal x = decimal.Parse(rectangleInfo[3]); decimal y = decimal.Parse(rectangleInfo[4]); //getting rectangle coordinats decimal x1 = x; decimal y1 = y; decimal x2 = x + width; decimal y2 = y - (height / 2); Rectangle rectangle = new Rectangle(ID, x1, y1, x2, y2); CoordinatsSafe.AddingCoordinats(rectangle); } //checks for (decimal index = 0; index < checksCount; index++) { string[] competitors = Console.ReadLine() .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries) .ToArray(); if (competitors.Length < 2) { break; } else { string firstRectangle = competitors[0]; string secondRectangle = competitors[1]; CoordinatsSafe.Checkingdecimalersections(firstRectangle, secondRectangle); } } }
static void Task3() { //Расстояние между двумя точками Coordinats c1, c2; FC.Input("Введите координату x1", out c1.x); FC.Input("Введите координату y1", out c1.y); FC.Input("Введите координату x2", out c2.x); FC.Input("Введите координату y2", out c2.y); Console.WriteLine($"Расстояние между двумя точками равно {Coordinats.Calc(c1, c2):#.##}"); FC.Pause(); }
// Use this for initialization public void StartFly(string score, Vector3 wPos) { scoreText.text = score; Canvas c = GameObject.Find("CanvasMain").GetComponent <Canvas>(); rTransform.SetParent(c.transform); rTransform.anchoredPosition = Coordinats.WorldToCanvasCenterCenter(wPos, c); Vector2 pos = rTransform.anchoredPosition; SimpleTween.Value(gameObject, 0f, 500f, 2f).SetOnUpdate((float val) => { Vector2 npos = pos + new Vector2(0, val); rTransform.anchoredPosition = npos; }).SetEase(EaseAnim.EaseOutCubic).AddCompleteCallBack(() => { Destroy(gameObject); }); }
/// <summary> /// hareket direktifi ile oluşacak koordinat değişikliği birim çember üzerindeki açısal durumdan /// koordinat bazlı ayrı yarı hesaplanır /// </summary> /// <param name="position"></param> /// <param name="coordinat"></param> /// <returns></returns> private static int CalculateNextStepMoveCoordinat(int position, Coordinats coordinat) { var result = 0; switch (coordinat) { case Coordinats.X: result = (int)Math.Cos(RoverUtils.ConvertDegreeToRadian(position)); break; case Coordinats.Y: result = (int)Math.Sin(RoverUtils.ConvertDegreeToRadian(position)); break; default: break; } return(result); }
public static double Calc(Coordinats c1, Coordinats c2) { return(Math.Sqrt(Math.Pow(c2.x - c1.x, 2) + Math.Pow(c2.y - c1.y, 2))); }