Example #1
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (m_SelectedItem == null)
        {
            return;
        }

        if (m_SelectedItem.CanUse() == false)
        {
            return;
        }

        Vector3 worldPosition = Camera.main.ScreenToWorldPoint(eventData.pressPosition);

        worldPosition.z = 0.0f;

        WorldObject newWorldObject = m_World.SpawnWorldObject(m_SelectedItem.WorldObjectPrefab, worldPosition);

        newWorldObject.Initialize(GameClock.Instance.GetDateTime());

        m_SelectedItem.Use();
        m_SelectedItem = null;

        SaveGameManager.Instance.SerializeWorld();
    }