예제 #1
0
 public void setTree(CoinObject p, int c)
 {
     tree     = true;
     parent   = p;
     children = c;
     //Debug.Log("parent: " + parent);
 }
예제 #2
0
    private int createSubtree(int sides, int steps, Mobius root, CoinObject parent)
    {
        int count = 0;

        Mobius mob = new Mobius(root);

        mob.compose(new Mobius(0, Math.Cos(Math.PI / sides), false));
        CoinObject co = createCoin(mob.apply(new Vector3(0, 1, 0), true));

        co.setTree(parent, sides - 1);
        if (parent == null)
        {
            co = null;
            count++;
        }

        steps--;
        if (steps <= 0)
        {
            if (parent != null)
            {
                co.activate();
            }
            return(count);
        }

        mob.compose(new Mobius(Math.PI));
        for (int i = 0; i < sides - 1; i++)
        {
            mob.compose(new Mobius(Mathf.PI * 2 / sides));
            count += createSubtree(sides, steps, mob, co);
        }
        return(count);
    }
예제 #3
0
    // Start is called before the first frame update
    void Start()
    {
        dist         = 1.098612f;
        ptr          = new GameObject().transform;
        ptr.position = new Vector3(0, 0, 0);
        CoinObject co = createCoin(ptr.position);

        co.setTree(null, 1);
        int sides = numberOfSides;
        int steps = maximumSteps - 1;

        if (steps <= 0)
        {
            return;
        }

        createSubtree(sides, steps, co);

        int count = 0;

        for (int i = 0; i < sides - 1; i++)
        {
            ptr.Rotate(0, 360f / sides, 0);
            count += createSubtree(sides, steps, null);
        }

        Destroy(ptr.gameObject);
        transform.GetComponent <EuclideanPlane>().setTree(count);
    }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        CoinObject co = createCoin(new Vector3(0, 1, 0));

        co.setTree(null, 1);
        Mobius mob   = new Mobius();
        int    sides = numberOfSides;
        int    steps = maximumSteps - 1;

        if (steps <= 0)
        {
            return;
        }

        createSubtree(sides, steps, mob, co);

        int count = 0;

        for (int i = 0; i < sides - 1; i++)
        {
            mob.compose(new Mobius(Math.PI * 2 / sides));
            count += createSubtree(sides, steps, mob, null);
        }

        transform.GetComponent <HyperbolicPlane>().setTree(count);
    }
예제 #5
0
 void RetreiveData()
 {
     thisCoin             = CoinObjectList.GetCoinInfo(coinID);
     thisImage.sprite     = thisCoin.coinImage;
     gemValueText.text    = thisCoin.gemValue.ToString();
     coinText.text        = thisCoin.coinValue.ToString();
     descriptionText.text = thisCoin.description;
 }
예제 #6
0
        private void ListBoxSelectionChange()
        {
            CoinObject coinObject = listBoxCoinObjects.SelectedItem as CoinObject;

            textBoxCoinHSpeedScale.Text  = coinObject.HSpeedScale.ToString();
            textBoxCoinVSpeedScale.Text  = coinObject.VSpeedScale.ToString();
            textBoxCoinVSpeedOffset.Text = coinObject.VSpeedOffset.ToString();
            textBoxCoinParamOrder.Text   = coinObject.CoinParamOrder.ToString();
            textBoxCoinNumCoins.Text     = coinObject.NumCoins.ToString();
        }
예제 #7
0
    public void OnCoinPurchase(int coinID)
    {
        CoinObject coin = CoinObjectList.GetCoinInfo(coinID);

        if (PlayerPrefs.GetInt("Gem") >= coin.gemValue)
        {
            OnShopChangedCoin(coin.coinValue);
            OnshopChangedGem(-coin.gemValue);
        }
    }
예제 #8
0
    private int createSubtree(int sides, int steps, CoinObject parent)
    {
        int count = 0;
        int sign  = (steps % 2) * 2 - 1;

        ptr.Translate(new Vector3(sign * dist * (5f / 13), 0, dist * (12f / 13)));
        CoinObject co = createCoin(ptr.position);

        co.setTree(parent, 1);
        if (parent == null)
        {
            co = null;
            count++;
        }

        ptr.Translate(new Vector3(-sign * dist * (5f / 13), 0, dist * (12f / 13)));
        CoinObject co2 = createCoin(ptr.position);

        co2.setTree(co, sides - 1);
        if (co == null)
        {
            co2 = null;
            count++;
        }

        steps--;
        if (steps <= 0)
        {
            if (co2 != null)
            {
                co2.activate();
            }
            ptr.Translate(new Vector3(0, 0, -2 * dist * (12f / 13)));
            return(count);
        }

        /*ptr.Rotate(0, 180f * angleScale, 0);
         * for (int i = 0; i < sides - 1; i++) {
         *  ptr.Rotate(0, 360f / sides * angleScale, 0);
         *  count += createSubtree(sides, steps, co);
         * }
         *      for (int i = 0; i < sides - 1; i++) {
         *  ptr.Rotate(0, -360f / sides * angleScale, 0);
         * }
         *      ptr.Rotate(0, -180f * angleScale, 0);*/

        ptr.Rotate(0, -45, 0);
        count += createSubtree(sides, steps, co2);
        ptr.Rotate(0, 90, 0);
        count += createSubtree(sides, steps, co2);
        ptr.Rotate(0, -45, 0);

        ptr.Translate(new Vector3(0, 0, -2 * dist * (12f / 13)));
        return(count);
    }
예제 #9
0
    public void OnClickGold()
    {
        if (imageGoldIcon.fillAmount < 1)
        {
            UIPopupManager.ShowInstantPopup("세금이 충분히 모이지 않았습니다.");
            return;
        }

        if (coroutineScaleImage != null)
        {
            StopCoroutine(coroutineScaleImage);
            coroutineScaleImage = null;
        }
        coroutineScaleImage = StartCoroutine(ScaleImage());

        if (currentGoldAmount > 0)
        {
            if (spawnCoroutine != null)
            {
                return;
            }
            coinAmount        = currentGoldAmount * Probability();
            currentGoldAmount = 0;
            taxCount          = 0;
            OnSave();

            imageBGGoldIcon.gameObject.SetActive(false);

            spawnCoroutine = StartCoroutine(Spawn());

            imageBGGoldIcon.sprite = spriteGoldList[0];
            imageGoldIcon.sprite   = spriteGoldList[0];

            //particleSystem.gameObject.SetActive(true);

            slot = UIMoney.Instance.shopMoneyGoldText.gameObject.AddComponent <UIMoneySlot>();
            //slot.isUserMoney = true;
            //slot.moneyType = MoneyType.gold;
            money = new MoneyManager.Money();
            MoneyManager.Money m = MoneyManager.GetMoney(MoneyType.gold);
            money.id    = m.id;
            money.value = m.value;
            money.type  = m.type;

            slot.textValue = UIMoney.Instance.shopMoneyGoldText;
            slot.Init(money);
            CoinObject coin = CreatCoinObject();
            coin.Init(coinAmount, coinParent);
            coin.gameObject.SetActive(true);

            //사운드 재생
            soundPlayerTakeCoins.Play();
        }
        //AutoGoldGenStart();
    }
예제 #10
0
    /// <summary> 골드 획득 </summary>
    public void TakeTax(Transform target, double taxAmount)
    {
        if (target == null)
        {
            target = coinParent;
        }

        taxAmount *= (1d + (percentIncreaseTaxAmount * 0.01d));

        // 주민 머리위 골드 연출
        CoinObject coin = CreatCoinObject();

        coin.Init(taxAmount, target);
        coin.gameObject.SetActive(true);



        Tax(taxAmount);
    }
예제 #11
0
    CoinObject CreatCoinObject()
    {
        CoinObject coin = null;

        for (int i = 0; i < coinObjectPool.Count; i++)
        {
            if (coinObjectPool[i].gameObject.activeSelf == false)
            {
                coin = coinObjectPool[i];
                break;
            }
        }
        if (coin == null)
        {
            GameObject go = Instantiate(coinObjectPrefab);
            go.transform.SetParent(coinParent, false);
            coin = go.GetComponent <CoinObject>();
            coinObjectPool.Add(coin);
        }

        return(coin);
    }
 void Update()
 {
     //initialize bord if data had recevied
     if (!bordInitialized)
     {
         foreach (Vector3 vec in walles)
         {
             Instantiate(wall, vec, initializingRotation);
         }
         foreach (Vector3 vec in stones)
         {
             Instantiate(stone, vec, initializingRotation);
         }
         foreach (Vector3 vec in waters)
         {
             Instantiate(water, vec, initializingRotation);
         }
         bordInitialized = true;
     }
     while (coinsToDraw.Count > 0)
     {
         CoinObject c = coinsToDraw[0];
         coinsToDraw.RemoveAt(0);
         GameObject game = Instantiate(coin, c.getPosition(), initializingRotation) as GameObject;
         //Send data to coin. So that it can work independently later
         game.SendMessage("setValues", new int[] { c.getTimeLeft(), c.getCoinValue() });
         UnityEngine.Debug.logger.Log("Coin   " + c.getX() + "," + c.getY() + " " + c.getCoinValue() + "  time" + c.getTimeLeft());
     }
     while (healthToDraw.Count > 0)
     {
         HealthObject c = healthToDraw[0];
         healthToDraw.RemoveAt(0);
         GameObject game = Instantiate(health, c.getPosition(), initializingRotation) as GameObject;
         //Send data to coin. So that it can work independently later
         game.SendMessage("setValues", c.getTimeLeft());
         UnityEngine.Debug.logger.Log("Health   " + c.getX() + "," + c.getY() + "  time" + c.getTimeLeft());
     }
 }
예제 #13
0
        public override void InitializeTab()
        {
            base.InitializeTab();
            ControlUtilities.SetTableDoubleBuffered(dataGridViewCoin, true);

            listBoxCoinObjects.DataSource = CoinObject.GetCoinObjects();
            listBoxCoinObjects.ClearSelected();
            listBoxCoinObjects.SelectedValueChanged += (sender, e) => ListBoxSelectionChange();

            buttonCoinCalculate.Click += (sender, e) => CalculateCoinTrajectories();
            buttonCoinClear.Click     += (sender, e) => ClearCoinTrajectories();

            Color lightBlue   = Color.FromArgb(235, 255, 255);
            Color lightPink   = Color.FromArgb(255, 240, 255);
            Color lightYellow = Color.FromArgb(255, 255, 220);

            dataGridViewCoin.Columns[0].DefaultCellStyle.BackColor = lightBlue;
            dataGridViewCoin.Columns[1].DefaultCellStyle.BackColor = lightBlue;
            dataGridViewCoin.Columns[2].DefaultCellStyle.BackColor = lightPink;
            dataGridViewCoin.Columns[3].DefaultCellStyle.BackColor = lightYellow;
            dataGridViewCoin.Columns[4].DefaultCellStyle.BackColor = lightYellow;
            dataGridViewCoin.Columns[5].DefaultCellStyle.BackColor = lightYellow;
        }
예제 #14
0
        private void CalculateCoinTrajectories()
        {
            ClearCoinTrajectories();

            double?hSpeedScale          = ParsingUtilities.ParseIntNullable(textBoxCoinHSpeedScale.Text);
            double?vSpeedScale          = ParsingUtilities.ParseIntNullable(textBoxCoinVSpeedScale.Text);
            double?vSpeedOffset         = ParsingUtilities.ParseIntNullable(textBoxCoinVSpeedOffset.Text);
            bool   coinParamOrderParsed = Enum.TryParse(textBoxCoinParamOrder.Text, out CoinParamOrder coinParamOrder);
            int?   numCoins             = ParsingUtilities.ParseIntNullable(textBoxCoinNumCoins.Text);

            if (!hSpeedScale.HasValue ||
                !vSpeedScale.HasValue ||
                !vSpeedOffset.HasValue ||
                !coinParamOrderParsed ||
                !numCoins.HasValue)
            {
                DialogUtilities.DisplayMessage(
                    "Could not parse coin param fields.",
                    "Parsing Error");
                return;
            }

            CoinObject coinObject = new CoinObject(
                hSpeedScale: hSpeedScale.Value,
                vSpeedScale: vSpeedScale.Value,
                vSpeedOffset: vSpeedOffset.Value,
                coinParamOrder: coinParamOrder,
                numCoins: numCoins.Value,
                name: "Dummy");

            int?startingRngIndexNullable = ParsingUtilities.ParseIntNullable(
                textBoxCoinCustomizatonStartingRngIndex.Text);
            int startingRngIndex = startingRngIndexNullable ?? RngIndexer.GetRngIndex();

            int?numDecimalDigitsNullable = ParsingUtilities.ParseIntNullable(
                textBoxCoinCustomizatonNumDecimalDigits.Text);
            int numDecimalDigits = numDecimalDigitsNullable ?? 3;

            List <int> rngIndexes = Enumerable.Range(0, 65114).ToList();

            foreach (int rngIndex in rngIndexes)
            {
                // rng based values
                ushort rngValue = RngIndexer.GetRngValue(rngIndex);
                int    rngToGo  = MoreMath.NonNegativeModulus(rngIndex - startingRngIndex, 65114);

                // coin trajectory
                List <CoinTrajectory> coinTrajectories = coinObject.CalculateCoinTrajectories(rngIndex);

                // filter the values
                CoinTrajectoryFilter filter = new CoinTrajectoryFilter(
                    ParsingUtilities.ParseDoubleNullable(textBoxCoinFilterHSpeedMin.Text),
                    ParsingUtilities.ParseDoubleNullable(textBoxCoinFilterHSpeedMax.Text),
                    ParsingUtilities.ParseDoubleNullable(textBoxCoinFilterVSpeedMin.Text),
                    ParsingUtilities.ParseDoubleNullable(textBoxCoinFilterVSpeedMax.Text),
                    ParsingUtilities.ParseDoubleNullable(textBoxCoinFilterAngleMin.Text),
                    ParsingUtilities.ParseDoubleNullable(textBoxCoinFilterAngleMax.Text),
                    ParsingUtilities.ParseIntNullable(textBoxCoinFilterRequiredNumOfQualifiedCoins.Text));
                if (!filter.Qualifies(coinTrajectories))
                {
                    continue;
                }

                if (!checkBoxCoinCustomizatonDisplayNonQualifiedCoinsOfAQualifiedCoinGroup.Checked)
                {
                    coinTrajectories = coinTrajectories.FindAll(
                        coinTrajectory => filter.Qualifies(coinTrajectory));
                }

                List <double> hSpeedList = coinTrajectories.ConvertAll(
                    coinTrajectory => Math.Round(coinTrajectory.HSpeed, numDecimalDigits));
                List <double> vSpeedList = coinTrajectories.ConvertAll(
                    coinTrajectory => Math.Round(coinTrajectory.VSpeed, numDecimalDigits));
                List <ushort> angleList = coinTrajectories.ConvertAll(
                    coinTrajectory => coinTrajectory.Angle);

                object hSpeedJoined = hSpeedList.Count == 1 ? hSpeedList[0] : (object)String.Join(", ", hSpeedList);
                object vSpeedJoined = vSpeedList.Count == 1 ? vSpeedList[0] : (object)String.Join(", ", vSpeedList);
                object angleJoined  = angleList.Count == 1 ? angleList[0] : (object)String.Join(", ", angleList);

                // add a new row to the table
                dataGridViewCoin.Rows.Add(
                    rngIndex, rngValue, rngToGo, hSpeedJoined, vSpeedJoined, angleJoined);
            }
        }
    void listen()
    {
        try
        {
            //UnityEngine.Debug.logger.Log("Thread started");
            // Create the listener providing the IP Address and the port to listen on.
            var listener = new TcpListener(IPAddress.Parse("127.0.0.1"), 7000);
            listener.Start();

            // Listen in an endless loop.
            while (true)
            {
                // We will store the textual representation of the bytes we receive.
                string value;

                // Accept the sender and take message as a stream.
                using (var networkStream = listener.AcceptTcpClient().GetStream())
                {
                    // Create a memory stream to copy the message.

                    var bytes = new System.Collections.Generic.List <byte>();

                    int asw = 0;
                    while (asw != -1)
                    {
                        asw = networkStream.ReadByte();
                        bytes.Add((Byte)asw);
                    }

                    // Convert bytes to text.
                    value = Encoding.UTF8.GetString(bytes.ToArray());
                }
                String[] datas = value.Split(':');
                UnityEngine.Debug.logger.Log(datas[0] + "   " + value);
                if (datas[0].Equals("I"))
                {
                    String walls = datas[2];
                    walles = getVecotors(walls);
                    String stone = datas[3];
                    stones = getVecotors(stone);
                    String water = datas[4].Trim();
                    //At the end String there are unwanter  characters. one is # and other is a unicode
                    water           = water.Substring(0, water.Length - 2);
                    waters          = getVecotors(water);
                    bordInitialized = false;
                }
                else if (datas[0].ToUpper().Equals("C"))
                {
                    String[] cod           = datas[1].Split(',');
                    Vector3  coinPosition  = new Vector3(Int32.Parse(cod[0]), -Int32.Parse(cod[1]));
                    int      coinCountTime = Int32.Parse(datas[2]);
                    datas[3] = datas[3].Trim();
                    datas[3] = datas[3].Substring(0, datas[3].Length - 2);
                    int        coinValue = Int32.Parse(datas[3]);
                    CoinObject o         = new CoinObject(coinPosition, coinValue, coinCountTime);
                    coinsToDraw.Add(o);
                    //UnityEngine.Debug.logger.Log("Coin   " + coinPosition.x+","+coinPosition.y+" "+coinValue+"  time"+coinCountTime);
                }
                else if (datas[0].ToUpper().Equals("L"))
                {
                    String[] cod            = datas[1].Split(',');
                    Vector3  healthPosition = new Vector3(Int32.Parse(cod[0]), -Int32.Parse(cod[1]));
                    datas[2] = datas[2].Trim();
                    datas[2] = datas[2].Substring(0, datas[2].Length - 2);
                    int          healthCountTime = Int32.Parse(datas[2]);
                    HealthObject he = new HealthObject(healthPosition, healthCountTime);
                    healthToDraw.Add(he);
                    //UnityEngine.Debug.logger.Log("Health   " + healthPosition.x + "," + healthPosition.y + " " + healthCountTime);
                }
                // Call an external function (void) given.

                //else if (datas[0].ToUpper().Equals("P"))
                //{
                //Debug.logger.Log(datas.ToString());
                // Tank Status Update [Pn;x,y;d;shot;health;coins;points]

                /*var state = d.Split(';');
                 * var currentTank = tanks[int.Parse(state[0].Substring(1))];
                 * currentTank.x = int.Parse(state[1].Split(',')[0]);
                 * currentTank.y = int.Parse(state[1].Split(',')[1]);
                 * currentTank.direction = (Direction)int.Parse(state[2]);
                 * currentTank.isShot = int.Parse(state[3]) == 1;
                 * currentTank.health = int.Parse(state[4]);
                 * currentTank.coins = int.Parse(state[5]);
                 * currentTank.points = int.Parse(state[6]);*/
                //}
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception occured");
        }
    }
예제 #16
0
    void listen()
    {
        try
        {
            var listener = new TcpListener(IPAddress.Parse("127.0.0.1"), 7000);
            listener.Start();

            while (true)
            {
                string value;

                using (var networkStream = listener.AcceptTcpClient().GetStream())
                {
                    var bytes = new List <byte>();

                    int asw = 0;
                    while (asw != -1)
                    {
                        asw = networkStream.ReadByte();
                        bytes.Add((Byte)asw);
                    }

                    value = Encoding.UTF8.GetString(bytes.ToArray());
                }
                String[] datas = value.Split(':');
                if (datas[0].Equals("I"))
                {
                    String walls = datas[2];
                    wallList = getVecotors(walls);
                    String stone = datas[3];
                    stoneList = getVecotors(stone);
                    String water = datas[4].Trim();
                    water       = water.Substring(0, water.Length - 2);
                    waterList   = getVecotors(water);
                    bordcreated = false;
                }
                else if (datas[0].ToUpper().Equals("C"))
                {
                    String[] cod           = datas[1].Split(',');
                    Vector3  coinPosition  = new Vector3(Int32.Parse(cod[0]), -Int32.Parse(cod[1]));
                    int      coinCountTime = Int32.Parse(datas[2]);
                    datas[3] = datas[3].Trim();
                    datas[3] = datas[3].Substring(0, datas[3].Length - 2);
                    int        coinValue = Int32.Parse(datas[3]);
                    CoinObject o         = new CoinObject(coinPosition, coinValue, coinCountTime);
                    coinsToDraw.Add(o);
                }
                else if (datas[0].ToUpper().Equals("L"))
                {
                    String[] cod            = datas[1].Split(',');
                    Vector3  healthPosition = new Vector3(Int32.Parse(cod[0]), -Int32.Parse(cod[1]));
                    datas[2] = datas[2].Trim();
                    datas[2] = datas[2].Substring(0, datas[2].Length - 2);
                    int          healthCountTime = Int32.Parse(datas[2]);
                    HealthObject he = new HealthObject(healthPosition, healthCountTime);
                    healthToDraw.Add(he);
                }

                else if (datas[0].ToUpper().Equals("G"))
                {
                    var tanks = datas;

                    for (int i = 1; i < tanks.Length - 1; i++)
                    {
                        String[] pdata = tanks[i].Split(';');
                        if (true)
                        {
                            String pShot   = pdata[3];
                            String pHealth = pdata[4];
                            String pCoins  = pdata[5];
                            String pPoints = pdata[6];

                            List <string> temp = new List <string>();
                            temp.Add(pdata[0]);
                            temp.Add(pdata[1]);
                            temp.Add(pdata[2]);

                            toInstanciate.Enqueue(temp);
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception occured");
        }
    }
예제 #17
0
        public CoinManager(TabPage tabControl)
        {
            // set controls

            SplitContainer splitContainerCoin = tabControl.Controls["splitContainerCoin"] as SplitContainer;

            _dataGridViewCoin = splitContainerCoin.Panel2.Controls["dataGridViewCoin"] as DataGridView;

            _listBoxCoinObjects = splitContainerCoin.Panel1.Controls["listBoxCoinObjects"] as ListBox;

            _textBoxCoinHSpeedScale  = splitContainerCoin.Panel1.Controls["textBoxCoinHSpeedScale"] as BetterTextbox;
            _textBoxCoinVSpeedScale  = splitContainerCoin.Panel1.Controls["textBoxCoinVSpeedScale"] as BetterTextbox;
            _textBoxCoinVSpeedOffset = splitContainerCoin.Panel1.Controls["textBoxCoinVSpeedOffset"] as BetterTextbox;
            _textBoxCoinParamOrder   = splitContainerCoin.Panel1.Controls["textBoxCoinParamOrder"] as BetterTextbox;
            _textBoxCoinNumCoins     = splitContainerCoin.Panel1.Controls["textBoxCoinNumCoins"] as BetterTextbox;

            _labelCoinHSpeedRange  = splitContainerCoin.Panel1.Controls["labelCoinHSpeedRange"] as Label;
            _labelCoinVSpeedRange  = splitContainerCoin.Panel1.Controls["labelCoinVSpeedRange"] as Label;
            _labelCoinTableEntries = splitContainerCoin.Panel1.Controls["labelCoinTableEntries"] as Label;

            GroupBox groupBoxCoinFilter = splitContainerCoin.Panel1.Controls["groupBoxCoinFilter"] as GroupBox;

            _textBoxCoinFilterHSpeedMin = groupBoxCoinFilter.Controls["textBoxCoinFilterHSpeedMin"] as BetterTextbox;
            _textBoxCoinFilterHSpeedMax = groupBoxCoinFilter.Controls["textBoxCoinFilterHSpeedMax"] as BetterTextbox;
            _textBoxCoinFilterVSpeedMin = groupBoxCoinFilter.Controls["textBoxCoinFilterVSpeedMin"] as BetterTextbox;
            _textBoxCoinFilterVSpeedMax = groupBoxCoinFilter.Controls["textBoxCoinFilterVSpeedMax"] as BetterTextbox;
            _textBoxCoinFilterAngleMin  = groupBoxCoinFilter.Controls["textBoxCoinFilterAngleMin"] as BetterTextbox;
            _textBoxCoinFilterAngleMax  = groupBoxCoinFilter.Controls["textBoxCoinFilterAngleMax"] as BetterTextbox;
            _textBoxCoinFilterRequiredNumOfQualifiedCoins =
                groupBoxCoinFilter.Controls["textBoxCoinFilterRequiredNumOfQualifiedCoins"] as BetterTextbox;

            GroupBox groupBoxCoinCustomization =
                splitContainerCoin.Panel1.Controls["groupBoxCoinCustomization"] as GroupBox;

            _checkBoxCoinCustomizatonDisplayNonQualifiedCoinsOfAQualifiedCoinGroup =
                groupBoxCoinCustomization.Controls[
                    "checkBoxCoinCustomizatonDisplayNonQualifiedCoinsOfAQualifiedCoinGroup"] as CheckBox;
            _textBoxCoinCustomizatonNumDecimalDigits =
                groupBoxCoinCustomization.Controls["textBoxCoinCustomizatonNumDecimalDigits"] as BetterTextbox;
            _textBoxCoinCustomizatonStartingRngIndex =
                groupBoxCoinCustomization.Controls["textBoxCoinCustomizatonStartingRngIndex"] as BetterTextbox;

            _buttonCoinClear     = splitContainerCoin.Panel1.Controls["buttonCoinClear"] as Button;
            _buttonCoinCalculate = splitContainerCoin.Panel1.Controls["buttonCoinCalculate"] as Button;

            // initialize controls

            ControlUtilities.SetTableDoubleBuffered(_dataGridViewCoin, true);

            _listBoxCoinObjects.DataSource = CoinObject.GetCoinObjects();
            _listBoxCoinObjects.ClearSelected();
            _listBoxCoinObjects.SelectedValueChanged += (sender, e) => ListBoxSelectionChange();

            _buttonCoinCalculate.Click += (sender, e) => CalculateCoinTrajectories();
            _buttonCoinClear.Click     += (sender, e) => ClearCoinTrajectories();

            Color lightBlue   = Color.FromArgb(235, 255, 255);
            Color lightPink   = Color.FromArgb(255, 240, 255);
            Color lightYellow = Color.FromArgb(255, 255, 220);

            _dataGridViewCoin.Columns[0].DefaultCellStyle.BackColor = lightBlue;
            _dataGridViewCoin.Columns[1].DefaultCellStyle.BackColor = lightBlue;
            _dataGridViewCoin.Columns[2].DefaultCellStyle.BackColor = lightPink;
            _dataGridViewCoin.Columns[3].DefaultCellStyle.BackColor = lightYellow;
            _dataGridViewCoin.Columns[4].DefaultCellStyle.BackColor = lightYellow;
            _dataGridViewCoin.Columns[5].DefaultCellStyle.BackColor = lightYellow;
        }
        void DownCollisions()
        {
            float directionY = -1;
            float rayLenght  = 0.1f + skinWidth;

            for (int i = 0; i < verticalRayCount; i++)
            {
                Vector2 rayOrigin = (directionY == -1) ? raycastOrigins.bottomLeft : raycastOrigins.topLeft;
                rayOrigin += Vector2.right * (verticalRaySpacing * i);
                RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.up * directionY, rayLenght, collisionMask);

                //Debug.DrawRay(rayOrigin, Vector2.up * directionY, Color.red);

                if (hit)
                {
                    if (hit.collider.CompareTag("SlowFall"))
                    {
                        collisions.slowTime = true;
                    }

                    if (hit.collider.CompareTag("TV"))
                    {
                        hit.collider.GetComponent <TextBoxActivate>().PlayerHit();
                        collisions.hitTV = true;
                    }

                    if (hit.collider.CompareTag("Dog"))
                    {
                        DogColetaTutorial dogTutorial = hit.collider.GetComponent <DogColetaTutorial>();
                        dogTutorial.AtivaDog();
                    }
                    if (hit.collider.tag == "Boost")
                    {
                        collisions.boostMoto = true;
                    }

                    if (hit.collider.CompareTag("PortaTutorial"))
                    {
                        collisions.isDoor = true;
                        PortaTutorial porta = hit.collider.GetComponent <PortaTutorial>();
                        porta.abriPorta = true;
                        return;
                    }
                    if (hit.collider.CompareTag("TextBox"))
                    {
                        hit.collider.GetComponent <TextBoxActivate>().PlayerHit();
                    }

                    if (hit.collider.CompareTag("Porta"))
                    {
                        collisions.isDoor = true;
                        hit.collider.GetComponent <PortaManager>().OpenDoor();
                        continue;
                    }

                    if (hit.collider.CompareTag("Coletavel"))
                    {
                        DestroyColetavel2D coletavel2D = hit.collider.GetComponent <DestroyColetavel2D>();
                        coletavel2D.PegouColetavel(true);
                        playerThings.PV.RPC("SendOnlineCollisions", RpcTarget.Others);
                        FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Feedback/Coletaveis/ColetaDoOsso");

                        Scored();
                    }

                    if (hit.collider.CompareTag("Moedinha"))
                    {
                        //hit.collider.gameObject.SendMessage("Coleta");
                        //Destroy(hit.collider.gameObject);
                        CoinObject coin = hit.collider.GetComponent <CoinObject>();
                        coin.PegouMoeda();
                    }

                    if (hit.collider.CompareTag("Carrinho"))
                    {
                        //dogController.Carro();
                        dogController.ChangeState("CarroState");
                        hitCarro.Value = false;
                        if (isDogNormal == true)
                        {
                            FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Feedback/Coletaveis/TransformaDog");
                            isDogNormal = false;
                        }
                    }

                    if (hit.collider.CompareTag("Pipa"))
                    {
                        //dogController.Pipa();
                        dogController.ChangeState("PipaState");
                        hitPipa.Value = false;
                        if (isDogNormal == true)
                        {
                            FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Feedback/Coletaveis/TransformaDog");
                            isDogNormal = false;
                        }
                    }

                    if (hit.collider.CompareTag("Futebol"))
                    {
                        collisions.cabecaBola = true;
                    }

                    if (hit.collider.CompareTag("GolSelect"))
                    {
                        GolSelect select = hit.collider.GetComponent <GolSelect>();
                        select.jogador = playerThings.GetComponent <PlayerThings>();
                        //hit.collider.GetComponent<BoxCollider2D>().enabled = false;
                        select.photonView.RPC("DesabilitaColider", RpcTarget.All);
                    }

                    if (hit.collider.CompareTag("CaixaDagua"))
                    {
                        if (isCaixaDaguaSound == true)
                        {
                            StartCoroutine(TocaSomCaixaDeAgua());
                        }
                        collisions.caixaDagua = true;
                    }
                }
            }
        }
        void LeftCollisions()
        {
            float directionX = -1;
            float rayLenght;

            //if (isBallGame && PlayerThings.leftDir&& futebolPlayer.kicked == true || handVolei.cortou)
            if (leftRay)
            {
                rayLenght = hitLenght + skinWidth;
            }
            else
            {
                rayLenght = 0.1f + skinWidth;
            }

            for (int i = 0; i < horizontalRayCount; i++)
            {
                Vector2 rayOrigin = (directionX == -1) ? raycastOrigins.bottomLeft : raycastOrigins.bottomRight;
                rayOrigin += Vector2.up * (horizontalRaySpacing * i);
                RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.right * directionX, rayLenght, collisionMask);

                //Debug.DrawRay(rayOrigin, Vector2.right * directionX, Color.red);

                if (hit)
                {
                    if (hit.collider.CompareTag("TV"))
                    {
                        hit.collider.GetComponent <TextBoxActivate>().PlayerHit();
                        collisions.hitTV = true;
                    }

                    if (hit.collider.CompareTag("Dog"))
                    {
                        DogColetaTutorial dogTutorial = hit.collider.GetComponent <DogColetaTutorial>();
                        dogTutorial.AtivaDog();
                    }
                    if (hit.collider.CompareTag("Pet"))
                    {
                        if (hit.distance == 0)
                        {
                            collisions.hitDog = true;
                        }
                    }
                    if (hit.collider.CompareTag("Boost"))
                    {
                        collisions.boostMoto = true;
                    }

                    if (hit.collider.CompareTag("PortaTutorial"))
                    {
                        collisions.isDoor = true;
                        PortaTutorial porta = hit.collider.GetComponent <PortaTutorial>();
                        porta.abriPorta = true;
                        return;
                    }
                    if (hit.collider.CompareTag("TextBox"))
                    {
                        hit.collider.GetComponent <TextBoxActivate>().PlayerHit();
                    }
                    if (hit.collider.CompareTag("Porta"))
                    {
                        collisions.isDoor = true;
                        hit.collider.GetComponent <PortaManager>().OpenDoor();
                        continue;
                    }

                    if (hit.collider.CompareTag("Coletavel"))
                    {
                        DestroyColetavel2D coletavel2D = hit.collider.GetComponent <DestroyColetavel2D>();
                        coletavel2D.PegouColetavel(true);
                        playerThings.PV.RPC("SendOnlineCollisions", RpcTarget.Others);
                        FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Feedback/Coletaveis/ColetaDoOsso");

                        Scored();
                    }
                    if (hit.collider.CompareTag("Moedinha"))
                    {
                        //hit.collider.gameObject.SendMessage("Coleta");
                        CoinObject coin = hit.collider.GetComponent <CoinObject>();
                        coin.PegouMoeda();
                    }

                    if (hit.collider.CompareTag("Carrinho"))
                    {
                        //dogController.Carro();
                        dogController.ChangeState("CarroState");
                        hitCarro.Value = false;
                        if (isDogNormal == true)
                        {
                            FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Feedback/Coletaveis/TransformaDog");
                            isDogNormal = false;
                        }
                    }

                    if (hit.collider.CompareTag("Pipa"))
                    {
                        //dogController.Pipa();
                        dogController.ChangeState("PipaState");
                        hitPipa.Value = false;
                        if (isDogNormal == true)
                        {
                            FMODUnity.RuntimeManager.PlayOneShot("event:/SFX/Feedback/Coletaveis/TransformaDog");
                            isDogNormal = false;
                        }
                    }

                    if (hit.collider.CompareTag("DogTiro"))
                    {
                        playerThings.StartCoroutine("LevouDogada");
                        if (isShotRecived)
                        {
                            StartCoroutine(TocaSomTiroDoDog());
                        }
                    }

                    if (hit.collider.CompareTag("Volei"))
                    {
                        if (PlayerThings.rightDir)
                        {
                            collisions.tocouBola = true;
                            if (isBallKicked)
                            {
                                StartCoroutine(TocaSomChutaBola());
                            }
                        }

                        if (PlayerThings.leftDir)
                        {
                            collisions.cortaBola = true;
                            if (isBallKicked)
                            {
                                StartCoroutine(TocaSomChutaBola());
                            }
                        }
                    }

                    if (hit.collider.CompareTag("Futebol"))
                    {
                        if (PlayerThings.rightDir)
                        {
                            if (hit.distance == 0)
                            {
                                collisions.tocouBola = true;
                                if (isBallKicked)
                                {
                                    StartCoroutine(TocaSomChutaBola());
                                }
                            }
                        }

                        if (PlayerThings.leftDir)
                        {
                            collisions.chutouBola = true;
                            if (isBallKicked)
                            {
                                StartCoroutine(TocaSomChutaBola());
                            }
                        }
                    }

                    if (hit.collider.CompareTag("AI"))
                    {
                        if (PlayerThings.leftDir)
                        {
                            footballFSM           = hit.collider.GetComponent <FootballFSMController>();
                            collisions.canKickBot = true;
                            futebolPlayer.KickBot(footballFSM);
                        }
                    }

                    if (hit.collider.CompareTag("LinhaDeChegada"))
                    {
                        hit.collider.gameObject.GetComponent <LinhaDeChegada>().Colidiu(gameObject);
                    }
                }
            }
        }
예제 #20
0
    void Update()
    {
        if (!bordcreated)
        {
            foreach (Vector3 vec in wallList)
            {
                Instantiate(wall, vec, initializingRotation);
            }
            foreach (Vector3 vec in stoneList)
            {
                Instantiate(stone, vec, initializingRotation);
            }
            foreach (Vector3 vec in waterList)
            {
                Instantiate(water, vec, initializingRotation);
            }

            bordcreated = true;
        }

        while (coinsToDraw.Count > 0)
        {
            CoinObject c = coinsToDraw[0];
            coinsToDraw.RemoveAt(0);
            GameObject game = Instantiate(coin, c.getPosition(), initializingRotation) as GameObject;
            game.SendMessage("setValues", new int[] { c.getTimeLeft(), c.getCoinValue() });
            UnityEngine.Debug.logger.Log("Coin   " + c.getX() + "," + c.getY() + " " + c.getCoinValue() + "  time" + c.getTimeLeft());
        }

        while (healthToDraw.Count > 0)
        {
            HealthObject c = healthToDraw[0];
            healthToDraw.RemoveAt(0);
            GameObject game = Instantiate(health, c.getPosition(), initializingRotation) as GameObject;
            game.SendMessage("setValues", c.getTimeLeft());
            UnityEngine.Debug.logger.Log("Health   " + c.getX() + "," + c.getY() + "  time" + c.getTimeLeft());
        }

        while (toInstanciate.Count > 0)
        {
            //toInstanciate.RemoveAt(0);
            List <string> list = toInstanciate.Dequeue() as List <string>;


            String[] cod       = list[1].ToString().Split(',');
            Vector3  pPosition = new Vector3(Int32.Parse(cod[0]), -Int32.Parse(cod[1]));

            Quaternion rotation   = Quaternion.Euler(0, 0, 0);
            int        pDirection = Int32.Parse(list[2].ToString());
            if (pDirection == 0)
            {
                rotation = Quaternion.Euler(0, 0, 0);
            }
            if (pDirection == 1)
            {
                rotation = Quaternion.Euler(0, 0, -90);
            }
            if (pDirection == 2)
            {
                rotation = Quaternion.Euler(0, 0, 180);
            }
            if (pDirection == 3)
            {
                rotation = Quaternion.Euler(0, 0, 90);
            }

            /*if (list[0].ToString()=="P0")
             * {
             *  if (!isInstanciate)
             *  {
             *      GameObject clone = (GameObject)Instantiate(player, pPosition, rotation);
             *      //Destroy(clone, 1.25f);
             *      isInstanciate = true;
             *  }
             * }*/

            if (list[0].ToString() == "P0")
            {
                GameObject clone = (GameObject)Instantiate(tank, pPosition, rotation);
                Destroy(clone, 1.25f);
            }

            if (list[0].ToString() == "P1")
            {
                GameObject clone = (GameObject)Instantiate(tank, pPosition, rotation);
                Destroy(clone, 1.25f);
            }

            if (list[0].ToString() == "P2")
            {
                GameObject clone = (GameObject)Instantiate(tank, pPosition, rotation);
                Destroy(clone, 1.25f);
            }

            if (list[0].ToString() == "P3")
            {
                GameObject clone = (GameObject)Instantiate(tank, pPosition, rotation);
                Destroy(clone, 1.25f);
            }

            if (list[0].ToString() == "P4")
            {
                GameObject clone = (GameObject)Instantiate(tank, pPosition, rotation);
                Destroy(clone, 1.25f);
            }

            if (list[0].ToString() == "P5")
            {
                GameObject clone = (GameObject)Instantiate(tank, pPosition, rotation);
                Destroy(clone, 1.25f);
            }
        }
    }