Пример #1
0
    public void StartFishing(Vector3 position, FishPool fishPool, Player player)
    {
        FishSize    newFishSize = fishPool.RandomFishSize;
        Fish        fish        = fishFactory.CreateFish(newFishSize, GetFishTemplate(newFishSize));
        PlayerStats stats       = player.GetPlayerStats();
        Inventory   inventory   = player.GetPlayerInventory();

        GameObject    fishingTargetPrefab = GameObject.Instantiate(_fishingTargetPrefab, position, Quaternion.identity);
        FishingTarget fishingTarget       = fishingTargetPrefab.GetComponent <FishingTarget>();

        if (fishingTarget != null)
        {
        }

        bool canPlayerCatchFish = CanPlayerCatchFish(fish, stats);

        Debug.Log("Start Fishing :: FishName: " + fish.Size + ", CaughtFish: " + canPlayerCatchFish);
        if (canPlayerCatchFish)
        {
            stats.AddExperience(FishingHelper.calculateFishExperience(fishPool, fish, stats));
            InventoryObject fishInventoryObject  = new InventoryObject(fish);
            bool            collectedCollectable = inventory.AddItem(fishInventoryObject);
            Debug.Log(collectedCollectable ? "Success for inventoryplacement" : "Failure for inventoryplacement");
        }
    }
Пример #2
0
    private void CreateAndAddFish(FishSetting setting)
    {
        FishController fishController = fishFactory.CreateFish(setting).GetComponent <FishController>();

        FishControllerList.Add(fishController);
    }