예제 #1
0
    private void GatherSlot()
    {
        if (resourcePlantable != null && paramsData.havePlantGrown)
        {
            int pos = Array.IndexOf(resourcePlantable.gatherToolsID, toolsManager.activeTool.id);
            if (pos > -1)
            {
                resourcesManager.AddResourcePlantable(resourcePlantable.id, 1);

                notificationsManager.CreateNotificationGatherable(this.transform, resourcePlantable, 1);

                Destroy(plantObject);
                resourcePlantable         = null;
                paramsData.havePlantGrown = false;
            }
        }

        if (resourceSettable != null)
        {
            int pos = Array.IndexOf(resourceSettable.gatherToolsID, toolsManager.activeTool.id);
            if (pos > -1)
            {
                if (resourcePlantable != null)
                {
                    resourcesManager.AddResourcePlantable(resourcePlantable.id, 1);

                    if (paramsData.havePlantGrown)
                    {
                        notificationsManager.CreateNotificationGatherable(this.transform, resourcePlantable, 1);
                    }
                }

                resourcesManager.AddResourceSettable(resourceSettable.id, 1);

                Destroy(setObject);
                Destroy(plantObject);
                resourceSettable          = null;
                resourcePlantable         = null;
                paramsData.havePlantGrown = false;

                if (plantGrow != null)
                {
                    StopCoroutine(plantGrow);
                    plantGrow = null;
                }
            }
        }
    }