diff options
| -rw-r--r-- | nGJ2019/Assets/Prefabs/Net.prefab | 155 | ||||
| -rw-r--r-- | nGJ2019/Assets/Prefabs/Net.prefab.meta | 7 | ||||
| -rw-r--r-- | nGJ2019/Assets/Scenes/Marcin_sandbox.unity | 8 | ||||
| -rw-r--r-- | nGJ2019/Assets/Scripts/EventTimeline.cs | 11 | ||||
| -rw-r--r-- | nGJ2019/Assets/Scripts/LevelScrolling.cs | 4 | ||||
| -rw-r--r-- | nGJ2019/Assets/Scripts/ObstacleSpawner.cs | 110 | ||||
| -rw-r--r-- | nGJ2019/Assets/Scripts/ObstacleType.cs | 2 | ||||
| -rw-r--r-- | nGJ2019/Assets/Sprites/bg_material.mat | 78 | ||||
| -rw-r--r-- | nGJ2019/Assets/Sprites/bg_material.mat.meta | 8 | 
9 files changed, 319 insertions, 64 deletions
| diff --git a/nGJ2019/Assets/Prefabs/Net.prefab b/nGJ2019/Assets/Prefabs/Net.prefab new file mode 100644 index 0000000..a062489 --- /dev/null +++ b/nGJ2019/Assets/Prefabs/Net.prefab @@ -0,0 +1,155 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!65 &2069605559480401724 +BoxCollider: +  m_ObjectHideFlags: 0 +  m_CorrespondingSourceObject: {fileID: 0} +  m_PrefabInstance: {fileID: 0} +  m_PrefabAsset: {fileID: 0} +  m_GameObject: {fileID: 2575384151648682035} +  m_Material: {fileID: 0} +  m_IsTrigger: 0 +  m_Enabled: 1 +  serializedVersion: 2 +  m_Size: {x: 1.7593225, y: 1.677966, z: 0.020000031} +  m_Center: {x: 0.00000047668814, y: 0.00000002980232, z: -0.010000003} +--- !u!114 &3040956702141405622 +MonoBehaviour: +  m_ObjectHideFlags: 0 +  m_CorrespondingSourceObject: {fileID: 0} +  m_PrefabInstance: {fileID: 0} +  m_PrefabAsset: {fileID: 0} +  m_GameObject: {fileID: 2575384151648682035} +  m_Enabled: 1 +  m_EditorHideFlags: 0 +  m_Script: {fileID: 11500000, guid: 992985330ae614733ac43350c8ea0ab0, type: 3} +  m_Name:  +  m_EditorClassIdentifier:  +  type: 5 +--- !u!1 &5435085934957895830 +GameObject: +  m_ObjectHideFlags: 0 +  m_CorrespondingSourceObject: {fileID: 0} +  m_PrefabInstance: {fileID: 0} +  m_PrefabAsset: {fileID: 0} +  serializedVersion: 6 +  m_Component: +  - component: {fileID: 4608654727184290691} +  m_Layer: 0 +  m_Name: Net +  m_TagString: Untagged +  m_Icon: {fileID: 0} +  m_NavMeshLayer: 0 +  m_StaticEditorFlags: 0 +  m_IsActive: 1 +--- !u!4 &4608654727184290691 +Transform: +  m_ObjectHideFlags: 0 +  m_CorrespondingSourceObject: {fileID: 0} +  m_PrefabInstance: {fileID: 0} +  m_PrefabAsset: {fileID: 0} +  m_GameObject: {fileID: 5435085934957895830} +  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} +  m_LocalPosition: {x: 17.166718, y: 2.0016038, z: -26.1938} +  m_LocalScale: {x: 1, y: 1, z: 1} +  m_Children: +  - {fileID: 1578164108839498272} +  m_Father: {fileID: 0} +  m_RootOrder: 0 +  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &5808648649210566970 +PrefabInstance: +  m_ObjectHideFlags: 0 +  serializedVersion: 2 +  m_Modification: +    m_TransformParent: {fileID: 4608654727184290691} +    m_Modifications: +    - target: {fileID: -927199367670048503, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_Name +      value: net_1 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalPosition.x +      value: -0.003036499 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalPosition.y +      value: 0 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalPosition.z +      value: 0.009361267 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalRotation.x +      value: -0 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalRotation.y +      value: -0.7786035 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalRotation.z +      value: -0 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalRotation.w +      value: 0.6275163 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_RootOrder +      value: 0 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalEulerAnglesHint.x +      value: 0 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalEulerAnglesHint.y +      value: -102.26601 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalEulerAnglesHint.z +      value: 0 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalScale.x +      value: 4.94472 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalScale.y +      value: 4.94472 +      objectReference: {fileID: 0} +    - target: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +        type: 3} +      propertyPath: m_LocalScale.z +      value: 4.94472 +      objectReference: {fileID: 0} +    m_RemovedComponents: [] +  m_SourcePrefab: {fileID: 100100000, guid: 7077c39c18eb97e489e858f6908bb67c, type: 3} +--- !u!1 &2575384151648682035 stripped +GameObject: +  m_CorrespondingSourceObject: {fileID: -927199367670048503, guid: 7077c39c18eb97e489e858f6908bb67c, +    type: 3} +  m_PrefabInstance: {fileID: 5808648649210566970} +  m_PrefabAsset: {fileID: 0} +--- !u!4 &1578164108839498272 stripped +Transform: +  m_CorrespondingSourceObject: {fileID: -4216859302048453862, guid: 7077c39c18eb97e489e858f6908bb67c, +    type: 3} +  m_PrefabInstance: {fileID: 5808648649210566970} +  m_PrefabAsset: {fileID: 0} diff --git a/nGJ2019/Assets/Prefabs/Net.prefab.meta b/nGJ2019/Assets/Prefabs/Net.prefab.meta new file mode 100644 index 0000000..ae29c1a --- /dev/null +++ b/nGJ2019/Assets/Prefabs/Net.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 459b4334249a5491ca7e8e02a92f8141 +PrefabImporter: +  externalObjects: {} +  userData:  +  assetBundleName:  +  assetBundleVariant:  diff --git a/nGJ2019/Assets/Scenes/Marcin_sandbox.unity b/nGJ2019/Assets/Scenes/Marcin_sandbox.unity index 42a9843..068ee2d 100644 --- a/nGJ2019/Assets/Scenes/Marcin_sandbox.unity +++ b/nGJ2019/Assets/Scenes/Marcin_sandbox.unity @@ -381,7 +381,7 @@ Transform:    m_PrefabAsset: {fileID: 0}    m_GameObject: {fileID: 1342555976}    m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} -  m_LocalPosition: {x: 8.886415, y: 0, z: 0} +  m_LocalPosition: {x: 8.886415, y: 0, z: 10}    m_LocalScale: {x: 1.736111, y: 1.736111, z: 1}    m_Children: []    m_Father: {fileID: 202725832} @@ -404,7 +404,7 @@ SpriteRenderer:    m_RenderingLayerMask: 1    m_RendererPriority: 0    m_Materials: -  - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} +  - {fileID: 2100000, guid: 5d5aaa9c2f47c436b922e7b7869e8557, type: 2}    m_StaticBatchInfo:      firstSubMesh: 0      subMeshCount: 0 @@ -423,7 +423,7 @@ SpriteRenderer:    m_LightmapParameters: {fileID: 0}    m_SortingLayerID: 0    m_SortingLayer: 0 -  m_SortingOrder: -1 +  m_SortingOrder: 0    m_Sprite: {fileID: 21300000, guid: 420921107e115344ea4e97eeb2bca416, type: 3}    m_Color: {r: 1, g: 1, b: 1, a: 1}    m_FlipX: 0 @@ -664,6 +664,8 @@ MonoBehaviour:      type: 3}    rockJawsPrefab: {fileID: 1998900778231223134, guid: a2b1bab6b90944171a71ff986bce4ebf,      type: 3} +  netPrefab: {fileID: 5435085934957895830, guid: 459b4334249a5491ca7e8e02a92f8141, +    type: 3}    scrolling: {fileID: 202725831}    spawnLine: 13.5  --- !u!1 &1695765865 diff --git a/nGJ2019/Assets/Scripts/EventTimeline.cs b/nGJ2019/Assets/Scripts/EventTimeline.cs index 18b87cc..465815c 100644 --- a/nGJ2019/Assets/Scripts/EventTimeline.cs +++ b/nGJ2019/Assets/Scripts/EventTimeline.cs @@ -1,19 +1,20 @@  using System;  using System.Collections;  using System.Collections.Generic; +using UnityEngine;  public class EventTimeline  {  	public class SpawnEvent  	{  		public float time; -		public float height; +		public Vector3 position;  		public ObstacleType type; -		public SpawnEvent(float time, float height, ObstacleType type) +		public SpawnEvent(float time, Vector3 position, ObstacleType type)  		{  			this.time = time; -			this.height = height; +			this.position = position;  			this.type = type;  		}  	} @@ -44,9 +45,9 @@ public class EventTimeline  		currentTime = 0;  	} -	public void Add(float time, float height, ObstacleType type) +	public void Add(float time, Vector3 position, ObstacleType type)  	{ -		futureEvents.Add(new SpawnEvent(time, height, type)); +		futureEvents.Add(new SpawnEvent(time, position, type));  		futureEvents.Sort((x,y) => x.time.CompareTo(y.time));  	} diff --git a/nGJ2019/Assets/Scripts/LevelScrolling.cs b/nGJ2019/Assets/Scripts/LevelScrolling.cs index fac0a13..7ca89e3 100644 --- a/nGJ2019/Assets/Scripts/LevelScrolling.cs +++ b/nGJ2019/Assets/Scripts/LevelScrolling.cs @@ -49,7 +49,7 @@ public class LevelScrolling : MonoBehaviour          Background.localScale = new Vector3(finalHeight, finalHeight, 1);
          var viewportX = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, 0)).x;
 -        Background.position = new Vector3(viewportX * -1, 0, 0);
 +        Background.position = new Vector3(viewportX * -1, 0, 10);
          initialBgPos = Background.position;
      }
 @@ -63,7 +63,7 @@ public class LevelScrolling : MonoBehaviour      void DestroyObstacles()
      {
 -        if (Obstacles[0].transform.position.x < -30)
 +        if (Obstacles.Count > 0 && Obstacles[0].transform.position.x < -30)
          {
              Destroy(Obstacles[0]);
              Obstacles.RemoveAt(0);
 diff --git a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs index 0e6b3ac..1615714 100644 --- a/nGJ2019/Assets/Scripts/ObstacleSpawner.cs +++ b/nGJ2019/Assets/Scripts/ObstacleSpawner.cs @@ -4,68 +4,72 @@ using UnityEngine;  public class ObstacleSpawner : MonoBehaviour  { -  private EventTimeline timeline = new EventTimeline(); +    private EventTimeline timeline = new EventTimeline(); -  public GameObject caveWallsPrefab, rockTopPrefab, rockBottomPrefab, narrowPassagePrefab, rockJawsPrefab; -  public LevelScrolling scrolling; +    public GameObject caveWallsPrefab, rockTopPrefab, rockBottomPrefab, narrowPassagePrefab, rockJawsPrefab, netPrefab; +    public LevelScrolling scrolling; -  public float spawnLine; +    public float spawnLine; -  private void spawnOnEvent(EventTimeline.SpawnEvent e) -  { -    GameObject prefab = null; - -    switch (e.type) +    private void spawnOnEvent(EventTimeline.SpawnEvent e)      { -      case ObstacleType.caveWalls: -        prefab = caveWallsPrefab; -        break; -      case ObstacleType.rockTop: -        prefab = rockTopPrefab; -        break; -      case ObstacleType.rockBottom: -        prefab = rockBottomPrefab; -        break; -      case ObstacleType.narrowPassage: -        prefab = narrowPassagePrefab; -        break; -      case ObstacleType.rockJaws: -        prefab = rockJawsPrefab; -        break; -    } +        GameObject prefab = null; -    var o = Instantiate(prefab, new Vector3(spawnLine, e.height, 0), Quaternion.identity); -    scrolling.Obstacles.Add(o); -  } +        switch (e.type) +        { +            case ObstacleType.caveWalls: +                prefab = caveWallsPrefab; +                break; +            case ObstacleType.rockTop: +                prefab = rockTopPrefab; +                break; +            case ObstacleType.rockBottom: +                prefab = rockBottomPrefab; +                break; +            case ObstacleType.narrowPassage: +                prefab = narrowPassagePrefab; +                break; +            case ObstacleType.rockJaws: +                prefab = rockJawsPrefab; +                break; +            case ObstacleType.net: +                prefab = netPrefab; +                break; +        } -  void Start() -  { -    for (int i = 0; i < 120; i += 5) -    { -      timeline.Add(i, 0, ObstacleType.caveWalls); +        var o = Instantiate(prefab, new Vector3(spawnLine, e.position.y, e.position.z), Quaternion.identity); +        scrolling.Obstacles.Add(o);      } -    timeline.Add(2, 2.75f, ObstacleType.rockTop); -    timeline.Add(8, -2, ObstacleType.rockBottom); -    timeline.Add(20, 0, ObstacleType.narrowPassage); -    timeline.Add(30, 0, ObstacleType.rockJaws); -    timeline.OnSpawnEvent += spawnOnEvent; -  } +    void Start() +    { +        for (int i = 0; i < 120; i += 5) +        { +            timeline.Add(i, new Vector3(0, 0, 0), ObstacleType.caveWalls); +        } +        timeline.Add(0, new Vector3(0, 2.75f, 0), ObstacleType.rockTop); +        timeline.Add(6, new Vector3(0, -2, 0), ObstacleType.rockBottom); +        timeline.Add(12, new Vector3(0, 0, 0), ObstacleType.narrowPassage); +        timeline.Add(20, new Vector3(0, 0, 2), ObstacleType.rockJaws); +        timeline.Add(25, new Vector3(0, 0.5f, 3), ObstacleType.net); + +        timeline.OnSpawnEvent += spawnOnEvent; +    } -  // Update is called once per frame -  void Update() -  { -    timeline.timeTick(Time.deltaTime); -  } +    // Update is called once per frame +    void Update() +    { +        timeline.timeTick(Time.deltaTime); +    } -  void OnDrawGizmosSelected() -  { -    Gizmos.color = Color.green; -    Gizmos.DrawLine(new Vector3(spawnLine, -10, 0), new Vector3(spawnLine, 10, 0)); -  } +    void OnDrawGizmosSelected() +    { +        Gizmos.color = Color.green; +        Gizmos.DrawLine(new Vector3(spawnLine, -10, 0), new Vector3(spawnLine, 10, 0)); +    } -  public EventTimeline GetEventTimeline() -  { -      return timeline; -  } +    public EventTimeline GetEventTimeline() +    { +        return timeline; +    }  } diff --git a/nGJ2019/Assets/Scripts/ObstacleType.cs b/nGJ2019/Assets/Scripts/ObstacleType.cs index 79a4980..c97a2ed 100644 --- a/nGJ2019/Assets/Scripts/ObstacleType.cs +++ b/nGJ2019/Assets/Scripts/ObstacleType.cs @@ -2,4 +2,4 @@  using System.Collections.Generic;  using UnityEngine; -public enum ObstacleType { caveWalls, rockTop, rockBottom, narrowPassage, rockJaws } +public enum ObstacleType { caveWalls, rockTop, rockBottom, narrowPassage, rockJaws, net } diff --git a/nGJ2019/Assets/Sprites/bg_material.mat b/nGJ2019/Assets/Sprites/bg_material.mat new file mode 100644 index 0000000..2234a20 --- /dev/null +++ b/nGJ2019/Assets/Sprites/bg_material.mat @@ -0,0 +1,78 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: +  serializedVersion: 6 +  m_ObjectHideFlags: 0 +  m_CorrespondingSourceObject: {fileID: 0} +  m_PrefabInstance: {fileID: 0} +  m_PrefabAsset: {fileID: 0} +  m_Name: bg_material +  m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} +  m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ALPHATEST_ON +  m_LightmapFlags: 4 +  m_EnableInstancingVariants: 0 +  m_DoubleSidedGI: 0 +  m_CustomRenderQueue: 2450 +  stringTagMap: +    RenderType: TransparentCutout +  disabledShaderPasses: [] +  m_SavedProperties: +    serializedVersion: 3 +    m_TexEnvs: +    - _BumpMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _DetailAlbedoMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _DetailMask: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _DetailNormalMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _EmissionMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _MainTex: +        m_Texture: {fileID: 2800000, guid: 420921107e115344ea4e97eeb2bca416, type: 3} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _MetallicGlossMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _OcclusionMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    - _ParallaxMap: +        m_Texture: {fileID: 0} +        m_Scale: {x: 1, y: 1} +        m_Offset: {x: 0, y: 0} +    m_Floats: +    - _BumpScale: 1 +    - _Cutoff: 0.5 +    - _DetailNormalMapScale: 1 +    - _DstBlend: 0 +    - _GlossMapScale: 1 +    - _Glossiness: 0.5 +    - _GlossyReflections: 1 +    - _Metallic: 0 +    - _Mode: 1 +    - _OcclusionStrength: 1 +    - _Parallax: 0.02 +    - _SmoothnessTextureChannel: 0 +    - _SpecularHighlights: 1 +    - _SrcBlend: 1 +    - _UVSec: 0 +    - _ZWrite: 1 +    m_Colors: +    - _Color: {r: 1, g: 1, b: 1, a: 1} +    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/nGJ2019/Assets/Sprites/bg_material.mat.meta b/nGJ2019/Assets/Sprites/bg_material.mat.meta new file mode 100644 index 0000000..7db0d75 --- /dev/null +++ b/nGJ2019/Assets/Sprites/bg_material.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5d5aaa9c2f47c436b922e7b7869e8557 +NativeFormatImporter: +  externalObjects: {} +  mainObjectFileID: 2100000 +  userData:  +  assetBundleName:  +  assetBundleVariant:  |