Augmenté la vitesse de production de ressource
Fix la zone de ramassage
This commit is contained in:
parent
1a45b9a1bb
commit
0c0add8f43
@ -96,21 +96,4 @@ public class ResourceManager : MonoBehaviour
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (Input.GetMouseButtonDown(0))
|
|
||||||
{
|
|
||||||
Vector2 clickPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
|
||||||
RaycastHit2D hit = Physics2D.Raycast(clickPoint, transform.up);
|
|
||||||
if (hit.collider != null)
|
|
||||||
{
|
|
||||||
if (hit.collider.CompareTag("Resource"))
|
|
||||||
{
|
|
||||||
hit.collider.GetComponent<ResourceMaker>().GenerateResource();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,8 +14,8 @@ public class ResourceTile : LevelTile
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float _yieldSpeed = 1; //resource per second
|
private float _yieldSpeed = 1; //resource per second
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
[Range(-0.5f, 0.5f)]
|
[Range(0.0f, 5.0f)]
|
||||||
private float _randomPositionConfig = 0.0f;
|
private float _randomPositionConfig = 0.5f;
|
||||||
private float _yieldCounter = 0;
|
private float _yieldCounter = 0;
|
||||||
public bool Occupied { get; set; }
|
public bool Occupied { get; set; }
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public class ResourceTile : LevelTile
|
|||||||
if (_yieldCounter < 1) return;
|
if (_yieldCounter < 1) return;
|
||||||
|
|
||||||
_yieldCounter = 0;
|
_yieldCounter = 0;
|
||||||
float rangeConfig = 0.3f + _randomPositionConfig;
|
float rangeConfig = 0.5f + _randomPositionConfig;
|
||||||
Vector3 yieldPosition = new Vector3(Position.x + Random.Range(-rangeConfig, rangeConfig), Position.y, Position.z);
|
Vector3 yieldPosition = new Vector3(Position.x + Random.Range(-rangeConfig, rangeConfig), Position.y, Position.z);
|
||||||
var yielded = Instantiate(_yieldPrefab, yieldPosition, Quaternion.identity);
|
var yielded = Instantiate(_yieldPrefab, yieldPosition, Quaternion.identity);
|
||||||
yielded.transform.SetParent(LevelManager.Instance.LevelTransform);
|
yielded.transform.SetParent(LevelManager.Instance.LevelTransform);
|
||||||
|
|||||||
@ -14,5 +14,5 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_sprite: {fileID: 21300000, guid: 9bd2451627165d44ab67ea16cdabaf2f, type: 3}
|
_sprite: {fileID: 21300000, guid: 9bd2451627165d44ab67ea16cdabaf2f, type: 3}
|
||||||
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
|
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
|
||||||
_yieldSpeed: 0.1
|
_yieldSpeed: 0.5
|
||||||
_randomPositionConfig: 0
|
_randomPositionConfig: 0.5
|
||||||
|
|||||||
@ -14,5 +14,5 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_sprite: {fileID: 21300000, guid: 5c630d8b4d37f5d4f974d38f670ad5c1, type: 3}
|
_sprite: {fileID: 21300000, guid: 5c630d8b4d37f5d4f974d38f670ad5c1, type: 3}
|
||||||
_yieldPrefab: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3}
|
_yieldPrefab: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3}
|
||||||
_yieldSpeed: 0.1
|
_yieldSpeed: 0.5
|
||||||
_randomPositionConfig: 0.5
|
_randomPositionConfig: 0.5
|
||||||
|
|||||||
@ -14,5 +14,5 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_sprite: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
_sprite: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
||||||
_yieldPrefab: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
|
_yieldPrefab: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
|
||||||
_yieldSpeed: 0.1
|
_yieldSpeed: 0.5
|
||||||
_randomPositionConfig: -0.5
|
_randomPositionConfig: 0.5
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user