public static void DoTakeFX(Vector3 pos, ItemData item, InventoryType inventory, int target_slot)
 {
     if (AssetData.Get().item_take_fx != null && item != null)
     {
         GameObject fx = Instantiate(AssetData.Get().item_take_fx, pos, Quaternion.identity);
         fx.GetComponent <ItemTakeFX>().SetItem(item, inventory, target_slot);
     }
 }
        //--- Generic Actions ----

        //Same as trigger action, but also show the progress circle
        public void TriggerProgressAction(float duration, UnityAction callback = null)
        {
            if (!is_action)
            {
                if (AssetData.Get().action_progress != null && duration > 0.1f)
                {
                    action_progress = Instantiate(AssetData.Get().action_progress, transform);
                    action_progress.GetComponent <ActionProgress>().duration = duration;
                }

                action_routine    = StartCoroutine(RunActionRoutine(duration, callback));
                can_cancel_action = true;
                StopMove();
            }
        }
        void Start()
        {
            GenerateAutomaticOutline();

            if ((TheGame.IsMobile() || PlayerControls.IsAnyGamePad()) && groups.Length > 0 && AssetData.Get().item_merge_fx != null)
            {
                if (fx_parent == null)
                {
                    fx_parent = new GameObject("FX");
                }

                GameObject fx = Instantiate(AssetData.Get().item_merge_fx, transform.position, AssetData.Get().item_merge_fx.transform.rotation);
                fx.GetComponent <ItemMergeFX>().target = this;
                fx.transform.SetParent(fx_parent.transform);
            }
        }
Exemple #4
0
        private void Start()
        {
            canvas.worldCamera = TheCamera.GetCamera();

            if (!TheGame.IsMobile() && ItemSelectedFX.Get() == null && AssetData.Get().item_select_fx != null)
            {
                Instantiate(AssetData.Get().item_select_fx, transform.position, Quaternion.identity);
            }

            PlayerUI gameplay_ui = GetComponentInChildren <PlayerUI>();

            if (gameplay_ui == null)
            {
                Debug.LogError("Warning: Missing PlayerUI script on the Gameplay tab in the UI prefab");
            }
        }
        //Start crafting with timer
        public void StartCrafting(CraftData data)
        {
            if (data != null && current_crafting == null)
            {
                current_crafting = data;
                craft_timer      = 0f;
                character.StopMove();

                if (AssetData.Get().action_progress != null && data.craft_duration > 0.1f)
                {
                    craft_progress = Instantiate(AssetData.Get().action_progress, transform);
                    craft_progress.GetComponent <ActionProgress>().duration = data.craft_duration;
                }

                if (data.craft_duration < 0.01f)
                {
                    CompleteCrafting();
                }
            }
        }