spawning added
This commit is contained in:
parent
eab2c51f63
commit
263feed880
|
|
@ -123,6 +123,72 @@ NavMeshSettings:
|
||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &175515933
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 175515936}
|
||||||
|
- component: {fileID: 175515935}
|
||||||
|
- component: {fileID: 175515934}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: EventSystem
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &175515934
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 175515933}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_HorizontalAxis: Horizontal
|
||||||
|
m_VerticalAxis: Vertical
|
||||||
|
m_SubmitButton: Submit
|
||||||
|
m_CancelButton: Cancel
|
||||||
|
m_InputActionsPerSecond: 10
|
||||||
|
m_RepeatDelay: 0.5
|
||||||
|
m_ForceModuleActive: 0
|
||||||
|
--- !u!114 &175515935
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 175515933}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_FirstSelected: {fileID: 0}
|
||||||
|
m_sendNavigationEvents: 1
|
||||||
|
m_DragThreshold: 10
|
||||||
|
--- !u!4 &175515936
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 175515933}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 8
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &353788371
|
--- !u!1 &353788371
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -133,6 +199,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 353788373}
|
- component: {fileID: 353788373}
|
||||||
- component: {fileID: 353788372}
|
- component: {fileID: 353788372}
|
||||||
|
- component: {fileID: 353788374}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: GameManager
|
m_Name: GameManager
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -154,8 +221,9 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
optionGood: {fileID: 1472984516}
|
optionGood: {fileID: 1472984516}
|
||||||
optionBad: {fileID: 1198253085}
|
optionBad: {fileID: 1198253085}
|
||||||
SpawnDistance: 0
|
SpawnDistanceMin: {x: 4, y: 13}
|
||||||
SpawnTimer: 0.5
|
SpawnDistanceMax: {x: 15, y: 45}
|
||||||
|
SpawnTimer: 0.8
|
||||||
--- !u!4 &353788373
|
--- !u!4 &353788373
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -170,6 +238,21 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 6
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &353788374
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 353788371}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3433d988438ba9249906784aa2e185f1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
txt_money: {fileID: 1209384639}
|
||||||
|
moneyMultiplier: 5
|
||||||
|
txtMoneyOffset: {x: 0, y: 2, z: 0}
|
||||||
--- !u!1 &379229729
|
--- !u!1 &379229729
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -317,7 +400,7 @@ Camera:
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 2
|
m_ClearFlags: 2
|
||||||
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
|
m_BackGroundColor: {r: 0.09019608, g: 0.098039225, b: 0.14509805, a: 1}
|
||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_GateFitMode: 2
|
m_GateFitMode: 2
|
||||||
m_FOVAxisMode: 0
|
m_FOVAxisMode: 0
|
||||||
|
|
@ -364,6 +447,106 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &760444830
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 760444834}
|
||||||
|
- component: {fileID: 760444833}
|
||||||
|
- component: {fileID: 760444832}
|
||||||
|
- component: {fileID: 760444831}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Canvas
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &760444831
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 760444830}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_IgnoreReversedGraphics: 1
|
||||||
|
m_BlockingObjects: 0
|
||||||
|
m_BlockingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
--- !u!114 &760444832
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 760444830}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_UiScaleMode: 0
|
||||||
|
m_ReferencePixelsPerUnit: 100
|
||||||
|
m_ScaleFactor: 1
|
||||||
|
m_ReferenceResolution: {x: 800, y: 600}
|
||||||
|
m_ScreenMatchMode: 0
|
||||||
|
m_MatchWidthOrHeight: 0
|
||||||
|
m_PhysicalUnit: 3
|
||||||
|
m_FallbackScreenDPI: 96
|
||||||
|
m_DefaultSpriteDPI: 96
|
||||||
|
m_DynamicPixelsPerUnit: 1
|
||||||
|
m_PresetInfoIsWorld: 0
|
||||||
|
--- !u!223 &760444833
|
||||||
|
Canvas:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 760444830}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 3
|
||||||
|
m_RenderMode: 0
|
||||||
|
m_Camera: {fileID: 0}
|
||||||
|
m_PlaneDistance: 100
|
||||||
|
m_PixelPerfect: 0
|
||||||
|
m_ReceivesEvents: 1
|
||||||
|
m_OverrideSorting: 0
|
||||||
|
m_OverridePixelPerfect: 0
|
||||||
|
m_SortingBucketNormalizedSize: 0
|
||||||
|
m_AdditionalShaderChannelsFlag: 0
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
--- !u!224 &760444834
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 760444830}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1209384638}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 7
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0, y: 0}
|
||||||
--- !u!1 &1182127216
|
--- !u!1 &1182127216
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -593,6 +776,85 @@ CircleCollider2D:
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Radius: 0.5
|
m_Radius: 0.5
|
||||||
|
--- !u!1 &1209384637
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1209384638}
|
||||||
|
- component: {fileID: 1209384640}
|
||||||
|
- component: {fileID: 1209384639}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Text
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1209384638
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1209384637}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 760444834}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 1}
|
||||||
|
m_AnchorMax: {x: 0, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 18.840027, y: 0}
|
||||||
|
m_SizeDelta: {x: 500, y: 50}
|
||||||
|
m_Pivot: {x: 0, y: 1}
|
||||||
|
--- !u!114 &1209384639
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1209384637}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 24
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_BestFit: 0
|
||||||
|
m_MinSize: 10
|
||||||
|
m_MaxSize: 41
|
||||||
|
m_Alignment: 3
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text: $0
|
||||||
|
--- !u!222 &1209384640
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1209384637}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
--- !u!1 &1244542280
|
--- !u!1 &1244542280
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -883,8 +1145,12 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 63b57bf3e88333740821b0e134876b30, type: 3}
|
m_Script: {fileID: 11500000, guid: 63b57bf3e88333740821b0e134876b30, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
upwardSprite: {fileID: 21300000, guid: 35e66489d265a054a844dced54264631, type: 3}
|
||||||
|
downwardSprite: {fileID: 21300000, guid: cebae38329b50b348a19dc8302c4216b, type: 3}
|
||||||
|
normalSprite: {fileID: 21300000, guid: 9b00ede2559ce684c807348f2695f991, type: 3}
|
||||||
eulerAngles: {x: 0, y: 0, z: 0}
|
eulerAngles: {x: 0, y: 0, z: 0}
|
||||||
movingSpeed: 0.1
|
movingSpeed: 0.1
|
||||||
|
boostSpeed: 0.35
|
||||||
turnAngle: 15
|
turnAngle: 15
|
||||||
trailPrefab: {fileID: 1182127216}
|
trailPrefab: {fileID: 1182127216}
|
||||||
currentTrail: {fileID: 0}
|
currentTrail: {fileID: 0}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ public class CameraFollower : MonoBehaviour
|
||||||
|
|
||||||
|
|
||||||
void updateFrame(){
|
void updateFrame(){
|
||||||
|
if(PlayerController.boosting){
|
||||||
|
//Add boost here
|
||||||
|
}
|
||||||
|
|
||||||
float newX = Mathf.Lerp(transform.position.x, Target.position.x + offset.x, Xsmoothness);
|
float newX = Mathf.Lerp(transform.position.x, Target.position.x + offset.x, Xsmoothness);
|
||||||
float newY = Mathf.Lerp(transform.position.y, Target.position.y + offset.y, Ysmoothness);
|
float newY = Mathf.Lerp(transform.position.y, Target.position.y + offset.y, Ysmoothness);
|
||||||
transform.position = new Vector3(newX, newY, transform.position.z);
|
transform.position = new Vector3(newX, newY, transform.position.z);
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,12 @@ using UnityEngine.UI;
|
||||||
public class GameManager : MonoBehaviour
|
public class GameManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Text txt_money;
|
public Text txt_money;
|
||||||
|
public float moneyMultiplier = 5;
|
||||||
|
public Vector3 txtMoneyOffset = Vector2.one;
|
||||||
|
|
||||||
void Update(){
|
void Update(){
|
||||||
txt_money.text = "$"+PlayerController.t.position.y.ToString();
|
txt_money.text = "$"+(PlayerController.t.position.y*moneyMultiplier).ToString("n4");
|
||||||
|
|
||||||
|
txt_money.rectTransform.position = Camera.main.WorldToScreenPoint(PlayerController.t.position + txtMoneyOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ using UnityEngine;
|
||||||
public class OptionsSpawner : MonoBehaviour
|
public class OptionsSpawner : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static OptionsSpawner instance { get; private set; }
|
public static OptionsSpawner instance { get; private set; }
|
||||||
void Awake(){
|
void Awake()
|
||||||
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
public Transform optionGood;
|
public Transform optionGood;
|
||||||
|
|
@ -15,24 +16,40 @@ public class OptionsSpawner : MonoBehaviour
|
||||||
public float SpawnTimer = 5;
|
public float SpawnTimer = 5;
|
||||||
|
|
||||||
float t;
|
float t;
|
||||||
void Update(){
|
void Update()
|
||||||
|
{
|
||||||
if (!PlayerController.Started) { return; }
|
if (!PlayerController.Started) { return; }
|
||||||
if(t < SpawnTimer){
|
if (t < SpawnTimer)
|
||||||
|
{
|
||||||
t += Time.deltaTime;
|
t += Time.deltaTime;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
t = 0;
|
t = 0;
|
||||||
|
|
||||||
|
|
||||||
float newGoodRate = Random.Range(1.05f, 1.25f);
|
float newGoodRate = 1.05f + GetRandomRateDiff();
|
||||||
float newBadRate = Random.Range(0.75f, 0.95f);
|
|
||||||
|
|
||||||
SpawnGood(newGoodRate);
|
SpawnGood(newGoodRate);
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
float newBadRate = 0.95f - GetRandomRateDiff();
|
||||||
SpawnBad(newBadRate);
|
SpawnBad(newBadRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SpawnGood(float rate, Vector3? position = null){
|
|
||||||
if(position ==null){
|
float GetRandomRateDiff()
|
||||||
|
{
|
||||||
|
float newRandom = Random.Range(1f, 100f);
|
||||||
|
|
||||||
|
return 1- Mathf.Sqrt(newRandom) / 10f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpawnGood(float rate, Vector3? position = null)
|
||||||
|
{
|
||||||
|
if (position == null)
|
||||||
|
{
|
||||||
position = PlayerController.t.position + new Vector3(PlayerController.t.right.x * Random.Range(SpawnDistanceMin.x, SpawnDistanceMax.x), PlayerController.t.right.y * Random.Range(SpawnDistanceMin.y, SpawnDistanceMax.y));
|
position = PlayerController.t.position + new Vector3(PlayerController.t.right.x * Random.Range(SpawnDistanceMin.x, SpawnDistanceMax.x), PlayerController.t.right.y * Random.Range(SpawnDistanceMin.y, SpawnDistanceMax.y));
|
||||||
}
|
}
|
||||||
Transform newGood = Instantiate(optionGood, (Vector3)position, Quaternion.identity);
|
Transform newGood = Instantiate(optionGood, (Vector3)position, Quaternion.identity);
|
||||||
|
|
@ -40,8 +57,10 @@ public class OptionsSpawner : MonoBehaviour
|
||||||
newGood.name += "," + rate;
|
newGood.name += "," + rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpawnBad(float rate, Vector3? position = null){
|
void SpawnBad(float rate, Vector3? position = null)
|
||||||
if(position ==null){
|
{
|
||||||
|
if (position == null)
|
||||||
|
{
|
||||||
position = PlayerController.t.position + new Vector3(PlayerController.t.right.x * Random.Range(SpawnDistanceMin.x, SpawnDistanceMax.x), PlayerController.t.right.y * Random.Range(SpawnDistanceMin.y, SpawnDistanceMax.y));
|
position = PlayerController.t.position + new Vector3(PlayerController.t.right.x * Random.Range(SpawnDistanceMin.x, SpawnDistanceMax.x), PlayerController.t.right.y * Random.Range(SpawnDistanceMin.y, SpawnDistanceMax.y));
|
||||||
}
|
}
|
||||||
Transform newBad = Instantiate(optionBad, (Vector3)position, Quaternion.identity);
|
Transform newBad = Instantiate(optionBad, (Vector3)position, Quaternion.identity);
|
||||||
|
|
@ -49,7 +68,8 @@ public class OptionsSpawner : MonoBehaviour
|
||||||
newBad.name += "," + rate;
|
newBad.name += "," + rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reposition(){
|
public void Reposition()
|
||||||
|
{
|
||||||
// optionGood.position = PlayerController.instance.transform.position + (SpawnDistance * 1.5f);
|
// optionGood.position = PlayerController.instance.transform.position + (SpawnDistance * 1.5f);
|
||||||
// optionBad.position = PlayerController.instance.transform.position + (SpawnDistance);
|
// optionBad.position = PlayerController.instance.transform.position + (SpawnDistance);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,17 @@ using UnityEngine;
|
||||||
public class PlayerController : MonoBehaviour
|
public class PlayerController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static PlayerController instance{get; private set;}
|
public static PlayerController instance{get; private set;}
|
||||||
|
public Sprite upwardSprite;
|
||||||
|
public Sprite downwardSprite;
|
||||||
|
public Sprite normalSprite;
|
||||||
public static Transform t {get {return instance.transform; }}
|
public static Transform t {get {return instance.transform; }}
|
||||||
void Awake(){
|
void Awake(){
|
||||||
instance= this;
|
instance= this;
|
||||||
|
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||||
}
|
}
|
||||||
public Vector3 eulerAngles;
|
public Vector3 eulerAngles;
|
||||||
public float movingSpeed = 1;
|
public float movingSpeed = 1;
|
||||||
|
public float boostSpeed= 2;
|
||||||
public float turnAngle = 15;
|
public float turnAngle = 15;
|
||||||
public GameObject trailPrefab;
|
public GameObject trailPrefab;
|
||||||
public Transform currentTrail;
|
public Transform currentTrail;
|
||||||
|
|
@ -18,6 +23,7 @@ public class PlayerController : MonoBehaviour
|
||||||
public float senseRadius = 5;
|
public float senseRadius = 5;
|
||||||
|
|
||||||
public bool isUp { get { return transform.eulerAngles.z != 360-turnAngle;}}
|
public bool isUp { get { return transform.eulerAngles.z != 360-turnAngle;}}
|
||||||
|
SpriteRenderer spriteRenderer;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
CameraFollower.Target = transform;
|
CameraFollower.Target = transform;
|
||||||
|
|
@ -51,23 +57,26 @@ public class PlayerController : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool boosting =false;
|
public static bool boosting =false;
|
||||||
IEnumerator giveBoost(float perc){
|
IEnumerator giveBoost(float perc){
|
||||||
boosting=true;
|
boosting=true;
|
||||||
float newY = transform.position.y * perc;
|
float newY = transform.position.y * perc;
|
||||||
|
spriteRenderer.sprite = (perc > 1) ? upwardSprite : downwardSprite;
|
||||||
if(perc > 1){
|
if(perc > 1){
|
||||||
while(transform.position.y < newY){
|
while(transform.position.y < newY){
|
||||||
transform.position += new Vector3(0,movingSpeed,0);
|
transform.position += new Vector3(0,boostSpeed,0);
|
||||||
|
|
||||||
if(!isUp){SwitchSide();}
|
if(!isUp){SwitchSide();}
|
||||||
yield return new WaitForFixedUpdate();
|
yield return new WaitForFixedUpdate();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
while(transform.position.y > newY){
|
while(transform.position.y > newY){
|
||||||
transform.position -= new Vector3(0,movingSpeed,0);
|
transform.position -= new Vector3(0,boostSpeed,0);
|
||||||
if(isUp){SwitchSide();}
|
if(isUp){SwitchSide();}
|
||||||
yield return new WaitForFixedUpdate();
|
yield return new WaitForFixedUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
spriteRenderer.sprite = normalSprite;
|
||||||
boosting=false;
|
boosting=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,6 +89,9 @@ public class PlayerController : MonoBehaviour
|
||||||
currentTrail = newTrail.transform;
|
currentTrail = newTrail.transform;
|
||||||
newTrail.GetComponent<TrailRenderer>().startColor = newTrail.GetComponent<TrailRenderer>().endColor = (isUp) ? Color.green:Color.red;
|
newTrail.GetComponent<TrailRenderer>().startColor = newTrail.GetComponent<TrailRenderer>().endColor = (isUp) ? Color.green:Color.red;
|
||||||
|
|
||||||
|
|
||||||
|
// GetComponent<SpriteRenderer>().sprite = (isUp) ? upwardSprite : downwardSprite;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user