Esempio n. 1
0
        private void Update()
        {
            if (!Night.Instance.IsNight)
            {
                //Update drop
                if (Drag.IsObjectDragging)
                {
                    if (UIManager.hospital.gameObject.activeInHierarchy)
                    {
                        UIManager.hospital.GetComponent <DropToHospitalWindow>().DropToHospitalWindowUpdate();
                    }
                    hospitalButton.GetComponent <DropToHospital>().DropToHospitalButtonUpdate();

                    if (UIManager.robberyWindow.gameObject.activeInHierarchy)
                    {
                        UIManager.robberyWindow.GetComponent <DropToRobberyWindow>().DropToRobberyWindowUpdate();
                    }

                    foreach (RobberyType robberyType in robUpdate.Robberies.Keys)
                    {
                        for (int i = 0; i < robUpdate.Robberies[robberyType].Length; i++)
                        {
                            RobberyCustomization robbery = robUpdate.Robberies[robberyType][i];
                            if (robbery.IsAvailable)
                            {
                                robbery.GetComponent <DropToRobbery>().DropToRobberyUpdate();
                            }
                        }
                    }
                }

                //Then update drag
                foreach (GameObject item in GameObject.FindGameObjectsWithTag("DraggableItem"))
                {
                    item.GetComponent <Drag>().DragUpdate();
                }
                foreach (GameObject character in GameObject.FindGameObjectsWithTag("DraggableCharacter"))
                {
                    character.GetComponent <Drag>().DragUpdate();
                }
            }
        }
Esempio n. 2
0
        public void DropToRobberyUpdate()
        {
            if (Input.GetMouseButtonUp(0))
            {
                if (isEntered)
                {
                    RobberyCustomization robCust = gameObject.GetComponent <RobberyCustomization>();
                    int         locNum           = robCust.Number;
                    RobberyType robType          = robCust.RobberyType;

                    if (Drag.ItemType == DraggeableItemType.Character)
                    {
                        CharacterCustomization charCust;
                        Drop.DropObject(out charCust);

                        if (charCust != null)
                        {
                            if (charCust.Character.Status == CharacterStatus.Normal)
                            {
                                UIManager.robberyWindow.TryToAddCharacterToRobbery(charCust.Character, robType, locNum);
                            }
                        }

                        isEntered = false;
                    }
                    if (Drag.ItemType == DraggeableItemType.Item)
                    {
                        ItemCustomization iCust;
                        Drop.DropObject(out iCust);
                        if (iCust != null)
                        {
                            UIManager.robberyWindow.TryToAddItemToRobbery(iCust.number, robType, locNum);
                        }
                    }
                    isEntered = false;
                }
            }
        }