Exemple #1
0
    public static DotFragment CreateDotFragment(DotHandler dotHandler, int level)
    {
        float       size        = level * 1.5f;
        GameObject  gameObj     = Instantiate(GameHandler.gm.FragmentPrefab, dotHandler.gameObject.transform);
        DotFragment Dotfragment = gameObj.GetComponent <DotFragment>();

        Dotfragment.level = level;
        Dotfragment.Draw();
        dotHandler.UpdateRecognition();
        return(Dotfragment);
    }
Exemple #2
0
        public ClickRegist(DotHandler selectdot, DotFragment d = null)
        {
            if (!RoundHandler.energyDistributionState)
            {
                Debug.Log("dotfragments: " + (selectdot.DotFragments.Count) + "  //  " + d.level);
                for (int i = selectdot.DotFragments.Count - 1; i > d.level - 1; i--)
                {
                    Debug.Log("dotfragments: " + selectdot.DotFragments[i]);
                    selectdot.DotFragments[i].SelectColor(true);
                }
                if (selectdot.Owner != RoundHandler.CurrPlayerMove)
                {
                    CancelBuild(6);
                }
                //checks if the player owns this node

                selectedDot = selectdot;


                if (d == null)
                {
                    energyOnSelect = selectedDot.Strength;
                }
                else
                {
                    energyOnSelect = selectedDot.Strength - d.level + 1;
                }
                //initializes energy selected

                AbsConnection = CreateConnection(selectedDot.transform.position, selectedDot.Owner.cam.ScreenToWorldPoint(Input.mousePosition));
                AbsConnection.cube.gameObject.layer = 9;
                selectedDot.OnDrag = true;
                //creates AbsConnection and sets drag to true

                Debug.Log(energyOnSelect + "  //  " + d.level);
                foreach (Connection c in selectdot.Connections)
                {
                    if (c != null)
                    {
                        c.cube.gameObject.layer = 9;
                    }
                }
            }
        }
Exemple #3
0
    public void CreateBlueRing()
    {
        for (int i = 0; i < DotFragments.Count; i++)
        {
            if (DotFragments[i].BlueRing)
            {
                Debug.Log("Destroyed: " + DotFragments[i].gameObject);
                Destroy(DotFragments[i].gameObject);
                DotFragments.RemoveAt(i);
            }
        }
        DotFragment fragment = CreateDotFragment(Strength + 1);

        fragment.gameObject.name = "Blue Ring";
        fragment.BlueRing        = true;
        fragment.Draw();
        DotFragments.Add(fragment);
        fragment.level   = Strength + 1;
        fragment.MainDot = this;
    }
Exemple #4
0
 public void UpdateStrength(int increment)
 {
     if (-Strength - 1 < increment)
     {
         //handle visual change
         int times = 0;
         int i     = increment;
         while (increment != 0 || times > 100)
         {
             if (increment > 0)
             {
                 DotFragment fragment = CreateDotFragment(Strength + 1);
                 DotFragments.Add(fragment);
                 fragment.level   = Strength + 1;
                 fragment.MainDot = this;
                 i++;
                 increment--;
                 Strength++;
             }
             if (increment < 0)
             {
                 if (DotFragments.Count > 0)
                 {
                     Destroy(DotFragments[DotFragments.Count - 1].gameObject);
                     DotFragments.RemoveAt(DotFragments.Count - 1);
                     increment++;
                 }
                 else
                 {
                     Debug.Log("could not change strength, an error occured: " + increment + "  //  " + DotFragments.Count);
                 }
                 Strength--;
             }
             times++;
         }
     }
     else
     {
         Debug.Log("could not do that: " + -Strength + "  //  " + increment);
     }
 }