Пример #1
0
    private void OnTriggerStay(Collider other)
    {
        if (Controller.triggerPressed && other.GetComponent <PickedUpItem>() && PickUpItem == null)
        {
            PickedUpItem PickObj = other.GetComponent <PickedUpItem>();
            if (!PickObj.Picking)
            {
                if (PickObj.Waiting)
                {
                    PickObj.Waiting = false;
                    SpawnBall();
                }
                PickObj.Picking = true;
                PickObj.OnPick.Invoke();
                origin_parent = PickObj.transform.parent;
                PickObj.transform.SetParent(transform);
                PickObj.transform.localPosition = Vector3.zero;
                PickObj.GetComponent <Rigidbody>().useGravity  = false;
                PickObj.GetComponent <Rigidbody>().isKinematic = true;
                PickObj.GetComponent <Rigidbody>().velocity    = Vector3.zero;
                PickObj.holding = true;
                PickUpItem      = PickObj;

                inBusy = true;
                OnCatch.Invoke();
            }
        }
    }
Пример #2
0
 void ReleaseItem()
 {
     PickUpItem.transform.SetParent(origin_parent);
     PickUpItem.GetComponent <Rigidbody>().useGravity  = true;
     PickUpItem.GetComponent <Rigidbody>().isKinematic = false;
     SwipeValue(PickUpItem.GetComponent <Rigidbody>());
     PickUpItem.Picking = false;
     PickUpItem.holding = false;
     PickUpItem         = null;
     inBusy             = false;
 }
Пример #3
0
        protected override void CreateChildren()
        {
            _btnWait                 = new Tool(0, 7, 20, 24);
            _btnWait.ClickAction     = (button) => Dungeon.Hero.Rest(false);
            _btnWait.LongClickAction = (button) =>
            {
                Dungeon.Hero.Rest(true);
                return(true);
            };

            Add(_btnWait);
            _btnSearch             = new Tool(20, 7, 20, 24);
            _btnSearch.ClickAction = (button) => Dungeon.Hero.Search(true);
            Add(_btnSearch);

            _btnInfo             = new Tool(40, 7, 21, 24);
            _btnInfo.ClickAction = (button) => GameScene.SelectCell(Informer);
            Add(_btnInfo);

            _btnResume             = new Tool(61, 7, 21, 24);
            _btnResume.ClickAction = (button) => Dungeon.Hero.Resume();
            Add(_btnResume);

            _btnInventory                 = new Tool(82, 7, 23, 24);
            _btnInventory.ClickAction     = (button) => GameScene.Show(new WndBag(Dungeon.Hero.Belongings.Backpack, null, WndBag.Mode.ALL, null));
            _btnInventory.LongClickAction = (button) =>
            {
                GameScene.Show(new WndCatalogus()); return(true);
            };

            //Override protected void createChildren() { base.createChildren(); gold = new GoldIndicator(); Add(gold); }; Override protected void layout() { base.layout(); gold.Fill(this); };
            Add(_btnInventory);

            Add(_btnQuick = new QuickslotTool(105, 7, 22, 24));

            Add(_pickedUp = new PickedUpItem());
        }