Pull request #59: Nouvelle destination des resources collectées
Merge in CGD/gather-and-defend from feature/YieldDestination to main * commit 'fabd51a9f516416c3745f24c774120441fa7b16b': Adjusted destination positions Removed Debug logs and prepared main rebase Created destination placeholders where resource ui should be
This commit is contained in:
commit
474b47be53
@ -133,7 +133,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 9dd6bad38b516d64e8e23a5822ca37bb, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_resourceChoice: 3
|
||||
_resourceChoice: 2
|
||||
_animate: 1
|
||||
_endPosition: {x: -2, y: 5}
|
||||
--- !u!1 &6962989256011107503
|
||||
GameObject:
|
||||
|
||||
@ -524,7 +524,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_resourceChoice: 2
|
||||
_animate: 0
|
||||
_endPosition: {x: 0, y: 0}
|
||||
--- !u!1 &119018171
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -639,7 +638,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_resourceChoice: 0
|
||||
_animate: 0
|
||||
_endPosition: {x: 0, y: 0}
|
||||
--- !u!114 &144369556
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -843,6 +841,37 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &224477684
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 224477685}
|
||||
m_Layer: 0
|
||||
m_Name: RockDestination
|
||||
m_TagString: Rock
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &224477685
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 224477684}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -2.48, y: 3.31, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1505683023}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &405102484
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1238,7 +1267,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_resourceChoice: 1
|
||||
_animate: 0
|
||||
_endPosition: {x: 0, y: 0}
|
||||
--- !u!1 &619394800
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2535,6 +2563,37 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1 &1279975342
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1279975343}
|
||||
m_Layer: 0
|
||||
m_Name: WoodDestination
|
||||
m_TagString: Wood
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1279975343
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1279975342}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -4.06, y: 3.31, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1505683023}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1322577704
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3257,6 +3316,71 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!1 &1486138001
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1486138002}
|
||||
m_Layer: 0
|
||||
m_Name: FoodDestination
|
||||
m_TagString: Food
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1486138002
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1486138001}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -5.75, y: 3.31, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1505683023}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1505683022
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1505683023}
|
||||
m_Layer: 0
|
||||
m_Name: YieldDestinations
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1505683023
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1505683022}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -5.74, y: 0.1279463, z: 0.2783537}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1486138002}
|
||||
- {fileID: 1279975343}
|
||||
- {fileID: 224477685}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 11
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1508319155
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -10,8 +10,7 @@ public class ResourceMaker : MonoBehaviour
|
||||
private ResourceManager _resourceManagerInstance;
|
||||
[SerializeField]
|
||||
private bool _animate = true;
|
||||
[SerializeField]
|
||||
private Vector2 _endPosition;
|
||||
private GameObject _destination;
|
||||
private Vector2 _startPosition;
|
||||
private Rigidbody2D _rigidbody;
|
||||
private float _desiredTime = 1.5f;
|
||||
@ -30,6 +29,21 @@ public class ResourceMaker : MonoBehaviour
|
||||
_rigidbody = GetComponent<Rigidbody2D>();
|
||||
_rigidbody.AddForce(transform.up * 20.0f);
|
||||
_rigidbody.gravityScale = 0.1f;
|
||||
switch (_resourceChoice)
|
||||
{
|
||||
case Enum.ResourceChoice.Rock:
|
||||
_destination = GameObject.FindWithTag("Rock");
|
||||
break;
|
||||
case Enum.ResourceChoice.Wood:
|
||||
_destination = GameObject.FindWithTag("Wood");
|
||||
break;
|
||||
case Enum.ResourceChoice.Food:
|
||||
_destination = GameObject.FindWithTag("Food");
|
||||
break;
|
||||
default:
|
||||
_destination = GameObject.FindWithTag("Food");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -49,8 +63,8 @@ public class ResourceMaker : MonoBehaviour
|
||||
_timePassed += Time.deltaTime;
|
||||
float duration = _timePassed / _desiredTime;
|
||||
duration = duration * duration * (3.0f - 2.0f * duration);
|
||||
transform.position = Vector2.Lerp(transform.position, _endPosition, duration);
|
||||
if(Vector2.Distance(transform.position,_endPosition) < 0.001f)
|
||||
transform.position = Vector2.Lerp(transform.position, _destination.transform.position, duration);
|
||||
if (Vector2.Distance(transform.position, _destination.transform.position) < 0.001f)
|
||||
{
|
||||
_isPlaying = false;
|
||||
Destroy(gameObject);
|
||||
|
||||
@ -7,6 +7,9 @@ TagManager:
|
||||
- Opponent
|
||||
- Ally
|
||||
- Resource
|
||||
- Food
|
||||
- Wood
|
||||
- Rock
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user