Inheritance: MonoBehaviour
Exemplo n.º 1
0
    public static List<Bottle> LoadBottles()
    {
        List<Bottle> result = new List<Bottle> ();

        Bottle b1 = new Bottle () {name = "B1", level = 3};
        List<GenericBall> gbList1 = new List<GenericBall> ();
        gbList1.Add (new GenericBall () {typeName = "GA1"});
        gbList1.Add (new GenericBall () {typeName = "GA2"});
        gbList1.Add (new GenericBall () {typeName = "GA3"});
        gbList1.Add (new GenericBall () {typeName = "GA4"});
        b1.genericBalls = gbList1;
        result.Add (b1);

        Bottle b2 = new Bottle () {name = "B2", level = 2};
        List<GenericBall> gbList2 = new List<GenericBall> ();
        gbList2.Add (new GenericBall () {typeName = "GB1"});
        gbList2.Add (new GenericBall () {typeName = "GB2"});
        gbList2.Add (new GenericBall () {typeName = "GB3"});
        b2.genericBalls = gbList2;
        result.Add (b2);

        Bottle b3 = new Bottle () {name = "B3", level = 1};
        List<GenericBall> gbList3 = new List<GenericBall> ();
        gbList3.Add (new GenericBall () {typeName = "GC1"});
        gbList3.Add (new GenericBall () {typeName = "GC2"});
        gbList3.Add (new GenericBall () {typeName = "GC3"});
        b3.genericBalls = gbList3;
        result.Add (b3);

        return result;
    }
Exemplo n.º 2
0
    // Use this for initialization
    protected override void Start()
    {
        prefab = bottlesource.GetComponent<Bottle> ();

        health = 10;
        damageDealt = 5;
        range = 2;
        hasBottle = true;

        base.Start();
    }
Exemplo n.º 3
0
        // plz no
        public Tuple<int, int, string, Bottle> PlaceOf(Bottle bottle)
        {
            foreach(var aisle in Aisles)
            {
                var place = aisle.Bottles.FirstOrDefault(x => x.Item3 == bottle);
                if (place != null)
                    return new Tuple<int, int, string, Bottle>(place.Item1, place.Item2, aisle.Name, place.Item3);
            }

            return null;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Throwing bottle depends on character class
        /// </summary>
        /// <param name="keyEvent"></param>
        /// <returns></returns>
        public Bottle ThrowBottle(KeyEventArgs keyEvent)
        {
            if (keyEvent == null)
            {
                throw new ArgumentNullException("keyEvent", "KeyEvent was null");
            }
            switch (keyEvent.KeyCode)
            {
            case Keys.Space:
                break;

            default:
                break;
            }
            Bottle bottle = Player.CharacterClass.ThrowBottle(Player.PlayerObject.Location.X, Player.PlayerObject.Location.Y);

            return(bottle);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Insert a new bottle in to the system
        /// </summary>
        /// <param name="bottle">Bottle information</param>
        /// <returns></returns>
        private async Task GetNewBottle(Bottle bottle)
        {
            if (_systemState != State.Idle)
            {
                throw new StateViolationException();
            }
            if (CurrentShelf.AvailableSlots() < 1)
            {
                _systemState = State.GetNewBottle;
            }
            CurrentShelf.AddBottle(bottle);
            var location = CurrentShelf.Find(bottle.BottleId);

            Log.InfoEx("GetNewBottle", $"Getting a new bottle {bottle.Name} with ID: {bottle.BottleId} to location {location}");
            await _robot.GetNewBottle(location);

            _systemState = State.Idle;
        }
        public JsonResult AddDriftBottle(Bottle bottle)
        {
            //Bottle bottle = new Bottle();
            if (string.IsNullOrWhiteSpace(bottle.Massage))
            {
                return(Json(new Result(false, "多少说点东西!"), JsonRequestBehavior.AllowGet));
            }
            if (bottle.Massage.Length > 300)
            {
                return(Json(new Result(false, "内容太多了!"), JsonRequestBehavior.AllowGet));
            }

            string currentUserNanme = "妩媚的阳光";

            //如果是管理员丢瓶子,则随机名字
            if (CurrentInfo.CurrentUser.ID == 6)
            {
                Random rd = new Random();
                currentUserNanme = NetUserNames.NetUserGirl[rd.Next(0, NetUserNames.NetUserGirl.Count)];
            }
            else
            {
                currentUserNanme = CurrentInfo.CurrentUser.RealName;
            }

            bottle.FishingCount   = 0;
            bottle.CreateTime     = DateTime.Now;
            bottle.CreateUserID   = CurrentInfo.CurrentUser.ID;
            bottle.Sexual         = CurrentInfo.CurrentUser.Sexual;
            bottle.CreateUserName = currentUserNanme;

            bottle.LastReplyMassage = bottle.Massage;
            bottle.LastReplyUserID  = CurrentInfo.CurrentUser.ID;;


            bottle.LastReplyUserName = currentUserNanme;
            bottle.LastReplyTime     = DateTime.Now;
            bottle.CreateViewTime    = DateTime.Now;
            bottle.ReplyViewTime     = DateTime.Now;
            bool flage = bottle.Add() == null ? false : true;

            return(Json(new Result(flage, ResultType.Add), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
 private static void DoOperations(int[] operations, Bottle bottle1, Bottle bottle2, List <int> storage)
 {
     bottle1.Empty();
     bottle2.Empty();
     foreach (var operation in operations)
     {
         if (operation == 0)
         {
             bottle1.FillToTopFromTap();
         }
         else if (operation == 1)
         {
             bottle2.FillToTopFromTap();
         }
         else if (operation == 2)
         {
             bottle2.Fill(bottle1.Empty());
         }
         else if (operation == 3)
         {
             bottle1.Fill(bottle2.Empty());
         }
         else if (operation == 4)
         {
             bottle2.FillToTop(bottle1);
         }
         else if (operation == 5)
         {
             bottle1.FillToTop(bottle2);
         }
         else if (operation == 6)
         {
             bottle1.Empty();
         }
         else if (operation == 7)
         {
             bottle2.Empty();
         }
         //if (storage.Count > 300) storage = new List<int>();
         storage.Add(bottle1.Content);
         storage.Add(bottle2.Content);
     }
 }
Exemplo n.º 8
0
        protected override void get(Bottle command, Bottle reply)
        {
            string key = command.get(0).asString().c_str();

            switch (key)
            {
            case "w": reply.addInt((cvz as CVZ_MMCM).Width); break;

            case "h": reply.addInt((cvz as CVZ_MMCM).Height); break;

            case "l": reply.addInt((cvz as CVZ_MMCM).Layers); break;

            case "lrate": reply.addDouble((cvz as CVZ_MMCM).LearningRate); break;

            case "sigma": reply.addDouble((cvz as CVZ_MMCM).Sigma); break;

            default: base.get(command, reply); break;
            }
        }
Exemplo n.º 9
0
    private void setNewPotion(Bottle bottle, String newPotionName)
    {
        audioSource.Play();

        var success = false;

        for (var i = 0; i < bottle.potions.Length; i++)
        {
            if (newPotionName == bottle.potions[i].name)
            {
                bottle.SetPotion(i);
                success = true;
            }
        }

        if (!success)
        {
            throw new Exception("Potion assigned here is not available in bottle prefab");
        }
    }
Exemplo n.º 10
0
        public override bool respond(Bottle command, Bottle reply)
        {
            string key = command.get(0).asString().c_str();

            switch (key)
            {
            case "set": set(command.tail(), reply); break;

            case "get": get(command.tail(), reply); break;

            case "run": isRunning = true; reply.addString("started"); break;

            case "pause": isRunning = false; reply.addString("paused"); break;

            case "quit": return(false);

            default: reply.addString("unknown command"); break;
            }
            return(true);
        }
Exemplo n.º 11
0
        private Rectangle?GetTotalColumnPosition(Bottle bottle)
        {
            int  left = totalHeaderControl.Left, top = 0, width = totalHeaderControl.Width, height = 0;
            bool found = false;

            foreach (Control ctrl in rowHeaderLayoutPanel.Controls)
            {
                if (ctrl is BottleRowHeaderControl && ((BottleRowHeaderControl)ctrl).bottle == bottle)
                {
                    top    = ctrl.Top;
                    height = ctrl.Height;
                    found  = true;
                }
            }
            if (!found)
            {
                return(null);
            }
            return(new Rectangle(left, top, width, height));
        }
Exemplo n.º 12
0
        public Player(string name, int positionX, int positionY, int points, ICharacterClass characterClass, Bottle bottle, PictureBox playerObject)
        {
            Name                = name;
            PositionX           = positionX;
            PositionY           = positionY;
            Points              = points;
            Bottle              = bottle;
            this.PlayerObject   = playerObject;
            this.CharacterClass = characterClass;
            Color               = new PlayerColor(characterClass);

            //Gets stats from player characterClass
            PlayerStats stats = characterClass.GetStats();

            HealthPoints = stats.HealthPoints;
            Damage       = stats.Damage;
            Color2       = stats.Color;
            Speed        = stats.Speed;
            PointsBoost  = stats.PointsBoost;
        }
        private void GetParameters(object sender, EventArgs e)
        {
            Bottle cmd = new Bottle();
            Bottle rep = new Bottle();

            cmd.clear(); rep.clear();
            cmd.addString("get");
            cmd.addString("w");
            rpcOut.write(cmd, rep);
            r_w = rep.get(0).asInt();

            cmd.clear(); rep.clear();
            cmd.addString("get");
            cmd.addString("h");
            rpcOut.write(cmd, rep);
            r_h = rep.get(0).asInt();

            cmd.clear(); rep.clear();
            cmd.addString("get");
            cmd.addString("lrate");
            rpcOut.write(cmd, rep);
            textBoxLearningRate.Text = rep.get(0).asDouble().ToString();

            cmd.clear(); rep.clear();
            cmd.addString("get");
            cmd.addString("period");
            rpcOut.write(cmd, rep);
            textBoxPeriod.Text = rep.get(0).asInt().ToString();

            cmd.clear(); rep.clear();
            cmd.addString("get");
            cmd.addString("fbInf");
            rpcOut.write(cmd, rep);
            feedbakcTextBoxInfluence.Text = rep.get(0).asDouble().ToString();

            //Map infos
            labelMapInfo.Text =
                "Map infos: " +
                "Width = " + r_w + " " +
                "Height = " + r_h + " ";
        }
Exemplo n.º 14
0
        public BottleEdit(Bottle i_bottle)
        {
            InitializeComponent();
            bottle = i_bottle;

            BottleName.Text = bottle.name;
            BottleEAN.Text  = bottle.EAN.ToString();
            /* if only full bottles are counted */
            if (bottle.full)
            {
                OptionFullBottle.IsVisible = true;
                picker_count.ItemsSource   = countToHundred();
                picker_count.SelectedIndex = bottle.count - 1;
            }
            /* editing the volume of a single bottle */
            else
            {
                OptionIndividualBottle.IsVisible = true;
                // TODO:
            }
        }
Exemplo n.º 15
0
        private void genBottleID()
        {
            string existBottle = null;
            Random rnd         = new Random();
            string id          = "BL" + rnd.Next(100000, 999999);
            Bottle p           = pbda.getOneProductBottleByID(id, Language.getLanguageCode(), conn);

            existBottle = p.getProductID();
            Bottle db = pbda.getOneDeletedBottleByID(id, Language.getLanguageCode(), conn);

            existBottle = db.getProductID();

            if (existBottle != null)
            {
                genBottleID();
            }
            else
            {
                bottleIdTextBox.Text = id;
            }
        }
Exemplo n.º 16
0
        /*
         * Packing Bottles
         */
        private void BoxingBottle(int nr)
        {
            String myName = "Counting" + nr;

            Trace.TraceInformation($"{myName} is started");

            List <Bottle> bottleBox;

            while (true)
            {
                bottleBox = new List <Bottle>();
                for (int i = 0; i < 24; i++)
                {
                    Bottle b = toppedBottles.Take();
                    Thread.Sleep(5 + rnd.Next(10));
                    b.State = "Boxing";
                    bottleBox.Add(b);
                    TraceBottle(b);
                }
                boxOfBottles.Insert(bottleBox);
            }
        }
Exemplo n.º 17
0
        public int update(Bottle bottle, MySqlConnection conn)
        {
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("UPDATE `product_bottle` SET `Product_Name_en-US`=@productNameEnUs,`Product_Name_zh-Hant`=@productNameZhHant,`Description_en-US`=@descriptionEnUs,`Description_zh-Hant`=@descriptionZhHant,`Photo`=@photo,`Supplier_ID`=@supplierID,`Qty_In_Stock`=@qtyInStock,`Price`=@price,`Bottle_Capacity`=@bottleCapacity,`Release_Date`=@releaseDate WHERE `Product_ID`=@productID", conn);

            cmd.Parameters.AddWithValue("@productID", bottle.getProductID());
            cmd.Parameters.AddWithValue("@productNameEnUs", bottle.getProductNameEnUs());
            cmd.Parameters.AddWithValue("@productNameZhHant", bottle.getProductNameZhHant());
            cmd.Parameters.AddWithValue("@descriptionEnUs", bottle.getDescriptionEnUs());
            cmd.Parameters.AddWithValue("@descriptionZhHant", bottle.getDescriptionZhHant());
            cmd.Parameters.AddWithValue("@photo", ImageConverter.imageToByteArray(bottle.getPhoto()));
            cmd.Parameters.AddWithValue("@supplierID", bottle.getSupplierID());
            cmd.Parameters.AddWithValue("@qtyInStock", bottle.getQtyInStock());
            cmd.Parameters.AddWithValue("@price", bottle.getPrice());
            cmd.Parameters.AddWithValue("@bottleCapacity", bottle.getBottleCapacity());
            cmd.Parameters.AddWithValue("@releaseDate", bottle.getReleaseDate().ToString("yyyy-MM-dd HH:mm:ss"));
            cmd.Prepare();
            int i = cmd.ExecuteNonQuery();

            conn.Close();
            return(i);
        }
Exemplo n.º 18
0
    public void OnDrop(PointerEventData eventData)
    {
        Bottle     bottle  = gameObject.GetComponent <Bottle>();
        GameObject labelGo = eventData.pointerDrag;

        if (bottle.colorMat == labelGo.GetComponent <LabelDrag>().matchingColorMat)
        {
            if (bottle.transform.GetChild(1).GetComponent <MeshRenderer>().material.color != bottle.glassColorMat.color)
            {
                bottle.ChangeGlassColor();

                GameManager.instance.AddToScore(5);

                GameManager.instance.Part1TOPart2();
            }
        }
        else
        {
            GameManager.instance.AddToScore(-3);
            //animation X
        }
    }
Exemplo n.º 19
0
        public async Task <ActionResult> Create_bottles([Bind(Include = "Name,Year,Size,styles,taste,C_Description,Food_Pairing,C_image,link")] Bottle bottles)
        {
            if (ModelState.IsValid)
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(apiBaseAddress);

                    var response = await client.PostAsJsonAsync("bottles/Create", bottles);

                    if (response.IsSuccessStatusCode)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, "Server error try after some time.");
                    }
                }
            }
            return(View(bottles));
        }
Exemplo n.º 20
0
        private void BottleRadioButton_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = sender as RadioButton;

            bottles = jh.ReadBottlesJsonToList();
            int buttonNumber = 0;

            if (rb != null)
            {
                for (int i = 0; i < 12; i++)
                {
                    if (IOinitialized)
                    {
                        _pins[i].Write(GpioPinValue.Low);
                    }
                }
                string buttonName = rb.Content.ToString().ToLower();
                if (buttonName == "stop")
                {
                    currentTime           = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                    newValue.Text         = ((int)((currentTime - startTime) * 10)).ToString();
                    saveButton.Visibility = Visibility.Visible;
                }
                else
                {
                    if (Int32.TryParse(buttonName, out buttonNumber))
                    {
                        if (IOinitialized)
                        {
                            _pins[buttonNumber - 1].Write(GpioPinValue.High);
                        }
                        startTime     = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                        bottle        = bottles.Find(x => x.BottleNumber == buttonNumber);
                        oldValue.Text = bottle.Calibration.ToString();
                        newValue.Text = "0";
                    }
                }
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Read the real value on the yarp port.
        /// </summary>
        public override void ReadRealValue()
        {
            if (forcedValue != null && forcedValue.Count() == size)
            {
                RealValue   = forcedValue;
                forcedValue = null;
                return;
            }
            Bottle b = portReal.read(isBlockingRead);

            if (b != null)
            {
                int a = b.size();
                if (b.size() == size)
                {
                    for (int i = 0; i < size; i++)
                    {
                        RealValue[i] = (float)(b.get(i).asDouble() - minBounds[i]) / (maxBounds[i] - minBounds[i]);
                    }
                }
            }
        }
Exemplo n.º 22
0
        public Result WriteBottleToDB(int supply_detail_id, Bottle newBottle)
        {
            using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + dbPath))
            {
                connection.Open();

                string sql = "INSERT INTO " + APP_ALKO_DETAIL_TABLE.table_name +
                             " (" + APP_ALKO_DETAIL_TABLE.supplydetail_id + "," +
                             APP_ALKO_DETAIL_TABLE.mark + "," +
                             APP_ALKO_DETAIL_TABLE.mark_serial + "," +
                             APP_ALKO_DETAIL_TABLE.mark_number + "," +
                             APP_ALKO_DETAIL_TABLE.date_rozliv +
                             ") VALUES (" +
                             supply_detail_id.ToString() + "," +
                             "'" + newBottle.pdf417 + "'," +
                             newBottle.serial + "," +
                             newBottle.number + "," +
                             "'" + newBottle.dateRozliv.ToString("dd.MM.yy") + "')";

                using (SQLiteCommand cmd = new SQLiteCommand(sql, connection))
                {
                    try
                    {
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        return(new Result {
                            success = false, msg = ex.Message
                        });
                    }
                }
            }

            return(new Result {
                success = true
            });
        }
Exemplo n.º 23
0
        public int insert(Bottle bottle, MySqlConnection conn)
        {
            conn.Open();
            MySqlCommand cmd = new MySqlCommand("INSERT INTO `product_bottle`(`Product_ID`, `Product_Name_en-US`, `Product_Name_zh-Hant`, `Description_en-US`, `Description_zh-Hant`, `Photo`, `Supplier_ID`, `Qty_In_Stock`, `Price`, `Bottle_Capacity`, `Release_Date`) " +
                                                "VALUES (@productID,@productNameEnUs,@productNameZhHant,@descriptionEnUs,@descriptionZhHant,@photo,@supplierID,@qtyInStock,@price,@bottleCapacity,@releaseDate)", conn);

            cmd.Parameters.AddWithValue("@productID", bottle.getProductID());
            cmd.Parameters.AddWithValue("@productNameEnUs", bottle.getProductNameEnUs());
            cmd.Parameters.AddWithValue("@productNameZhHant", bottle.getProductNameZhHant());
            cmd.Parameters.AddWithValue("@descriptionEnUs", bottle.getDescriptionEnUs());
            cmd.Parameters.AddWithValue("@descriptionZhHant", bottle.getDescriptionZhHant());
            cmd.Parameters.AddWithValue("@photo", ImageConverter.imageToByteArray(bottle.getPhoto()));
            cmd.Parameters.AddWithValue("@supplierID", bottle.getSupplierID());
            cmd.Parameters.AddWithValue("@qtyInStock", bottle.getQtyInStock());
            cmd.Parameters.AddWithValue("@price", bottle.getPrice());
            cmd.Parameters.AddWithValue("@bottleCapacity", bottle.getBottleCapacity());
            cmd.Parameters.AddWithValue("@releaseDate", bottle.getReleaseDate().ToString("yyyy-MM-dd HH:mm:ss"));
            cmd.Prepare();
            int i = cmd.ExecuteNonQuery();

            conn.Close();
            return(i);
        }
Exemplo n.º 24
0
 private void OrderForm_Deactivate(object sender, EventArgs e)
 {
     evnt.bottles.Clear();
     foreach (DataRow dataRow in dataTable.Rows)
     {
         Bottle bottle = new Bottle()
         {
             name = getString(dataRow["Description"]), vintage = getInt(dataRow["Vintage"]), volume = getDecimal(dataRow["Volume"]), price = getDecimal(dataRow["Price"])
         };
         evnt.bottles.Add(bottle);
         foreach (Member member in members)
         {
             int count = getInt(dataRow[member.Name]);
             if (count > 0)
             {
                 bottle.orders.Add(new Order()
                 {
                     member = member, count = count
                 });
             }
         }
     }
 }
Exemplo n.º 25
0
        private void BReady_Click(object sender, EventArgs e)
        {
            double volume;

            Bottle.TType btype;
            if (TBPrice.Text != "" && CMBType.SelectedItem != null)
            {
                volume = Convert.ToDouble(TBPrice.Text);
                btype  = (Bottle.TType)Enum.Parse(typeof(Bottle.TType), CMBType.SelectedItem.ToString());
            }
            else
            {
                MessageBox.Show("Проверьте значения");
                return;
            }
            object[] value = FMenu.GetCommonData(TBName, TBPrice, TBCount, TBCountry);
            if (value != null)
            {
                Bottle bottle = new Bottle(volume, btype, (string)value[0], (double)value[1], (int)value[2], (string)value[3]);
                Add_Display(bottle, ObjectIndex);
                this.Close();
            }
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            Network.init();
            BufferedPortBottle p = new BufferedPortBottle();

            p.open("/csharp");
            int top = 100;

            for (int i = 1; i < top; i++)
            {
                Bottle bottle = p.prepare();
                bottle.clear();
                bottle.addString("count");
                bottle.addInt32(i);
                bottle.addString("of");
                bottle.addInt32(top);
                Console.WriteLine("Sending " + bottle.toString());
                p.write();
                Time.delay(0.5);
            }
            p.close();
            Network.fini();
        }
Exemplo n.º 27
0
    protected override void PerformPickupAction()
    {
        while (fillAmount > 0)
        {
            Bottle container = InventoryManager.playerInventory.GetAvailableBottle(potionType);
            if (container == null)
            {
                break;
            }
            if (container.containedPotion == null)
            {
                container.containedPotion = GenerateNew();
            }

            GradualFillPotion potion = container.containedPotion as GradualFillPotion;
            fillAmount = potion.Fill(fillAmount);
        }

        if (fillAmount < 0.01f)
        {
            base.PerformPickupAction();
        }
    }
        private void SetParameters(object sender, EventArgs e)
        {
            Bottle cmd = new Bottle();
            Bottle rep = new Bottle();

            cmd.clear(); rep.clear();
            cmd.addString("set");
            cmd.addString("lrate");
            cmd.addDouble(Convert.ToDouble(textBoxLearningRate.Text));
            rpcOut.write(cmd, rep);

            cmd.clear(); rep.clear();
            cmd.addString("set");
            cmd.addString("period");
            cmd.addDouble(Convert.ToDouble(textBoxPeriod.Text));
            rpcOut.write(cmd, rep);

            cmd.clear(); rep.clear();
            cmd.addString("set");
            cmd.addString("fbInf");
            cmd.addDouble(Convert.ToDouble(feedbakcTextBoxInfluence.Text));
            rpcOut.write(cmd, rep);
        }
Exemplo n.º 29
0
 public Bottle findPaths(string key)
 {
     Bottle ret = new Bottle(yarpPINVOKE.ResourceFinder_findPaths(swigCPtr, key), true);
     return ret;
 }
Exemplo n.º 30
0
 public void Refresh()
 {
     bottle = manager.MyHero.UsableAbilities.FirstOrDefault(x => x.Id == AbilityId) as Bottle;
 }
Exemplo n.º 31
0
 public static bool HasLiquid(this Bottle self)
 {
     return /*self.Liquid != null*/ (true);
 }
Exemplo n.º 32
0
 public Bottle(Bottle bottle)
     : this(yarpPINVOKE.new_Bottle__SWIG_2(Bottle.getCPtr(bottle)), true)
 {
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 33
0
 public Bottle tail()
 {
     Bottle ret = new Bottle(yarpPINVOKE.Bottle_tail(swigCPtr), true);
     return ret;
 }
Exemplo n.º 34
0
 public new Bottle findGroup(string key, string comment)
 {
     Bottle ret = new Bottle(yarpPINVOKE.Bottle_findGroup__SWIG_0_1(swigCPtr, key, comment), false);
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 35
0
 public void copy(Bottle alt, int first, int len)
 {
     yarpPINVOKE.Bottle_copy__SWIG_0(swigCPtr, Bottle.getCPtr(alt), first, len);
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 36
0
    private void FixedUpdate()
    {
        if (_pressedE && !Bottle)
        {
            var colliders = new Collider[16];
            var size      = Physics.OverlapSphereNonAlloc(transform.position, raycastRadius, colliders);

            Bottle bottleToGrab = null;
            if (size > 0)
            {
                Collider bottleCollider = null;
                for (var i = 0; i < size; i++)
                {
                    var col = colliders[i];
                    if (col.GetComponent <Bottle>())
                    {
                        Debug.Log("detect bottle");
                        if (!bottleCollider)
                        {
                            Debug.Log("get bottle");
                            bottleToGrab   = col.GetComponent <Bottle>();
                            bottleCollider = col;
                        }

                        if (bottleCollider &&
                            Vector3.Distance(transform.position, bottleCollider.transform.position) >
                            Vector3.Distance(transform.position, col.transform.position))
                        {
                            bottleToGrab   = col.GetComponent <Bottle>();
                            bottleCollider = col;
                        }
                    }
                }
            }

            if (bottleToGrab)
            {
                // todo do something to bottle
                // let's pass in a transform point to hold the bottle
                bottleToGrab.Grab(bottleHoldPoint);
                Bottle = bottleToGrab;
            }

            _pressedE = false;
        }
        else if (_pressedE && Bottle)
        {
            // find the nearest conveyor
            var colliders = new Collider[16];
            var size      = Physics.OverlapSphereNonAlloc(transform.position, raycastRadius, colliders);

            Conveyer conveyerToUse     = null;
            Collider convenyerCollider = null;
            if (size > 0)
            {
                Debug.Log("number found: " + size);
                for (var i = 0; i < size; i++)
                {
                    var col = colliders[i];

                    var conveyer = col.GetComponent <Conveyer>();
                    if (conveyer)
                    {
                        if (!convenyerCollider)
                        {
                            conveyerToUse     = conveyer;
                            convenyerCollider = col;
                        }

                        if (convenyerCollider &&
                            Vector3.Distance(transform.position, convenyerCollider.transform.position) >
                            Vector3.Distance(transform.position, col.transform.position))
                        {
                            conveyerToUse     = conveyer;
                            convenyerCollider = col;
                        }
                    }
                }
            }

            if (conveyerToUse)
            {
                var bottleToPlace = Bottle;
                bottleToPlace.Drop(convenyerCollider.bounds.center + new Vector3(0, convenyerCollider.bounds.center.y + 0.4f));
                Bottle = null;
            }

            _pressedE = false;
        }
        body.MovePosition(transform.position + (_currentMovement * Time.fixedDeltaTime));
        _currentMovement = Vector3.zero;
    }
Exemplo n.º 37
0
 public virtual bool respond(Bottle command, Bottle reply)
 {
     bool ret = yarpPINVOKE.DeviceResponder_respond(swigCPtr, Bottle.getCPtr(command), Bottle.getCPtr(reply));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 38
0
 public void addUsage(Bottle bot)
 {
     yarpPINVOKE.DeviceResponder_addUsage__SWIG_3(swigCPtr, Bottle.getCPtr(bot));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 39
0
 public new void onRead(Bottle v)
 {
     yarpPINVOKE.DeviceResponder_onRead(swigCPtr, Bottle.getCPtr(v));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 40
0
 public new Bottle findGroup(string key, string comment)
 {
     Bottle ret = new Bottle(yarpPINVOKE.Value_findGroup__SWIG_0_0(swigCPtr, key, comment), false);
     return ret;
 }
Exemplo n.º 41
0
 public virtual bool respond(Bottle command, Bottle reply)
 {
     bool ret = (SwigDerivedClassHasMethod("respond", swigMethodTypes5) ? yarpPINVOKE.RFModule_respondSwigExplicitRFModule(swigCPtr, Bottle.getCPtr(command), Bottle.getCPtr(reply)) : yarpPINVOKE.RFModule_respond(swigCPtr, Bottle.getCPtr(command), Bottle.getCPtr(reply)));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 42
0
 public virtual bool tweakSet(Bottle options)
 {
     bool ret = yarpPINVOKE.IGazeControl_tweakSet(swigCPtr, Bottle.getCPtr(options));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 43
0
 public void copy(Bottle alt)
 {
     yarpPINVOKE.Bottle_copy__SWIG_2(swigCPtr, Bottle.getCPtr(alt));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 44
0
 public new void onRead(Bottle datum)
 {
     yarpPINVOKE.BufferedPortBottle_onRead(swigCPtr, Bottle.getCPtr(datum));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 45
0
 public bool notEqual(Bottle alt)
 {
     bool ret = yarpPINVOKE.Bottle_notEqual(swigCPtr, Bottle.getCPtr(alt));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 46
0
 public Bottle prepare()
 {
     Bottle ret = new Bottle(yarpPINVOKE.BufferedPortBottle_prepare(swigCPtr), false);
     return ret;
 }
Exemplo n.º 47
0
 internal static HandleRef getCPtr(Bottle obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Exemplo n.º 48
0
 public bool reply(Bottle data)
 {
     bool ret = yarpPINVOKE.Port_reply__SWIG_1(swigCPtr, Bottle.getCPtr(data));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 49
0
 public static Bottle getNullBottle()
 {
     Bottle ret = new Bottle(yarpPINVOKE.Bottle_getNullBottle(), false);
     return ret;
 }
Exemplo n.º 50
0
 public new bool write(Bottle data1, ImageFloat data2)
 {
     bool ret = yarpPINVOKE.Port_write__SWIG_9(swigCPtr, Bottle.getCPtr(data1), ImageFloat.getCPtr(data2));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
    bool addObject(string obj, string objName, Vector3 objPos, Bottle data = null)
    {
        bool success;

        switch (obj) {

        case "person":
            Debug.Log ("Adding person");
            tempGO = objects["personOriginal"][0];
            if(objPos == Vector3.zero)
            {
                objPos = new Vector3(12,0,0);
            }
            tempGO2 = (GameObject)Instantiate(tempGO);
            tempGO2.SetActive(true);
            //parse bottle to retreive face image and apply to plane

            success = true;
            break;

        default:
            //try loading resource
            tempGO2 = (GameObject) Instantiate(Resources.Load(obj));
            if(tempGO2.transform != null)
            {
                Debug.Log ("Adding " + obj);
                success = true;
                if(objPos == Vector3.zero)
                {
                    objPos = new Vector3(6,7,0);
                }
                //in the future objects will have properties passed from SAM
                success = true;
            }
            else
            {
                Debug.Log ("Object unknown. Not adding");
                success = false;
            }
            break;
        }

        if (success)
        {
            if(objName != "")
            {
                tempGO2.name = objName;
            }
            //make new object child of controller
            tempGO2.transform.parent = this.transform;
            //assign position to new object
            tempGO2.transform.localPosition = objPos;
            //check if name already assigned
            if (!objects.ContainsKey (obj))
            {
                //add new dictionary entry
                objects.Add (obj, new List<GameObject> ());
            }

            objects [obj].Add (tempGO2);
        }
        return success;
    }
Exemplo n.º 52
0
 public virtual bool getInfo(Bottle info)
 {
     bool ret = yarpPINVOKE.IGazeControl_getInfo(swigCPtr, Bottle.getCPtr(info));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Exemplo n.º 53
0
        public override void OnCast()
        {
            if (CheckSequence())
            {
                Item   item = new Dagger();
                string msg  = "You conjure a dagger.";

                switch (Utility.RandomMinMax(1, 28))
                {
                case 1: item = new Apple(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some apples."; break;

                case 2: item = new Arrow(); item.Amount = Utility.RandomMinMax(1, 10); msg = "You conjure some arrows."; break;

                case 3: item = new Backpack(); msg = "You conjure a backpack."; break;

                case 4: item = new Bag(); msg = "You conjure a bag."; break;

                case 5: item = new Bandage(); item.Amount = Utility.RandomMinMax(1, 10); msg = "You conjure some bandages."; break;

                case 6: item = new Bedroll(); msg = "You conjure a bedroll."; break;

                case 7: item = new Beeswax(); msg = "You conjure some beeswax."; break;

                case 8: item = new BlueBook(); msg = "You conjure a book."; break;

                case 9: item = new Bolt(); item.Amount = Utility.RandomMinMax(1, 10); msg = "You conjure some crossbow bolts."; break;

                case 10: item = new Bottle(); msg = "You conjure a bottle."; break;

                case 11: item = new BreadLoaf(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some bread."; break;

                case 12: item = new Candle(); msg = "You conjure a candle."; break;

                case 13: item = new Club(); msg = "You conjure a club."; break;

                case 14: item = new Dagger(); msg = "You conjure a dagger."; break;

                case 15: item = new DarkYarn(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some yarn."; break;

                case 16: item = new FloppyHat(); msg = "You conjure a hat."; break;

                case 17: item = new Jar(); msg = "You conjure a jar."; break;

                case 18: item = new Kindling(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some kindling."; break;

                case 19: item = new Lantern(); msg = "You conjure a lantern."; break;

                case 20: item = new Lockpick(); msg = "You conjure a lockpick."; break;

                case 21: item = new OilCloth(); msg = "You conjure an oil cloth."; break;

                case 22: item = new Pouch(); msg = "You conjure a pouch."; break;

                case 23: item = new Robe(); msg = "You conjure a robe."; break;

                case 24: item = new Shoes(); msg = "You conjure some shoes."; break;

                case 25: item = new SpoolOfThread(); item.Amount = Utility.RandomMinMax(1, 5); msg = "You conjure some thread."; break;

                case 26: item = new TenFootPole(); msg = "You conjure a ten foot pole."; break;

                case 27: item = new Torch(); msg = "You conjure a torch."; break;

                case 28: item = new Waterskin(); msg = "You conjure a waterskin."; break;
                }

                Caster.SendMessage(msg);

                Caster.AddToBackpack(item);

                Caster.FixedParticles(0, 10, 5, 2003, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, EffectLayer.RightHand);
                Caster.PlaySound(0x1E2);

                Server.Misc.Research.ConsumeScroll(Caster, true, spellIndex, true);
            }

            FinishSequence();
        }
Exemplo n.º 54
0
 public new Bottle findGroup(string key)
 {
     Bottle ret = new Bottle(yarpPINVOKE.Bottle_findGroup__SWIG_1(swigCPtr, key), false);
     return ret;
 }
Exemplo n.º 55
0
 public new Bottle findGroup(string key, string comment)
 {
     Bottle ret = new Bottle(yarpPINVOKE.ResourceFinder_findGroup__SWIG_1_0(swigCPtr, key, comment), false);
     return ret;
 }
Exemplo n.º 56
0
 public Bottle addList()
 {
     Bottle ret = new Bottle(yarpPINVOKE.Bottle_addList(swigCPtr), false);
     return ret;
 }
Exemplo n.º 57
0
 public Bottle getContexts()
 {
     Bottle ret = new Bottle(yarpPINVOKE.ResourceFinder_getContexts(swigCPtr), true);
     return ret;
 }
Exemplo n.º 58
0
 public void append(Bottle alt)
 {
     yarpPINVOKE.Bottle_append(swigCPtr, Bottle.getCPtr(alt));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
 }
Exemplo n.º 59
0
        public bool OnCommand(Character chr, string args)
        {
            if (args == null)
            {
                chr.WriteToDisplay("What do you want to close?");
                return(true);
            }

            string[] sArgs = args.Split(" ".ToCharArray());

            if (sArgs[0] == "door")
            {
                #region door
                Cell doorCell = Map.GetCellRelevantToCell(chr.CurrentCell, sArgs[1], true);

                string newGraphic = doorCell.CellGraphic;

                if (doorCell.CellGraphic == Cell.GRAPHIC_CLOSED_DOOR_VERTICAL || doorCell.CellGraphic == Cell.GRAPHIC_CLOSED_DOOR_HORIZONTAL)
                {
                    chr.WriteToDisplay("The door is already closed.");
                    return(true);
                }
                else if (doorCell.CellGraphic != Cell.GRAPHIC_OPEN_DOOR_VERTICAL && doorCell.CellGraphic != @"\ ")
                {
                    chr.WriteToDisplay("You don't see a door there.");
                    return(true);
                }
                else if (Cell.GetCellDistance(chr.X, chr.Y, doorCell.X, doorCell.Y) > 1)
                {
                    chr.WriteToDisplay("The door is too far away.");
                    return(true);
                }
                else if (doorCell.Items.Count > 0 || doorCell.Characters.Count > 0)
                {
                    chr.WriteToDisplay("The doorway is blocked.");
                    return(true);
                }

                CloseDoor(doorCell);
                #endregion
            }
            else if (sArgs[0].ToLower() == "bottle")
            {
                #region bottle
                if (chr.RightHand != null && chr.RightHand.baseType == Globals.eItemBaseType.Bottle)
                {
                    Bottle.CloseBottle((Bottle)chr.RightHand);
                }
                else if (chr.LeftHand != null && chr.LeftHand.baseType == Globals.eItemBaseType.Bottle)
                {
                    Bottle.CloseBottle((Bottle)chr.LeftHand);
                }
                else
                {
                    chr.WriteToDisplay("You are not holding a bottle.");
                }
                #endregion
            }
            else if (Autonomy.ItemBuilding.ItemBuilder.BOOK_SYNONYMS.Contains(sArgs[0].ToLower()))
            {
                #region book / spellbook
                Book book = new Book();

                // Get the book from hand
                if (chr.RightHand != null && chr.RightHand.baseType == Globals.eItemBaseType.Book)
                {
                    book             = (Book)chr.RightHand;
                    book.CurrentPage = 0;
                    chr.WriteToDisplay("You close the " + sArgs[0] + ".");
                }
                else if (chr.LeftHand != null && chr.LeftHand.baseType == Globals.eItemBaseType.Book)
                {
                    book             = (Book)chr.LeftHand;
                    book.CurrentPage = 0;
                    chr.WriteToDisplay("You close the " + sArgs[0] + ".");
                }
                else
                {
                    chr.WriteToDisplay("You are not holding a " + sArgs[0] + ".");
                }
                #endregion
            }

            return(true);
        }
Exemplo n.º 60
0
 public bool safeRespond(Bottle command, Bottle reply)
 {
     bool ret = yarpPINVOKE.RFModule_safeRespond(swigCPtr, Bottle.getCPtr(command), Bottle.getCPtr(reply));
     if (yarpPINVOKE.SWIGPendingException.Pending) throw yarpPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }