Created destination placeholders where resource ui should be
This commit is contained in:
parent
9188e86adb
commit
e1e3c42b00
@ -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:
|
||||
|
||||
@ -255,6 +255,10 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 809914569973156333, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Untagged
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 809914570630650134, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
@ -271,6 +275,10 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 809914570630650135, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Untagged
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 809914571062164690, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
|
||||
propertyPath: _populationText
|
||||
value:
|
||||
@ -383,6 +391,10 @@ PrefabInstance:
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 809914571517447037, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Untagged
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2412408510912601678, guid: 5497dc5adfbe67341980c9d946816424, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
@ -1485,6 +1497,37 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 635793715}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &679934011
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 679934012}
|
||||
m_Layer: 0
|
||||
m_Name: Wood
|
||||
m_TagString: Wood
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &679934012
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 679934011}
|
||||
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: 1787373871}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &684588057
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3257,6 +3300,37 @@ MonoBehaviour:
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!1 &1482556085
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1482556086}
|
||||
m_Layer: 0
|
||||
m_Name: Food
|
||||
m_TagString: Food
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1482556086
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1482556085}
|
||||
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: 1787373871}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1508319155
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3531,6 +3605,37 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1674701176
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1674701177}
|
||||
m_Layer: 0
|
||||
m_Name: Rock
|
||||
m_TagString: Rock
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1674701177
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1674701176}
|
||||
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: 1787373871}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1709530843
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3813,6 +3918,40 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1761692192}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1787373870
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1787373871}
|
||||
m_Layer: 0
|
||||
m_Name: ResourceDestinations
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1787373871
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1787373870}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -5.980474, y: 0.12794627, z: 0.2783537}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1482556086}
|
||||
- {fileID: 679934012}
|
||||
- {fileID: 1674701177}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 11
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &2019202046
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -10,6 +10,7 @@ public class ResourceMaker : MonoBehaviour
|
||||
private ResourceManager _resourceManagerInstance;
|
||||
[SerializeField]
|
||||
private bool _animate = true;
|
||||
private GameObject _destination;
|
||||
[SerializeField]
|
||||
private Vector2 _endPosition;
|
||||
private Vector2 _startPosition;
|
||||
@ -30,6 +31,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 +65,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