Correction des commentaires de merge pour ResourceMaker
_rigidbody est la variable contenant Rigidbody2D Corrigé l'indentation de GenerateResource
This commit is contained in:
parent
f9e9abe43a
commit
1dcca774d5
@ -13,6 +13,7 @@ public class ResourceMaker : MonoBehaviour
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Vector2 _endPosition;
|
private Vector2 _endPosition;
|
||||||
private Vector2 _startPosition;
|
private Vector2 _startPosition;
|
||||||
|
private Rigidbody2D _rigidbody;
|
||||||
private float _desiredTime = 1.5f;
|
private float _desiredTime = 1.5f;
|
||||||
private float _timePassed = 0f;
|
private float _timePassed = 0f;
|
||||||
private bool _isPlaying = false;
|
private bool _isPlaying = false;
|
||||||
@ -22,8 +23,9 @@ public class ResourceMaker : MonoBehaviour
|
|||||||
_resourceManagerInstance = ResourceManager.Instance;
|
_resourceManagerInstance = ResourceManager.Instance;
|
||||||
_startPosition = transform.position;
|
_startPosition = transform.position;
|
||||||
transform.position = new Vector2(transform.position.x, transform.position.y + 0.5f);
|
transform.position = new Vector2(transform.position.x, transform.position.y + 0.5f);
|
||||||
gameObject.GetComponent<Rigidbody2D>().AddForce(transform.up * 20.0f);
|
_rigidbody = GetComponent<Rigidbody2D>();
|
||||||
gameObject.GetComponent<Rigidbody2D>().gravityScale = 0.1f;
|
_rigidbody.AddForce(transform.up * 20.0f);
|
||||||
|
_rigidbody.gravityScale = 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -33,8 +35,8 @@ public class ResourceMaker : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (Vector2.Distance(transform.position, _startPosition) < 0.01f)
|
if (Vector2.Distance(transform.position, _startPosition) < 0.01f)
|
||||||
{
|
{
|
||||||
gameObject.GetComponent<Rigidbody2D>().gravityScale = 0.0f;
|
_rigidbody.gravityScale = 0.0f;
|
||||||
gameObject.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
|
_rigidbody.velocity = Vector2.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isPlaying)
|
if (_isPlaying)
|
||||||
@ -63,9 +65,10 @@ public class ResourceMaker : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateResource(){
|
public void GenerateResource()
|
||||||
|
{
|
||||||
_isPlaying = true;
|
_isPlaying = true;
|
||||||
gameObject.GetComponent<Rigidbody2D>().gravityScale = 0.0f;
|
_rigidbody.gravityScale = 0.0f;
|
||||||
gameObject.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
|
_rigidbody.velocity = Vector2.zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user