Items adjusted prices
fixed some Tile sheeesh selling overflowing Items in Inventory (over 999)
This commit is contained in:
parent
79e86e343c
commit
cdd8ae7441
21 changed files with 106 additions and 84 deletions
|
|
@ -2,43 +2,32 @@ using System;
|
|||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Tiles
|
||||
{
|
||||
public abstract class BaseTile
|
||||
{
|
||||
namespace Tiles {
|
||||
public abstract class BaseTile {
|
||||
private Sprite _sprite;
|
||||
public Sprite Sprite => _sprite;
|
||||
|
||||
protected GameObject _gameObject;
|
||||
|
||||
protected BaseTile(String pathToImageFile, GameObject gameObject)
|
||||
{
|
||||
this._gameObject = gameObject;
|
||||
this._sprite = GenerateSpriteFromFile(pathToImageFile);
|
||||
}
|
||||
|
||||
public void DayLightStep()
|
||||
protected BaseTile(String pathToImageFile, GameObject gameObject) {
|
||||
_gameObject = gameObject;
|
||||
_sprite = GenerateSpriteFromFile(pathToImageFile);
|
||||
HouseController.NewDayEvent.AddListener(DayLightStep);
|
||||
}
|
||||
|
||||
public virtual void DayLightStep()
|
||||
{
|
||||
|
||||
}
|
||||
public virtual void DayLightStep() { }
|
||||
|
||||
public virtual BaseTile Clicked(UsableItem usable)
|
||||
{
|
||||
public virtual BaseTile Clicked(UsableItem usable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
static public Sprite GenerateSpriteFromFile(String pathToImageFile)
|
||||
{
|
||||
static public Sprite GenerateSpriteFromFile(String pathToImageFile) {
|
||||
byte[] data = File.ReadAllBytes(pathToImageFile);
|
||||
Texture2D texture = new Texture2D(32, 32, TextureFormat.ARGB32, false);
|
||||
texture.LoadImage(data);
|
||||
Sprite sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 32);
|
||||
Sprite sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height),
|
||||
new Vector2(0.5f, 0.5f), 32);
|
||||
return sprite;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ namespace Tiles
|
|||
{
|
||||
public class GrassTile : BaseTile
|
||||
{
|
||||
public GrassTile() : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_000.png")
|
||||
public GrassTile(GameObject gameObject) : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_000.png", gameObject)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -20,10 +20,10 @@ namespace Tiles
|
|||
if (usable != null)
|
||||
{
|
||||
base.Clicked(usable);
|
||||
if (usable.ID == ic.GetItemIdByName("Hoe")) {
|
||||
rv = new FarmlandTile();
|
||||
} else if (usable.ID == ic.GetItemIdByName("Shovel")) {
|
||||
rv = new WaterTile();
|
||||
if (usable.Id == ic.GetItemIdByName("Hoe")) {
|
||||
rv = new FarmlandTile(_gameObject);
|
||||
} else if (usable.Id == ic.GetItemIdByName("Shovel")) {
|
||||
rv = new WaterTile(_gameObject);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Collections;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Tiles {
|
||||
public class WaterTile : BaseTile {
|
||||
public WaterTile() : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_023.png") {
|
||||
public WaterTile(GameObject gameObject) : base("Assets/Farming Asset Pack/Split Assets/farming_tileset_023.png", gameObject) {
|
||||
}
|
||||
|
||||
public override BaseTile Clicked(UsableItem usable) {
|
||||
|
|
@ -12,15 +12,15 @@ namespace Tiles {
|
|||
|
||||
ItemContainer ic = ItemContainer.Instance;
|
||||
|
||||
if (usable.ID == ic.GetItemIdByName("Fishing Rod")) {
|
||||
if (usable.Id == ic.GetItemIdByName("Fishing Rod")) {
|
||||
FishingController fc = FishingController.instance;
|
||||
if (!fc.Fishing) {
|
||||
fc.StartFishing();
|
||||
} else {
|
||||
fc.TryCatch();
|
||||
}
|
||||
} else if (usable.ID == ic.GetItemIdByName("Shovel")) {
|
||||
rv = new GrassTile();
|
||||
} else if (usable.Id == ic.GetItemIdByName("Shovel")) {
|
||||
rv = new GrassTile(_gameObject);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue