private void SecondWalk([NotNull] TVertex vertex, double x, double y, float l, float t)
        {
            Debug.Assert(vertex != null);

            var position = new Point(x, y);

            VerticesPositions[vertex] = position;
            _visitedVertices.Add(vertex);
            BalloonData data = _data[vertex];

            float dd     = l * data.D;
            float p      = (float)(t + Math.PI);
            int   degree = VisitedGraph.OutDegree(vertex);
            float fs     = degree == 0 ? 0 : data.F / degree;
            float pr     = 0;

            foreach (TEdge edge in VisitedGraph.OutEdges(vertex))
            {
                TVertex otherVertex = edge.Target;
                if (_visitedVertices.Contains(otherVertex))
                {
                    continue;
                }

                BalloonData otherData = _data[otherVertex];
                float       aa        = data.C * otherData.A;
                float       rr        = (float)(data.D * Math.Tan(aa) / (1 - Math.Tan(aa)));
                p += pr + aa + fs;

                float xx = (float)((l * rr + dd) * Math.Cos(p));
                float yy = (l * rr + dd) * Math.Sign(p);
                pr = aa;
                SecondWalk(otherVertex, x + xx, y + yy, l * data.C, p);
            }
        }
        private void FirstWalk([NotNull] TVertex vertex)
        {
            Debug.Assert(vertex != null);

            BalloonData data = _data[vertex];

            _visitedVertices.Add(vertex);
            data.D = 0;

            float s = 0;

            foreach (TEdge edge in VisitedGraph.OutEdges(vertex))
            {
                TVertex     otherVertex = edge.Target;
                BalloonData otherData   = _data[otherVertex];

                if (!_visitedVertices.Contains(otherVertex))
                {
                    FirstWalk(otherVertex);
                    data.D      = Math.Max(data.D, otherData.R);
                    otherData.A = (float)Math.Atan((float)otherData.R / (data.D + otherData.R));
                    s          += otherData.A;
                }
            }

            AdjustChildren(data, s);
            SetRadius(data);
        }
 void CmdBalloonReCreate(int EmptyPositions, BalloonData ReCreateBalloon)
 {
     if (ReCreateBalloon.BalloonColor == "red")
     {
         GameObject createballoon = Instantiate(red_balloon);
         createballoon.transform.position = positions[EmptyPositions].transform.position;
         createballoon.transform.parent   = positions[EmptyPositions].transform;
         createballoon.GetComponent <Hit> ().BalloonNumber = EmptyPositions;
         createballoon.GetComponent <Hit> ().BalloonColor  = ReCreateBalloon.BalloonColor;
         createballoon.GetComponent <Hit> ().WordNumber    = ReCreateBalloon.WordNumber;
         createballoon.GetComponentInChildren <ParticleSystemRenderer> ().material = word [ReCreateBalloon.WordNumber];
         createballoon.GetComponentInChildren <ParticleSystem> ().Play();
         NetworkServer.Spawn(createballoon);
         this.GetComponent <GetReady> ().Rpc_BalloonReCreate(EmptyPositions, ReCreateBalloon, createballoon);
     }
     else
     {
         GameObject createballoon = Instantiate(blue_balloon);
         createballoon.transform.position = positions[EmptyPositions].transform.position;
         createballoon.transform.parent   = positions[EmptyPositions].transform;
         createballoon.GetComponent <Hit> ().BalloonNumber = EmptyPositions;
         createballoon.GetComponent <Hit> ().BalloonColor  = ReCreateBalloon.BalloonColor;
         createballoon.GetComponent <Hit> ().WordNumber    = ReCreateBalloon.WordNumber;
         createballoon.GetComponentInChildren <ParticleSystemRenderer> ().material = word [ReCreateBalloon.WordNumber];
         createballoon.GetComponentInChildren <ParticleSystem> ().Play();
         NetworkServer.Spawn(createballoon);
         this.GetComponent <GetReady> ().Rpc_BalloonReCreate(EmptyPositions, ReCreateBalloon, createballoon);
     }
 }
        private void SecondWalk(TVertex v, TVertex r, double x, double y, float l, float t)
        {
            Point pos = new Point(x, y);

            VertexPositions[v] = pos;
            visitedVertices.Add(v);
            BalloonData data = datas[v];

            float dd     = l * data.d;
            float p      = (float)(t + Math.PI);
            int   degree = VisitedGraph.OutDegree(v);
            float fs     = (degree == 0 ? 0 : data.f / degree);
            float pr     = 0;

            foreach (var edge in VisitedGraph.OutEdges(v))
            {
                var otherVertex = edge.Target;
                if (visitedVertices.Contains(otherVertex))
                {
                    continue;
                }

                var   otherData = datas[otherVertex];
                float aa        = data.c * otherData.a;
                float rr        = (float)(data.d * Math.Tan(aa) / (1 - Math.Tan(aa)));
                p += pr + aa + fs;

                float xx = (float)((l * rr + dd) * Math.Cos(p));
                float yy = (float)((l * rr + dd) * Math.Sign(p));
                pr = aa;;
                SecondWalk(otherVertex, v, x + xx, y + yy, l * data.c, p);
            }
        }
    // balloon object

    /// <summary>
    /// Collects data into a BalloonData object and adds to list of other data points
    /// </summary>
    public void collectValues()
    {
        BalloonData balloonData = new BalloonData(uiValues._currentRadiusM,
                                                  uiValues._surfaceArea, uiValues._volume, uiValues._liftForce, uiValues._mylar_mass,
                                                  Wind.constantStrength, Wind.WeightForce() / 9.81f);

        balloonCollection.Add(balloonData);
    }
        private void InitializeData()
        {
            foreach (var v in VisitedGraph.Vertices)
            {
                datas[v] = new BalloonData();
            }

            visitedVertices.Clear();
        }
        private void InitializeData()
        {
            foreach (TVertex vertex in VisitedGraph.Vertices)
            {
                _data[vertex] = new BalloonData();
            }

            _visitedVertices.Clear();
        }
    public void SetBalloonData(BalloonData balloonData)
    {
        BalloonData = balloonData;

        if (SpriteRenderer != null)
        {
            SpriteRenderer.sprite = BalloonData.Sprite;
        }
    }
    void Rpc_BalloonReCreate(int EmptyPositions, BalloonData ReCreateBalloon, GameObject createballoon)
    {
        int language = GameObject.Find("NetworkManager").GetComponent <Language_Select> ().language_number *5;

        createballoon.transform.position = GameObject.Find("BalloonPoints").GetComponent <GetReady> ().positions[EmptyPositions].transform.position;
        createballoon.transform.parent   = GameObject.Find("BalloonPoints").GetComponent <GetReady> ().positions[EmptyPositions].transform;
        createballoon.GetComponent <Hit> ().BalloonNumber = EmptyPositions;
        createballoon.GetComponent <Hit> ().BalloonColor  = ReCreateBalloon.BalloonColor;
        createballoon.GetComponent <Hit> ().WordNumber    = ReCreateBalloon.WordNumber;
        createballoon.GetComponentInChildren <ParticleSystemRenderer> ().material = GameObject.Find("BalloonPoints").GetComponent <GetReady> ().word [(ReCreateBalloon.WordNumber + language)];
        createballoon.GetComponentInChildren <ParticleSystem> ().Play();
    }
 private void AdjustChildren(TVertex v, BalloonData data, float s)
 {
     if (s > Math.PI)
     {
         data.c = (float)Math.PI / s;
         data.f = 0;
     }
     else
     {
         data.c = 1;
         data.f = (float)Math.PI - s;
     }
 }
 private void AdjustChildren(Representation.node v, BalloonData data, float s)
 {
     if (s > Math.PI)
     {
         data.c = (float)Math.PI / s;
         data.f = 0;
     }
     else
     {
         data.c = 1;
         data.f = (float)Math.PI - s;
     }
 }
        public void NotifyShow(string message)
        {
            var item = new BalloonData
            {
                Message = message,
                Title   = string.Empty
            };

            m_ShowWaitBalloonData.Enqueue(item);

            if (m_ShowWaitBalloonData.Count <= 1)
            {
                Application.Current.Dispatcher?.Invoke(() => m_TaskTray.ShowBalloonTip(item.Title, item.Message, BalloonIcon.None));
            }
        }
        private static void AdjustChildren([NotNull] BalloonData data, float s)
        {
            Debug.Assert(data != null);

            if (s > Math.PI)
            {
                data.C = (float)Math.PI / s;
                data.F = 0;
            }
            else
            {
                data.C = 1;
                data.F = (float)Math.PI - s;
            }
        }
        private void SecondWalk(Representation.node v, Representation.node r, double x, double y, float l, float t)
        {
            visitedVertices.Add(v);
            BalloonData data = datas[v];

            for (var i = 0; i < graph.nodes.Count; i++)
            {
                if (graph.nodes[i].name == v.name)
                {
                    graph.nodes[i].X = x * HorizontalSpacing;
                    graph.nodes[i].Y = y * VerticalSpacing;
                }
            }

            float dd     = l * data.d;
            float p      = (float)(t + Math.PI);
            int   degree = v.degree;
            float fs     = (degree == 0 ? 0 : data.f / degree);
            float pr     = 0;

            foreach (var edge in v.arcsFrom)
            {
                var otherVertex = edge.To;
                if (visitedVertices.Contains(otherVertex))
                {
                    continue;
                }

                var   otherData = datas[otherVertex];
                float aa        = data.c * otherData.a;
                float rr        = (float)(data.d * Math.Tan(aa) / (1 - Math.Tan(aa)));
                p += pr + aa + fs;

                float xx = (float)((l * rr + dd) * Math.Cos(p));
                float yy = (float)((l * rr + dd) * Math.Sign(p));
                pr = aa;;
                SecondWalk(otherVertex, v, x + xx, y + yy, l * data.c, p);
            }
        }
        private void SetRadius([NotNull] BalloonData data)
        {
            Debug.Assert(data != null);

            data.R = Math.Max(data.D / 2, Parameters.MinRadius);
        }
 private void SetRadius(TVertex v, BalloonData data)
 {
     data.r = (int)Math.Max(data.d / 2, Parameters.MinRadius);
 }
 public void Setup(Vector2 velocity, Rect balloonOutOfBoundsRect, BalloonData balloonData)
 {
     BalloonVelocity        = velocity;
     BalloonOutOfBoundsRect = balloonOutOfBoundsRect;
     BalloonData            = balloonData;
 }
    void Awake()
    {
        var text = File.ReadAllText(Application.dataPath + RESOURCE_PATH + JSON_PATH);

        JsonNode json = JsonNode.Parse(text);
        var balloons = json["Balloons"];

        Dictionary<int, Attribute> balloon_attribute_table = new Dictionary<int, Attribute>();
        balloon_attribute_table.Add(0, Attribute.ANIME);
        balloon_attribute_table.Add(1, Attribute.IDOL);
        balloon_attribute_table.Add(2, Attribute.GAME);
        balloon_attribute_table.Add(3, Attribute.VOCALOID);
        balloon_attribute_table.Add(4, Attribute.ROBOT);

        for (var i = 0; i < balloons.Count; ++i)
        {
            BalloonData balloon_data = new BalloonData();
            var ballon = balloons[i];
            balloon_data._name = ballon["Name"].Get<string>();
            balloon_data._id = (int)ballon["ID"].Get<long>();
            balloon_data._attacK_power = (float)ballon["AttackPower"].Get<double>();
            balloon_data._attack_speed = (float)ballon["AttackSpeed"].Get<double>();

            var enemy_attribute_num = (int)ballon["Attribute"].Get<long>();
            balloon_data._attribute = balloon_attribute_table[enemy_attribute_num];

            _balloon_table.Add(balloon_data._name.GetHashCode(), balloon_data);
            _balloon_name_table.Add(balloon_data._id, balloon_data._name);
        }
    }
    void CmdHit(GameObject Obj, string Color, int WordNumber)
    {
        //GameObject BalloonPoints = GameObject.Find ("BalloonPoints").gameObject;
        //GameObject PracticeBalloonPoints = GameObject.Find ("PracticeBalloonPoints").gameObject;

        GameObject PointShow = Instantiate(pointshow);
        int        pointword = 0;

        if (Obj.tag == "P1")
        {
            if (Color == "red")
            {
                GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_Score += 1;
                PointShow.GetComponentInChildren <ParticleSystemRenderer> ().material            = pointwords [0];
                pointword = 0;
                if (WordNumber < 5)
                {
                    GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_WordGet [WordNumber] = true;
                    GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_HitPosition          = this.transform.position;
                    Rpc_ScoreChange(1);
                }
                else
                {
                    GameObject.Find("PracticeBalloonPoints").GetComponent <CreatePracticeBalloons> ().practicecheck [BalloonNumber] = true;
                    Rpc_Practicehit(1);
                }
            }
            else if (Color == "blue")
            {
                GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_Score -= 1;
                PointShow.GetComponentInChildren <ParticleSystemRenderer> ().material            = pointwords [1];
                pointword = 1;
                if (WordNumber < 5)
                {
                    for (var i = 0; i < GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_WordGet.Length; i++)
                    {
                        GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_WordGet [i] = false;
                    }
                    Rpc_ScoreChange(2);
                }
                else
                {
                    GameObject.Find("PracticeBalloonPoints").GetComponent <CreatePracticeBalloons> ().practicecheck [BalloonNumber] = true;
                    Rpc_Practicehit(2);
                }
            }
            else if (Color == "green")
            {
                pointword = 2;
                if (WordNumber == 6)
                {
                    GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P1_Ready = true;
                }
                else
                {
                    GameObject.Find("PracticeBalloonPoints").GetComponent <CreatePracticeBalloons> ().P1_repractice = true;
                }
            }
            else
            {
                pointword = 2;
                if (isServer)
                {
                    CmdQuit();
                }
                else
                {
                    Application.Quit();
                }
            }
        }
        if (Obj.tag == "P2")
        {
            if (Color == "blue")
            {
                GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_Score += 1;
                PointShow.GetComponentInChildren <ParticleSystemRenderer> ().material            = pointwords [0];
                pointword = 0;
                if (WordNumber < 5)
                {
                    GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_WordGet [WordNumber] = true;
                    GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_HitPosition          = this.transform.position;
                    Rpc_ScoreChange(3);
                }
                else
                {
                    GameObject.Find("PracticeBalloonPoints").GetComponent <CreatePracticeBalloons> ().practicecheck [BalloonNumber] = true;
                    Rpc_Practicehit(3);
                }
            }
            else if (Color == "red")
            {
                GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_Score -= 1;
                PointShow.GetComponentInChildren <ParticleSystemRenderer> ().material            = pointwords [1];
                pointword = 1;
                if (WordNumber < 5)
                {
                    for (var i = 0; i < GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_WordGet.Length; i++)
                    {
                        GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_WordGet[i] = false;
                    }
                    Rpc_ScoreChange(4);
                }
                else
                {
                    GameObject.Find("PracticeBalloonPoints").GetComponent <CreatePracticeBalloons> ().practicecheck [BalloonNumber] = true;
                    Rpc_Practicehit(4);
                }
            }
            else if (Color == "green")
            {
                pointword = 2;
                if (WordNumber == 6)
                {
                    GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().P2_Ready = true;
                }
                else
                {
                    GameObject.Find("PracticeBalloonPoints").GetComponent <CreatePracticeBalloons> ().P2_repractice = true;
                }
            }
            else
            {
                pointword = 2;
                if (isServer)
                {
                    CmdQuit();
                }
                else
                {
                    Application.Quit();
                }
            }
        }
        if (WordNumber < 5)
        {
            if ((((GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().ReCreateBallooList.Count + 1) * 3.0f)
                 < (GameObject.Find("BalloonPoints").GetComponent <GetReady> ().countdowntime - 1.0f)))
            {
                GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().EmptyPositions.Add(BalloonNumber);
                BalloonData data = new BalloonData();
                data.BalloonColor = Color;
                data.WordNumber   = WordNumber;
                GameObject.Find("BalloonPoints").GetComponent <BalloonCreateSystem> ().ReCreateBallooList.Add(data);
            }
        }
        GameObject createpaticle = Instantiate(paticles);

        createpaticle.transform.position = this.transform.position;
        PointShow.transform.position     = this.transform.position + new Vector3(0.0f, 0.5f, 0.0f);
        NetworkServer.Spawn(createpaticle);
        NetworkServer.Spawn(PointShow);
        createpaticle.GetComponent <ParticleSystem> ().Play();
        if (pointword < 2)
        {
            PointShow.GetComponent <ParticleSystem> ().Play();
        }
        createpaticle.GetComponent <AudioSource> ().Play();

        Rpc_Createpaticle(createpaticle, PointShow, pointword, this.gameObject);

        NetworkServer.Destroy(Obj);
        NetworkServer.Destroy(this.gameObject);
    }
 private void SetRadius(Representation.node v, BalloonData data)
 {
     data.r = (int)Math.Max(data.d / 2, minRadius);
 }