1
Fork 0
mirror of https://github.com/Steffo99/bleach-beach.git synced 2024-12-04 10:54:18 +00:00
This commit is contained in:
Steffo 2018-08-13 13:08:34 +02:00
parent f46973c47a
commit 751ba76215
19 changed files with 1131 additions and 207 deletions

View file

@ -31,19 +31,49 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1437013688705742
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4114672742814982}
- component: {fileID: 212723113996758088}
m_Layer: 9
m_Name: Fish Pile
m_TagString: Fish
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4056561897088050
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1195403025493360}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 21.96, y: 36.57, z: 0}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -82.64991, y: -29.3563, z: 0.40207273}
m_LocalScale: {x: 2.648, y: 0.903, z: 1}
m_Children: []
m_Children:
- {fileID: 4114672742814982}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4114672742814982
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1437013688705742}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.379, y: 0.552, z: 0}
m_LocalScale: {x: 0.18882175, y: 0.11074196, z: 1}
m_Children: []
m_Father: {fileID: 4056561897088050}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!50 &50337207293964320
Rigidbody2D:
serializedVersion: 4
@ -101,6 +131,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fishCaught: 0
fishPileSprites:
- {fileID: 21300000, guid: be5eaf9abd3481b489d582a8f1a41508, type: 3}
fishPileStages:
--- !u!114 &114327601929205558
MonoBehaviour:
m_ObjectHideFlags: 1
@ -121,6 +154,52 @@ MonoBehaviour:
harpoonAvailable: 1
maxJetFuel: 1
jetFuelRechargeSpeed: 0.1
--- !u!212 &212723113996758088
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1437013688705742}
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: be5eaf9abd3481b489d582a8f1a41508, type: 3}
m_Color: {r: 0, g: 0.98189926, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!212 &212864900431362760
SpriteRenderer:
m_ObjectHideFlags: 1

View file

@ -25,7 +25,7 @@ GameObject:
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &4978811670595372
Transform:
@ -74,7 +74,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -3
m_SortingOrder: -2
m_Sprite: {fileID: 21300000, guid: aa55a5c6b0f009a428147c305780d1de, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0

53
Assets/Prefabs/Quit with Esc.prefab generated Normal file
View file

@ -0,0 +1,53 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_SourcePrefab: {fileID: 0}
m_RootGameObject: {fileID: 1083141539684426}
m_IsPrefabAsset: 1
--- !u!1 &1083141539684426
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 6
m_Component:
- component: {fileID: 4722408669233146}
- component: {fileID: 114342689784495420}
m_Layer: 0
m_Name: Quit with Esc
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4722408669233146
Transform:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1083141539684426}
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: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114342689784495420
MonoBehaviour:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1083141539684426}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0c5fa8e61b016ab40a3e18ba5ecae525, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c5ddb823086133341948764b93db7721
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1786,7 +1786,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
seaTextures: {fileID: 1259758189242624}
speed: 0.002
speed: 0.004166667
--- !u!212 &212022742042672606
SpriteRenderer:
m_ObjectHideFlags: 1

View file

@ -54,9 +54,10 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4811992088834386}
- component: {fileID: 212513540302985290}
m_Layer: 8
m_Name: Fish Pile
m_TagString: Untagged
m_TagString: Fish
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -85,7 +86,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1506768218425990}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.27, y: 40.291958, z: 0}
m_LocalPosition: {x: 4.27, y: 42.06, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4419769467158982}
@ -114,8 +115,8 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1707044546218068}
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_LocalPosition: {x: -0.6742, y: 0.0142, z: 0}
m_LocalScale: {x: 0.5, y: 0.1, z: 1}
m_Children: []
m_Father: {fileID: 4279439219186522}
m_RootOrder: 1
@ -193,6 +194,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fishCaught: 0
fishPileSprites:
- {fileID: 21300000, guid: be5eaf9abd3481b489d582a8f1a41508, type: 3}
fishPileStages:
fishPile: {fileID: 1707044546218068}
--- !u!114 &114893472868460232
MonoBehaviour:
m_ObjectHideFlags: 1
@ -272,6 +277,52 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!212 &212513540302985290
SpriteRenderer:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1707044546218068}
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: be5eaf9abd3481b489d582a8f1a41508, type: 3}
m_Color: {r: 0, g: 0.98189926, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!212 &212928515413584804
SpriteRenderer:
m_ObjectHideFlags: 1

View file

@ -26,7 +26,7 @@ GameObject:
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &4023639078503100
Transform:

924
Assets/Scenes/Game.unity generated

File diff suppressed because it is too large Load diff

View file

@ -145,6 +145,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
fishCaught: 0
fishPileSprites: []
fishPileStages:
fishPile: {fileID: 0}
--- !u!114 &215901070
MonoBehaviour:
m_ObjectHideFlags: 0
@ -199,6 +202,48 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -5.727}
--- !u!1001 &303581856
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4722408669233146, guid: c5ddb823086133341948764b93db7721, type: 2}
propertyPath: m_RootOrder
value: 9
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c5ddb823086133341948764b93db7721, type: 2}
m_IsPrefabAsset: 0
--- !u!1 &366541447
GameObject:
m_ObjectHideFlags: 0

View file

@ -12,12 +12,10 @@ public class Cannon : MonoBehaviour {
public float startingForce = 1f;
private float force = 1f;
private SpriteRenderer hullSpriteRenderer;
private SpriteRenderer spriteRenderer;
private void Start()
{
hullSpriteRenderer = hull.GetComponent<SpriteRenderer>();
spriteRenderer = GetComponent<SpriteRenderer>();
//Disable enemy and player collisions
Physics2D.IgnoreLayerCollision(8, 8);

View file

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Countdown : MonoBehaviour {
public float startingTime = 500f;
private float currentTime = 500f;
private Text timerText;
void Start () {
currentTime = startingTime;
timerText = GetComponent<Text>();
}
void Update () {
currentTime -= Time.deltaTime;
timerText.text = string.Format("{0}:{1:00}", (int)currentTime / 60, (int)currentTime % 60);
if(currentTime <= 0f)
{
TheEnd();
}
}
void TheEnd()
{
//Do something
}
}

11
Assets/Scripts/Countdown.cs.meta generated Normal file
View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80f6e912b74c1744d83aedb0e365fa93
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -32,14 +32,22 @@ public class EnemyShipAi : MonoBehaviour {
//Find a target fish
if(target == null || timeSinceLastTarget > timeBeforeChangingTarget)
{
if(target != null)
if (target != null)
{
target.GetComponent<FishAi>().targetedBy = null;
FishAi fishAi = target.GetComponent<FishAi>();
if (fishAi != null)
{
fishAi.targetedBy = null;
}
}
target = FindClosestFish(GameObject.FindGameObjectsWithTag("Fish"));
if (target != null)
{
target.GetComponent<FishAi>().targetedBy = gameObject;
FishAi fishAi = target.GetComponent<FishAi>();
if (fishAi != null)
{
fishAi.targetedBy = gameObject;
}
}
timeBeforeChangingTarget = 0f;
}
@ -112,11 +120,32 @@ public class EnemyShipAi : MonoBehaviour {
GameObject FindClosestFish(GameObject[] fish)
{
GameObject result = null;
float distance;
float minimumDistance = Mathf.Infinity;
foreach (GameObject fishInstance in fish)
{
if (fishInstance.GetComponent<FishAi>().targetedBy != null) continue;
float distance = Vector3.Distance(fishInstance.transform.position, transform.position);
if(fishInstance == null)
{
break;
}
FishCatcher fishCatcher = fishInstance.GetComponentInParent<FishCatcher>();
if (fishCatcher != null && fishCatcher.fishCaught > 0)
{
if (fishCatcher.gameObject.layer == 9)
{
distance = Mathf.Infinity;
}
else
{
distance = Vector3.Distance(fishInstance.transform.position, transform.position) + 1f;
}
}
else
{
FishAi fishAi = fishInstance.GetComponent<FishAi>();
if (fishAi != null && fishAi.targetedBy != null) continue;
distance = Vector3.Distance(fishInstance.transform.position, transform.position);
}
if (distance < minimumDistance)
{
minimumDistance = distance;

View file

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExitWithEsc : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.Escape))
{
Debug.LogWarning("Application.Quit() is not available in the Unity Editor.");
Application.Quit();
}
}
}

11
Assets/Scripts/ExitWithEsc.cs.meta generated Normal file
View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c5fa8e61b016ab40a3e18ba5ecae525
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -5,6 +5,15 @@ using UnityEngine;
public class FishCatcher : MonoBehaviour {
public int fishCaught = 0;
public Sprite[] fishPileSprites;
public int[] fishPileStages;
private SpriteRenderer fishPileRenderer;
private void Start()
{
fishPileRenderer = GetComponent<SpriteRenderer>();
}
private void OnCollisionEnter2D(Collision2D collision)
{
@ -12,6 +21,31 @@ public class FishCatcher : MonoBehaviour {
{
fishCaught++;
Destroy(collision.gameObject);
CheckStages();
}
}
public void LoseFish()
{
fishCaught--;
CheckStages();
}
private void CheckStages()
{
int currentStage = 0;
while(true)
{
if (currentStage == fishPileStages.Length)
{
break;
}
if (fishCaught > fishPileStages[currentStage])
{
currentStage++;
}
else break;
}
fishPileRenderer.sprite = fishPileSprites[currentStage];
}
}

View file

@ -56,6 +56,10 @@ public class Harpoon : MonoBehaviour {
if (going)
{
going = false;
if(rb == null)
{
rb = GetComponent<Rigidbody2D>();
}
rb.bodyType = RigidbodyType2D.Kinematic;
}
if (collision.gameObject.tag == "Fish")

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
executionOrder: 100
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -19,7 +19,7 @@ public class Tide : MonoBehaviour
if (buoyancyEffector2D.surfaceLevel > 0)
{
buoyancyEffector2D.surfaceLevel = buoyancyEffector2D.surfaceLevel - (Time.deltaTime * speed);
seaTextures.transform.Translate(Vector3.down * Time.deltaTime * speed * 40);
}
seaTextures.transform.Translate(Vector3.down * Time.deltaTime * speed * 40);
}
}