Major Fishing changes

This commit is contained in:
s-prechtl 2022-06-08 22:19:40 +02:00
parent 1a12d986c4
commit 9e91220be4
11 changed files with 173 additions and 49 deletions

View file

@ -1,43 +1,29 @@
using System.Collections;
using UnityEngine;
namespace Tiles
{
namespace Tiles {
public class WaterTile : BaseTile {
private double _fishingTime;
private bool _fishing = false;
private bool _catchable = false;
private int _lastCall = 0;
public WaterTile() : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_023.png") {
}
public override BaseTile Clicked(UsableItem usable) {
base.Clicked(usable);
BaseTile rv = null;
ItemContainer ic = ItemContainer.Instance;
if (usable.id == ic.GetItemIdByName("Fishing Rod")) {
if (!_fishing) {
_fishing = true;
_fishingTime = 0f;
Fish();
} else if (_catchable) {
_fishing = false;
Debug.Log("Fished for" + _fishingTime/1000);
if (usable.ID == ic.GetItemIdByName("Fishing Rod")) {
FishingController fc = FishingController.instance;
if (!fc.Fishing) {
fc.StartFishing();
} else {
fc.TryCatch();
}
}
return null;
}
private void Fish() {
if (_fishing) {
if (_catchable) {
// _fishingTime += _lastCall - System.DateTime.Now; deltaTime between last recursive call
}
//Fish();
} else if (usable.ID == ic.GetItemIdByName("Shovel")) {
rv = new GrassTile();
}
return rv;
}
}
}