Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3ef214d14f
19 changed files with 317 additions and 102 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -34,3 +34,5 @@ sysinfo.txt
|
|||
*.unitypackage
|
||||
|
||||
Assets/graphics/textures/tmp/Thumbs\.db
|
||||
|
||||
Thumbs\.db
|
||||
|
|
|
@ -208,8 +208,8 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 6cab053583d7b91469a214e0bb8c0da0, type: 3}
|
||||
m_SortingOrder: 2
|
||||
m_Sprite: {fileID: 21300000, guid: 147285ed12283414080da771867387c3, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
|
|
@ -139,7 +139,7 @@ GameObject:
|
|||
- component: {fileID: 212157662384668488}
|
||||
- component: {fileID: 61742184318168344}
|
||||
m_Layer: 0
|
||||
m_Name: Wall
|
||||
m_Name: Wall (4)
|
||||
m_TagString: wall
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -206,6 +206,23 @@ GameObject:
|
|||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &1691542046289400
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4993135491924854}
|
||||
- component: {fileID: 212797466911108054}
|
||||
- component: {fileID: 61203284340070018}
|
||||
m_Layer: 0
|
||||
m_Name: Wall
|
||||
m_TagString: wall
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!1 &1844252952274974
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -271,10 +288,10 @@ Transform:
|
|||
m_GameObject: {fileID: 1376851329299758}
|
||||
m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: -0.87, y: 9.56, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 3, z: 1}
|
||||
m_LocalScale: {x: 0.10000005, y: 3.000002, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4896145802546722}
|
||||
m_RootOrder: 0
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4524829645232432
|
||||
Transform:
|
||||
|
@ -314,7 +331,7 @@ Transform:
|
|||
m_GameObject: {fileID: 1686504243753214}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.3, y: 0.05, z: 1}
|
||||
m_LocalScale: {x: 20, y: 6, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4896748037289080}
|
||||
m_RootOrder: 0
|
||||
|
@ -342,6 +359,7 @@ Transform:
|
|||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4993135491924854}
|
||||
- {fileID: 4443867424783896}
|
||||
- {fileID: 4947857444302422}
|
||||
- {fileID: 4958236485783856}
|
||||
|
@ -374,7 +392,7 @@ Transform:
|
|||
m_LocalScale: {x: 0.10000005, y: 3, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4896145802546722}
|
||||
m_RootOrder: 3
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4947857444302422
|
||||
Transform:
|
||||
|
@ -387,7 +405,7 @@ Transform:
|
|||
m_LocalScale: {x: 0.1, y: 3, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4896145802546722}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!4 &4958236485783856
|
||||
Transform:
|
||||
|
@ -400,8 +418,21 @@ Transform:
|
|||
m_LocalScale: {x: 0.1, y: 3, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4896145802546722}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
|
||||
--- !u!4 &4993135491924854
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1691542046289400}
|
||||
m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: -0.87, y: 9.56, z: 0}
|
||||
m_LocalScale: {x: 0.1, y: 3, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4896145802546722}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &61017911347839236
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -452,6 +483,31 @@ BoxCollider2D:
|
|||
serializedVersion: 2
|
||||
m_Size: {x: 10, y: 10}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!61 &61203284340070018
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1691542046289400}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 2.5762396}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 10, y: 10}
|
||||
newSize: {x: 10, y: 10}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 10, y: 4.847521}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!61 &61328448285356816
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -491,11 +547,11 @@ BoxCollider2D:
|
|||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
border: {x: 0.049999997, y: 0.049999997, z: 0.049999997, w: 0.049999997}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 0.16, y: 0.16}
|
||||
newSize: {x: 0.16, y: 0.16}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 1
|
||||
|
@ -514,7 +570,7 @@ BoxCollider2D:
|
|||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Offset: {x: 0, y: -2.8089824}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
|
@ -525,7 +581,7 @@ BoxCollider2D:
|
|||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 10, y: 10}
|
||||
m_Size: {x: 10, y: 4.3820353}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!61 &61881867638551418
|
||||
BoxCollider2D:
|
||||
|
@ -541,11 +597,11 @@ BoxCollider2D:
|
|||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
border: {x: 0.049999997, y: 0.049999997, z: 0.049999997, w: 0.049999997}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 0.16, y: 0.16}
|
||||
newSize: {x: 0.16, y: 0.16}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
|
@ -588,6 +644,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 8b8cc30ac6e59724bba6536a17fbf027, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
graphics: {fileID: 1686504243753214}
|
||||
--- !u!114 &114795477922050694
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
|
@ -772,16 +829,16 @@ SpriteRenderer:
|
|||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: c4ac414a6adb1234a978da09806b7d81, type: 3}
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 10, y: 10}
|
||||
m_Size: {x: 0.16, y: 0.16}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!212 &212625439943302556
|
||||
SpriteRenderer:
|
||||
|
@ -828,6 +885,51 @@ SpriteRenderer:
|
|||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!212 &212797466911108054
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1691542046289400}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 4294967295
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 7cf5bb3a2568ab643b2892aa322e64b2, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 10, y: 10}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
--- !u!212 &212881422167649272
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
|
|
|
@ -803,6 +803,7 @@ GameObject:
|
|||
- component: {fileID: 881384370}
|
||||
- component: {fileID: 881384369}
|
||||
- component: {fileID: 881384368}
|
||||
- component: {fileID: 881384372}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
|
@ -844,7 +845,7 @@ Camera:
|
|||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
orthographic size: 10
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
|
@ -873,6 +874,18 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &881384372
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 881384367}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5d9a051e822e2cf4ea3ca01c5a4df37c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
followThis: {fileID: 0}
|
||||
--- !u!1 &1487324256
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -900,7 +913,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gameOverPanel: {fileID: 216517958}
|
||||
gameOverPanel: {fileID: 354516592}
|
||||
--- !u!4 &1487324258
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1021,4 +1034,5 @@ MonoBehaviour:
|
|||
playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f,
|
||||
type: 2}
|
||||
start: {fileID: 766094370}
|
||||
ui: {fileID: 0}
|
||||
ui: {fileID: 1487324256}
|
||||
cam: {fileID: 881384367}
|
||||
|
|
|
@ -446,7 +446,7 @@ GameObject:
|
|||
- component: {fileID: 569304360}
|
||||
- component: {fileID: 569304359}
|
||||
m_Layer: 5
|
||||
m_Name: Canvas
|
||||
m_Name: PauseMenu
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -1096,6 +1096,7 @@ GameObject:
|
|||
- component: {fileID: 1974548622}
|
||||
- component: {fileID: 1974548621}
|
||||
- component: {fileID: 1974548620}
|
||||
- component: {fileID: 1974548623}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
|
@ -1160,7 +1161,18 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 1974548621}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1974548618}
|
||||
m_MethodName:
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName:
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
|
||||
Culture=neutral, PublicKeyToken=null
|
||||
--- !u!114 &1974548621
|
||||
|
@ -1196,3 +1208,15 @@ CanvasRenderer:
|
|||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1974548618}
|
||||
--- !u!114 &1974548623
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 1974548618}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gameOverPanel: {fileID: 0}
|
||||
|
|
|
@ -278,7 +278,7 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 198}
|
||||
m_AnchoredPosition: {x: 0, y: 122}
|
||||
m_SizeDelta: {x: 800, y: 200}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &863866092
|
||||
|
@ -624,6 +624,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gameOverPanel: {fileID: 0}
|
||||
--- !u!1 &1586619316
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -956,3 +957,4 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 4f52f2b666c1ec64195aad9936df2d4f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
gameOverPanel: {fileID: 0}
|
||||
|
|
|
@ -5,21 +5,31 @@ using UnityEngine;
|
|||
public class CameraControl : MonoBehaviour {
|
||||
|
||||
[SerializeField]
|
||||
public GameObject followThis;
|
||||
private GameObject followThis;
|
||||
|
||||
private Vector3 offset;
|
||||
|
||||
void Start()
|
||||
{
|
||||
offset = transform.position - followThis.transform.position;
|
||||
if (followThis == null)
|
||||
return;
|
||||
offset = transform.position - followThis.transform.position;
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
if (followThis == null)
|
||||
return;
|
||||
var target = followThis.transform.position + offset;
|
||||
var targetVec = target - transform.position;
|
||||
targetVec.Scale (new Vector3 (0.05f, 0.05f, 0));
|
||||
|
||||
transform.position = transform.position + targetVec;
|
||||
}
|
||||
|
||||
public void SetFollow(GameObject g)
|
||||
{
|
||||
followThis = g;
|
||||
offset = transform.position - followThis.transform.position;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,9 @@ using UnityEngine;
|
|||
public class Door : MonoBehaviour {
|
||||
private bool locked = false;
|
||||
|
||||
[SerializeField]
|
||||
GameObject graphics;
|
||||
|
||||
BoxCollider2D boundingBox;
|
||||
BoxCollider2D triggerBox;
|
||||
// Use this for initialization
|
||||
|
@ -13,8 +16,10 @@ public class Door : MonoBehaviour {
|
|||
foreach (BoxCollider2D collider in colliders) {
|
||||
if (collider.isTrigger) {
|
||||
triggerBox = collider;
|
||||
Debug.Log("Found Door trigger");
|
||||
} else {
|
||||
boundingBox = collider;
|
||||
Debug.Log("Found Door collider");
|
||||
}
|
||||
}
|
||||
Unlock();
|
||||
|
@ -25,6 +30,7 @@ public class Door : MonoBehaviour {
|
|||
locked = true;
|
||||
boundingBox.enabled = true;
|
||||
triggerBox.enabled = false;
|
||||
graphics.GetComponent<SpriteRenderer>().enabled = true;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
|
@ -32,6 +38,7 @@ public class Door : MonoBehaviour {
|
|||
locked = false;
|
||||
boundingBox.enabled = false;
|
||||
triggerBox.enabled = true;
|
||||
graphics.GetComponent<SpriteRenderer>().enabled = false;
|
||||
}
|
||||
|
||||
public bool IsLocked()
|
||||
|
|
|
@ -6,6 +6,7 @@ public abstract class Mob : Entity {
|
|||
readonly int maxHP;
|
||||
int currentHP;
|
||||
bool isDead;
|
||||
int damage;
|
||||
|
||||
// Constructor
|
||||
public Mob(EntityObjective referringObjective, int maxHP) : base(referringObjective)
|
||||
|
@ -33,4 +34,14 @@ public abstract class Mob : Entity {
|
|||
if (!isDead)
|
||||
currentHP = (currentHP + healAmount > currentHP) ? maxHP : currentHP + healAmount;
|
||||
}
|
||||
|
||||
public void SetDamage(int dmg)
|
||||
{
|
||||
damage = dmg;
|
||||
}
|
||||
|
||||
public int GetDamage()
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,14 @@ public class Player : Mob {
|
|||
Debug.Log("Collision");
|
||||
if (collision.collider.tag == "wall") {
|
||||
Kill();
|
||||
} else if (collision.collider.tag == "enemy")
|
||||
{
|
||||
Mob m = collision.collider.GetComponent(typeof(Mob)) as Mob;
|
||||
if(m != null)
|
||||
{
|
||||
InflictDamage(m.GetDamage()); // TODO think about Mob attac mechanic
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,11 @@ public class GameController : MonoBehaviour {
|
|||
[SerializeField]
|
||||
private GameObject ui;
|
||||
|
||||
private bool engineInitDone;
|
||||
[SerializeField]
|
||||
private GameObject cam;
|
||||
|
||||
private bool engineInitDone;
|
||||
private Player player;
|
||||
public static GameController instance;
|
||||
public GameController()
|
||||
{
|
||||
|
@ -28,7 +31,7 @@ public class GameController : MonoBehaviour {
|
|||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
//ChangeState(GameState.INIT);
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -79,7 +82,10 @@ public class GameController : MonoBehaviour {
|
|||
playerPrefab
|
||||
};
|
||||
start.SetObjective(new EntityObjective(start, tmp));
|
||||
start.OnPlayerEnter();
|
||||
start.GetObjective().Activate();
|
||||
player = ((EntityObjective) start.GetObjective()).GetEntities()[0].GetComponent<Player>();
|
||||
cam.GetComponent<CameraControl>().SetFollow(player.gameObject);
|
||||
((EntityObjective)start.GetObjective()).Remove(player.gameObject);
|
||||
}
|
||||
|
||||
private void Starting()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EntityObjective : Objective{
|
||||
public class EntityObjective : Objective {
|
||||
List<GameObject> prefabList;
|
||||
List<GameObject> entityList;
|
||||
List<Transform> spawnPointList;
|
||||
|
@ -10,6 +10,7 @@ public class EntityObjective : Objective{
|
|||
// Constructor
|
||||
public EntityObjective(Room objectiveCaller, List<GameObject> prefabList) : base(objectiveCaller)
|
||||
{
|
||||
this.entityList = new List<GameObject>();
|
||||
this.prefabList = prefabList;
|
||||
spawnPointList = objectiveCaller.GetSpawnpoints ();
|
||||
}
|
||||
|
@ -24,6 +25,7 @@ public class EntityObjective : Objective{
|
|||
Debug.Log("Instantiating Prefab");
|
||||
GameObject tempObject = GameObject.Instantiate (i);
|
||||
tempObject.transform.position = spawnPointList [Random.Range (0, spawnPointList.Count)].position;
|
||||
entityList.Add(tempObject);
|
||||
}
|
||||
|
||||
objectiveCaller.Lock();
|
||||
|
@ -36,4 +38,9 @@ public class EntityObjective : Objective{
|
|||
if (entityList.Count == 0)
|
||||
objectiveCaller.Unlock ();
|
||||
}
|
||||
|
||||
public List<GameObject> GetEntities()
|
||||
{
|
||||
return entityList;
|
||||
}
|
||||
}
|
|
@ -1,38 +1,50 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class PlayerMovement : MonoBehaviour {
|
||||
|
||||
[SerializeField]
|
||||
public float acceleration = 3;
|
||||
[SerializeField]
|
||||
public float friction = 0.1f;
|
||||
[SerializeField]
|
||||
public float turnSpeed = 2;
|
||||
[SerializeField]
|
||||
public float drift = 1f;
|
||||
[SerializeField]
|
||||
public float brake = 2f;
|
||||
|
||||
Rigidbody2D rigidbody2D;
|
||||
|
||||
// Use this for initialization
|
||||
void Start() {
|
||||
rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
Vector3 speedVec = new Vector3(rigidbody2D.velocity.x, rigidbody2D.velocity.y, 0);
|
||||
float speed = speedVec.magnitude;
|
||||
|
||||
{ // Forward
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerMovement : MonoBehaviour {
|
||||
private bool firstKeyPressed;
|
||||
|
||||
[SerializeField]
|
||||
public float acceleration = 3;
|
||||
[SerializeField]
|
||||
public float friction = 0.1f;
|
||||
[SerializeField]
|
||||
public float turnSpeed = 2;
|
||||
[SerializeField]
|
||||
public float drift = 1f;
|
||||
[SerializeField]
|
||||
public float brake = 2f;
|
||||
|
||||
Rigidbody2D rigidbody2D;
|
||||
|
||||
// Use this for initialization
|
||||
void Start() {
|
||||
rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(!firstKeyPressed && Input.anyKey)
|
||||
{
|
||||
firstKeyPressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
if (!firstKeyPressed)
|
||||
return;
|
||||
|
||||
Vector3 speedVec = new Vector3(rigidbody2D.velocity.x, rigidbody2D.velocity.y, 0);
|
||||
float speed = speedVec.magnitude;
|
||||
|
||||
{ // Forward
|
||||
rigidbody2D.AddForce(transform.up * acceleration);
|
||||
}
|
||||
{// Drag
|
||||
Vector3 drag = speedVec.normalized * speed * speed * friction * -1;
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
drag *= brake;
|
||||
rigidbody2D.AddForce(drag);
|
||||
Debug.DrawLine(transform.position, transform.position + drag, Color.cyan, 0.01f, false);
|
||||
{// Drag
|
||||
Vector3 drag = speedVec.normalized * speed * speed * friction * -1;
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
drag *= brake;
|
||||
rigidbody2D.AddForce(drag);
|
||||
Debug.DrawLine(transform.position, transform.position + drag, Color.cyan, 0.01f, false);
|
||||
}
|
||||
{ // Drift
|
||||
Vector3 forwardNorm = (transform.localRotation * Vector3.up).normalized * speedVec.magnitude;
|
||||
|
@ -40,20 +52,20 @@ public class PlayerMovement : MonoBehaviour {
|
|||
br *= drift;
|
||||
rigidbody2D.AddForce(br);
|
||||
//Debug.Log(br);
|
||||
Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false);
|
||||
}
|
||||
if (Input.GetKey(KeyCode.A))
|
||||
Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false);
|
||||
}
|
||||
if (Input.GetKey(KeyCode.A))
|
||||
rigidbody2D.MoveRotation(rigidbody2D.rotation + turnSpeed);
|
||||
//transform.Rotate(Vector3.forward * turnSpeed);
|
||||
if (Input.GetKey(KeyCode.D))
|
||||
rigidbody2D.MoveRotation(rigidbody2D.rotation - turnSpeed);
|
||||
//transform.Rotate(Vector3.forward * -turnSpeed);
|
||||
// Debug lines
|
||||
Debug.DrawLine(transform.position, transform.position + speedVec, Color.magenta, 0.01f, false);
|
||||
if (Input.GetKey(KeyCode.D))
|
||||
rigidbody2D.MoveRotation(rigidbody2D.rotation - turnSpeed);
|
||||
//transform.Rotate(Vector3.forward * -turnSpeed);
|
||||
// Debug lines
|
||||
Debug.DrawLine(transform.position, transform.position + speedVec, Color.magenta, 0.01f, false);
|
||||
Debug.DrawLine(transform.position, transform.position + transform.localRotation * Vector3.up, Color.yellow, 0.01f, false);
|
||||
|
||||
//Debug.Log(transform.localRotation.eulerAngles);
|
||||
//Debug.Log(transform.localRotation * Vector3.up);
|
||||
//Debug.Log(curspeed);
|
||||
}
|
||||
}
|
||||
//Debug.Log(transform.localRotation.eulerAngles);
|
||||
//Debug.Log(transform.localRotation * Vector3.up);
|
||||
//Debug.Log(curspeed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ public class Room : MonoBehaviour {
|
|||
|
||||
}
|
||||
Debug.Log("Spawnpoints in Room: " + spawnpoints.Count);
|
||||
|
||||
//Unlock();
|
||||
}
|
||||
|
||||
public void SetObjective(Objective o)
|
||||
|
@ -60,13 +62,21 @@ public class Room : MonoBehaviour {
|
|||
}
|
||||
}
|
||||
|
||||
public Objective GetObjective()
|
||||
{
|
||||
return objective;
|
||||
}
|
||||
|
||||
public void OnPlayerEnter()
|
||||
{
|
||||
objective.Activate();
|
||||
if(objective != null)
|
||||
objective.Activate();
|
||||
}
|
||||
|
||||
public List<Transform> GetSpawnpoints()
|
||||
{
|
||||
return spawnpoints;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,30 +2,30 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIController : MonoBehaviour {
|
||||
|
||||
private GameObject score;
|
||||
public class UIController : MonoBehaviour {
|
||||
|
||||
private GameObject score;
|
||||
private GameObject pauseMenu;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject gameOverPanel;
|
||||
// Use this for initialization
|
||||
private GameObject gameOverPanel;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
}
|
||||
public static UIController instance;
|
||||
|
||||
public void ShowPauseMenu()
|
||||
{
|
||||
pauseMenu.SetActive(true);
|
||||
}
|
||||
public void ClosePauseMenu()
|
||||
{
|
||||
pauseMenu.SetActive(false);
|
||||
}
|
||||
public static UIController instance;
|
||||
|
||||
public void ShowPauseMenu()
|
||||
{
|
||||
pauseMenu.SetActive(true);
|
||||
}
|
||||
|
||||
public void ClosePauseMenu()
|
||||
{
|
||||
pauseMenu.SetActive(false);
|
||||
}
|
||||
|
||||
public void LoadSceneByIndex(int index)
|
||||
{
|
||||
Debug.Log("Loaded scene " + index);
|
||||
|
@ -52,6 +52,6 @@ public class UIController : MonoBehaviour {
|
|||
} else {
|
||||
Debug.Log("No game over panel assigned");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
BIN
Assets/graphics/textures/FixedObjects/Rock/Thumbs.db
Normal file
BIN
Assets/graphics/textures/FixedObjects/Rock/Thumbs.db
Normal file
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 6 KiB After Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 19 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1fa1a8e153b3443439cea0e1f983f2a6
|
||||
guid: ddc6452a517b6824b9195f30b422202a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
|
Loading…
Add table
Reference in a new issue