WaterTile.cs + Shovel.asset
This commit is contained in:
parent
efc7a3deaf
commit
1a12d986c4
6 changed files with 72 additions and 15 deletions
20
Assets/Resources/Items/Usable/Shovel.asset
Normal file
20
Assets/Resources/Items/Usable/Shovel.asset
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 761f645f009328845bc7851753024e92, type: 3}
|
||||
m_Name: Shovel
|
||||
m_EditorClassIdentifier:
|
||||
displayName: Shovel
|
||||
description: Used to dig ground.
|
||||
id: 6
|
||||
selectedSprite: {fileID: 21300000, guid: 58952d7ae1da0f0468af9c9d916af2fc, type: 3}
|
||||
defaultSprite: {fileID: 21300000, guid: 1ea3a182dfc173440993d81065fdbdf0, type: 3}
|
||||
cost: 200
|
||||
8
Assets/Resources/Items/Usable/Shovel.asset.meta
Normal file
8
Assets/Resources/Items/Usable/Shovel.asset.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6bac44b5c4527b641a3ae772d217ec43
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1536,7 +1536,7 @@ MonoBehaviour:
|
|||
m_HandleRect: {fileID: 2006577138}
|
||||
m_Direction: 2
|
||||
m_Value: 1
|
||||
m_Size: 0.59324205
|
||||
m_Size: 0.5932421
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
m_PersistentCalls:
|
||||
|
|
@ -6516,6 +6516,7 @@ MonoBehaviour:
|
|||
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
||||
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
||||
- {fileID: 11400000, guid: 008a8fdd2c3a95745acafee4087a855d, type: 2}
|
||||
- {fileID: 11400000, guid: 6bac44b5c4527b641a3ae772d217ec43, type: 2}
|
||||
--- !u!1001 &1701153146
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -6790,6 +6791,7 @@ MonoBehaviour:
|
|||
- {fileID: 11400000, guid: 008a8fdd2c3a95745acafee4087a855d, type: 2}
|
||||
- {fileID: 11400000, guid: 430db451ae959f34b8fba8d8b17276fd, type: 2}
|
||||
- {fileID: 11400000, guid: ea1a26b19bc34a0ba29bad77253c7266, type: 2}
|
||||
- {fileID: 11400000, guid: d651d57ba97a4246a0094409e29fe56a, type: 2}
|
||||
--- !u!114 &1800469992
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -6802,12 +6804,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 05183797fdda4aa9ac518eee0d2d85d4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
allItems:
|
||||
- {fileID: 11400000, guid: bb9777a7d5804bd6bf25d5510206aaf0, type: 2}
|
||||
- {fileID: 11400000, guid: d651d57ba97a4246a0094409e29fe56a, type: 2}
|
||||
- {fileID: 11400000, guid: 430db451ae959f34b8fba8d8b17276fd, type: 2}
|
||||
- {fileID: 11400000, guid: 008a8fdd2c3a95745acafee4087a855d, type: 2}
|
||||
- {fileID: 11400000, guid: ea1a26b19bc34a0ba29bad77253c7266, type: 2}
|
||||
--- !u!1001 &1805366398
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace Tiles
|
|||
|
||||
public virtual BaseTile Clicked(UsableItem usable)
|
||||
{
|
||||
Debug.Log(usable.ToString() + " used on " + this.ToString());
|
||||
Debug.Log(usable + " used on " + this);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,14 @@ namespace Tiles
|
|||
/// <returns>a subclass of BaseTile if the Tile has to change, null if it stays the same type</returns>
|
||||
public override BaseTile Clicked(UsableItem usable) {
|
||||
BaseTile rv = null;
|
||||
ItemContainer ic = ItemContainer.Instance;
|
||||
if (usable != null)
|
||||
{
|
||||
base.Clicked(usable);
|
||||
if (usable.id == ItemContainer.Instance.GetItemIdByName(new string("Hoe")))
|
||||
{
|
||||
if (usable.id == ic.GetItemIdByName("Hoe")) {
|
||||
rv = new FarmlandTile();
|
||||
} else if (usable.id == ic.GetItemIdByName("Shovel")) {
|
||||
rv = new WaterTile();
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,42 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Tiles
|
||||
{
|
||||
public class WaterTile : BaseTile
|
||||
{
|
||||
public WaterTile() : base(null)
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void Fish() {
|
||||
if (_fishing) {
|
||||
if (_catchable) {
|
||||
// _fishingTime += _lastCall - System.DateTime.Now; deltaTime between last recursive call
|
||||
}
|
||||
//Fish();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue