Example #1
0
    //装备枪支
    void AdornGun(GUN type, Text priceText)
    {
        GUN oldType;

        OwnList[type]  = true;                                    //储存为装备中
        priceText.text = "装备中";                                   //标记为已装备
        GunManager.SetUseGun(type, out oldType);                  //装备
        if (OwnList.ContainsKey(oldType))
        {
            OwnList[oldType] = false;                                            //储存为装备中
        }
        switch (oldType)
        {
        case GUN.ak47: akPriceText.text = "已拥有"; break;

        case GUN.m16: m16PriceText.text = "已拥有"; break;

        case GUN.m9: m9PriceText.text = "已拥有"; break;

        case GUN.mk12: mk12PriceText.text = "已拥有"; break;

        case GUN.mp5: mp5PriceText.text = "已拥有"; break;

        default: break;
        }
    }
 new void Start()
 {
     base.Start();
     lerp        = this.GetComponent <lerpColor>();
     _velocidade = 10.0F;
     currentGun  = GUN.SHOOT;
 }
    public void updateAOE(GUN spell)//bool activate)
    {
        AoE.gameObject.SetActive(true);
        Color _newColor = Color.clear;

        switch (currentGun)
        {
        case GUN.SHOOT:
            AoE.gameObject.SetActive(false);
            break;

        case GUN.EXPLOSIVE:
            _newColor = Color.red;
            break;

        case GUN.MAGNETIC:
            _newColor = Color.yellow;
            break;

        case GUN.FREEZING:
            _newColor = Color.cyan;
            break;
        }
        _newColor.a = 0.7f;
        AoE.GetComponent <Renderer>().material.color = _newColor;
        //AoE.GetComponent<checkValidSpot>().canPlant = activate;
        //AoE.GetComponent<checkValidSpot>().setColor();
    }
Example #4
0
    public void BuyGun(GUN type)
    {
        switch (type)
        {
        case GUN.ak47:
            if (!OwnList.ContainsKey(GUN.ak47))
            {
                Buy(akPrice, type, akPriceText);
            }
            else if (!OwnList[type])
            {
                AdornGun(type, akPriceText);
            }
            break;

        case GUN.mp5:
            if (!OwnList.ContainsKey(GUN.mp5))
            {
                Buy(mp5Price, type, mp5PriceText);
            }
            else if (!OwnList[type])
            {
                AdornGun(type, mp5PriceText);
            }
            break;

        case GUN.m9:
            if (!OwnList.ContainsKey(GUN.m9))
            {
                Buy(m9Price, type, m9PriceText);
            }
            else if (!OwnList[type])
            {
                AdornGun(type, m9PriceText);
            }
            break;

        case GUN.m16:
            if (!OwnList.ContainsKey(GUN.m16))
            {
                Buy(m16Price, type, m16PriceText);
            }
            else if (!OwnList[type])
            {
                AdornGun(type, m16PriceText);
            }
            break;

        case GUN.mk12:
            if (!OwnList.ContainsKey(GUN.mk12))
            {
                Buy(mk12Price, type, mk12PriceText);
            }
            else if (!OwnList[type])
            {
                AdornGun(type, mk12PriceText);
            }
            break;
        }
    }
Example #5
0
 void Start()
 {
     transform.Translate(0f, 0f, zslide);
     rb.velocity = transform.right * speed;
     bl          = GameObject.FindGameObjectWithTag("bullet").GetComponent <Rigidbody2D>();
     gunscript   = GetComponent <GUN>();
 }
Example #6
0
        public Networking()
        {
            try
            {
                GUN.Init();

                AttributeManager = new AttributeManager();

                Client = new GUNetClient(new GUNClientSettings(AttributeManager, "1.0", IPAddress.Parse("127.0.0.1"), 8888, false, true));

                AttributeManager.AddClass(this);

                new Thread(() =>
                {
                    while (Client != null)
                    {
                        try
                        {
                            if (!Client.Connected)
                            {
                                if (!Client.Connecting)
                                {
                                    try
                                    {
                                        Client.ConnectToServer();
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                            else
                            {
                                Client.HandleNetworkingData();
                            }

                            MainWindow.Instance.Dispatcher.Invoke(() =>
                            {
                                if (Client != null && Client.Connected)
                                {
                                    MainWindow.Instance.Title = "BOSShop - Verbunden";
                                }
                                else
                                {
                                    MainWindow.Instance.Title = "BOSShop";
                                }
                            });
                        }
                        catch
                        {
                        }
                        Thread.Sleep(1);
                    }
                }).Start();
            }
            catch
            {
            }
        }
Example #7
0
    // Update is called once per frame
    void Update()
    {
        GameObject UZI       = GameObject.Find("Ak47");
        GUN        gunScript = UZI.GetComponent <GUN>();

        //Debug.Log(gunScript.numofbulletsak47);
        numberleftUZI = 20 - gunScript.numofbulletsUZI;
        GetComponent <Text>().text = numberleftUZI + "/20";
    }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        GameObject Ak47      = GameObject.Find("Ak47");
        GUN        gunScript = Ak47.GetComponent <GUN>();

        //Debug.Log(gunScript.numofbulletsak47);
        numberleftak47             = 30 - gunScript.numofbulletsak47;
        GetComponent <Text>().text = numberleftak47 + "/30";
    }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        GameObject pistol    = GameObject.Find("Ak47");
        GUN        gunScript = pistol.GetComponent <GUN>();

        //Debug.Log(gunScript.numofbulletsak47);
        bulletsleftpistol          = 12 - gunScript.numofbulletspistol;
        GetComponent <Text>().text = bulletsleftpistol + "/12";
    }
Example #10
0
 //设置携带枪支
 public static void SetUseGun(GUN gunType, out GUN oldGun)
 {
     oldGun = GUN.none;
     if (useGun.Count >= maxGunNum)
     {
         oldGun = useGun[0];
         useGun.RemoveAt(0);
     }
     useGun.Add(gunType);
 }
Example #11
0
 void Buy(float price, GUN gunType, Text priceText)
 {
     if (StaticData.PlayerMoney >= price)
     {
         StaticData.PlayerMoney -= price;                       //收钱
         PlayerMoneyShow(StaticData.PlayerMoney);               //刷新金钱显示
         OwnList.Add(gunType, false);                           //交货
         priceText.text = "已拥有";                                //标记为已拥有
         hintPanel.Open();
         hintPanel.SetHint("再次点击按钮装备此枪支");
     }
 }
Example #12
0
    // Update is called once per frame
    void Update()
    {
        GameObject ak47      = GameObject.Find("Ak47");
        GUN        gunScript = ak47.GetComponent <GUN>();

        totalbulletsleftak47 = 180 - gunScript.totalbulletsak47;

        GetComponent <Text>().text = totalbulletsleftak47 + "";
        if (totalbulletsleftak47 < 0)
        {
            GetComponent <Text>().text = 0 + "";
        }
    }
Example #13
0
    // Update is called once per frame
    void Update()
    {
        GameObject usi       = GameObject.Find("Ak47");
        GUN        gunScript = usi.GetComponent <GUN>();

        totalbulletsleftuzi = 200 - gunScript.totalbulletsUZI;

        GetComponent <Text>().text = totalbulletsleftuzi + "";
        if (totalbulletsleftuzi < 0)
        {
            GetComponent <Text>().text = 0 + "";
        }
    }
Example #14
0
        static void Main(string[] args)
        {
            GUN.Init();

            AttributeManager = new AttributeManager();

            Server = new GUNetServer(new GUNServerSettings(AttributeManager, "1.0", IPAddress.Parse("127.0.0.1"), 8888, false, 12, 12, 0, true, new NullAuthenticator()));

            Server.StartServer();

            WebServer = new WebServer();

            AttributeManager.AddClass(new ClientCommunicator());

            new Thread(InputThread).Start();

            while (true)
            {
                Server.HandleNetworkingData();
                Console.Title = "Server - " + Server.Clients.Count;
                Thread.Sleep(1);
            }
        }
    void Update()
    {
        //só verifica se não estiver pausado o jogo
        //if (GameManager.Instance.isPaused)
        //{
        //    return;
        //}
        //mouse controller
        if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0)
        {
            Vector3 mousePos  = Input.mousePosition;
            Vector3 objectPos = Camera.main.WorldToScreenPoint(transform.position);
            mousePos.x -= objectPos.x;
            mousePos.y -= objectPos.y;
            float angle = (Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg) - 90;
            transform.rotation = Quaternion.Euler(new Vector3(0, -angle, 0));
        }


        /*JOY TEST*/
        float Xon = Mathf.Abs(Input.GetAxis("Joy X"));

        if (Xon > 0.1)
        {
            this.transform.Rotate(0, Input.GetAxis("Joy X") * joysensitivityX, 0);
        }


        if (Input.GetKeyDown(KeyCode.Space) || Input.GetButtonUp("Fire"))
        {
            //if (currentGun == GUN.SHOOT)
            //{
            //    Shoot();
            //}
            //else
            //{
            //    if (AoE.GetComponent<checkValidSpot>().canPlant)
            //    {
            //        PutTrap();
            //    }
            //    else
            //    {
            //    //    UIManager.Instance.showFeedback("Not Enough Mana");
            //    }
            //}
        }
        else if (Input.GetKeyDown(KeyCode.Tab) || Input.GetMouseButtonDown(1) || Input.GetButtonUp("WeaponPlus"))
        {
            gunChanged  = true;
            validChoice = false;

            tempGun = currentGun;
            if ((int)tempGun == 3)
            {
                tempGun = GUN.SHOOT;
            }
            else
            {
                tempGun++;
            }
        }
        else if (Input.GetButtonUp("WeaponLess"))
        {
            gunChanged  = true;
            validChoice = false;

            tempGun = currentGun;
            if ((int)tempGun == 0)
            {
                tempGun = GUN.FREEZING;
            }
            else
            {
                tempGun--;
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1) || (tempGun == GUN.SHOOT && gunChanged))
        {
            tempGun = GUN.SHOOT;
            //  EventManager.TriggerEvent(Events.usingGun);
            validChoice = true;
        }

        if (Input.GetKeyDown(KeyCode.Alpha2) || Input.GetKeyDown(KeyCode.Keypad2) || (tempGun == GUN.EXPLOSIVE && gunChanged))
        {
            tempGun = GUN.EXPLOSIVE;
            //    EventManager.TriggerEvent(Events.usingBomb);
            validChoice = true;
        }

        if (Input.GetKeyDown(KeyCode.Alpha3) || Input.GetKeyDown(KeyCode.Keypad3) || (tempGun == GUN.MAGNETIC && gunChanged))
        {
            tempGun = GUN.MAGNETIC;
            //  EventManager.TriggerEvent(Events.usingBomb);
            validChoice = true;
        }

        if (Input.GetKeyDown(KeyCode.Alpha4) || Input.GetKeyDown(KeyCode.Keypad4) || (tempGun == GUN.FREEZING && gunChanged))
        {
            tempGun = GUN.FREEZING;
            //   EventManager.TriggerEvent(Events.usingBomb);
            validChoice = true;
        }

        if (validChoice && gunChanged)
        {
            //   EventManager.TriggerEvent(Events.UIUpdate);
            currentGun = tempGun;
            updateAOE(currentGun);
            gunChanged  = false;
            validChoice = false;
        }
    }