mirror of
https://github.com/Steffo99/bleach-beach.git
synced 2024-12-04 19:04:19 +00:00
Merge branch 'master' of https://github.com/Steffo99/ld42
This commit is contained in:
commit
9e02aff81c
12 changed files with 179 additions and 72 deletions
2
Assets/Prefabs/Harpoon.prefab
generated
2
Assets/Prefabs/Harpoon.prefab
generated
|
@ -60,7 +60,7 @@ Rigidbody2D:
|
|||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_CollisionDetection: 1
|
||||
m_Constraints: 0
|
||||
--- !u!61 &61011723006022978
|
||||
BoxCollider2D:
|
||||
|
|
88
Assets/Prefabs/Lighthouse.prefab
generated
Normal file
88
Assets/Prefabs/Lighthouse.prefab
generated
Normal file
|
@ -0,0 +1,88 @@
|
|||
%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: 1422823575259108}
|
||||
m_IsPrefabAsset: 1
|
||||
--- !u!1 &1422823575259108
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4978811670595372}
|
||||
- component: {fileID: 212830947358221954}
|
||||
m_Layer: 0
|
||||
m_Name: Lighthouse
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4978811670595372
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1422823575259108}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -3.1, y: 44.5, z: 2.77}
|
||||
m_LocalScale: {x: 2.7887762, y: 2.7887762, z: 2.7887762}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &212830947358221954
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1422823575259108}
|
||||
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: -3
|
||||
m_Sprite: {fileID: 21300000, guid: aa55a5c6b0f009a428147c305780d1de, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 6.83, y: 10.42}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
8
Assets/Prefabs/Lighthouse.prefab.meta
generated
Normal file
8
Assets/Prefabs/Lighthouse.prefab.meta
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 633eed510cb97614896a65613c2eb772
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Prefabs/Ship.prefab
generated
8
Assets/Prefabs/Ship.prefab
generated
|
@ -101,7 +101,7 @@ Transform:
|
|||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1506768218425990}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 13.64, y: 40.63, z: 0}
|
||||
m_LocalPosition: {x: 4.27, y: 42.06, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 4419769467158982}
|
||||
|
@ -238,7 +238,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
hull: {fileID: 1396569450907664}
|
||||
horizontalShipSpeed: 5
|
||||
verticalShipSpeed: 24
|
||||
verticalShipSpeed: 30
|
||||
maxJetFuel: 2
|
||||
jetFuelRechargeSpeed: 0.1
|
||||
--- !u!114 &114971120113848216
|
||||
|
@ -252,7 +252,9 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 7bc860ed21bbef247869c07bd6fef82f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
rotationSpeed: 90
|
||||
harpoonAvailable: 1
|
||||
harpoon: {fileID: 1737609814504882, guid: 288f16ae5eaa16440b89da431723b1c2, type: 2}
|
||||
force: 1000
|
||||
--- !u!120 &120914689644947078
|
||||
LineRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
|
|
|
@ -3,17 +3,48 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
|
||||
public class Cannon : MonoBehaviour {
|
||||
|
||||
public bool harpoonAvailable = true;
|
||||
public GameObject harpoon;
|
||||
public float maxForce = 5f;
|
||||
public float forceBuildingSpeed = 2f;
|
||||
public float startingForce = 1f;
|
||||
private float force = 1f;
|
||||
|
||||
public float rotationSpeed;
|
||||
public GameObject chain;
|
||||
|
||||
void Update () {
|
||||
if(Input.GetKey(KeyCode.W))
|
||||
private Linker chainLinker;
|
||||
private SpriteRenderer spriteRenderer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
chainLinker = chain.GetComponent<Linker>();
|
||||
}
|
||||
|
||||
private void Update ()
|
||||
{
|
||||
Vector2 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
|
||||
Vector2 direction = (Vector2)Input.mousePosition - screenPosition;
|
||||
transform.rotation = Quaternion.LookRotation(Vector3.forward, direction);
|
||||
spriteRenderer.flipX = direction.x < 0;
|
||||
if (harpoonAvailable)
|
||||
{
|
||||
transform.Rotate(Vector3.forward * Time.deltaTime * rotationSpeed);
|
||||
}
|
||||
if (Input.GetKey(KeyCode.S))
|
||||
{
|
||||
transform.Rotate(Vector3.back * Time.deltaTime * rotationSpeed);
|
||||
if (Input.GetKey(KeyCode.Space))
|
||||
{
|
||||
force = Mathf.Clamp(force + forceBuildingSpeed * Time.deltaTime, 0, maxForce);
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.Space))
|
||||
{
|
||||
GameObject harpoonInstance = Instantiate(harpoon);
|
||||
harpoonInstance.transform.position = transform.position + (Vector3)direction.normalized;
|
||||
harpoonInstance.transform.rotation = transform.rotation;
|
||||
harpoonInstance.GetComponent<Rigidbody2D>().AddForce(direction * force);
|
||||
harpoonInstance.GetComponent<SpriteRenderer>().flipX = spriteRenderer.flipX;
|
||||
chainLinker.secondObject = harpoonInstance;
|
||||
force = startingForce;
|
||||
harpoonAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ChainLinker : MonoBehaviour {
|
||||
|
||||
public GameObject chain;
|
||||
public GameObject tail;
|
||||
public Vector3 chainOffset;
|
||||
public Vector3 tailOffset;
|
||||
public int chainNumber;
|
||||
|
||||
void Start () {
|
||||
GameObject lastChain = null;
|
||||
GameObject nextChain = null;
|
||||
|
||||
for(int i = 0; i < chainNumber - 1; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
lastChain = nextChain;
|
||||
}
|
||||
if (i == chainNumber - 2)
|
||||
{
|
||||
nextChain = Instantiate(tail, transform);
|
||||
nextChain.transform.position = lastChain.transform.position + tailOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextChain = Instantiate(chain, transform);
|
||||
if (lastChain != null)
|
||||
{
|
||||
nextChain.transform.position = lastChain.transform.position + chainOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextChain.transform.position = transform.position;
|
||||
}
|
||||
}
|
||||
if (lastChain != null)
|
||||
{
|
||||
nextChain.GetComponent<HingeJoint2D>().connectedBody = lastChain.GetComponent<Rigidbody2D>();
|
||||
}
|
||||
else
|
||||
{
|
||||
nextChain.GetComponent<HingeJoint2D>().connectedBody = GetComponentInParent<Rigidbody2D>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
Assets/Scripts/Harpoon.cs
Normal file
25
Assets/Scripts/Harpoon.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Harpoon : MonoBehaviour {
|
||||
|
||||
private Rigidbody2D rigidbody2D;
|
||||
private bool going = true;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
rigidbody2D = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void Update () {
|
||||
if(going)
|
||||
{
|
||||
transform.rotation = Quaternion.LookRotation(Vector3.forward, rigidbody2D.velocity.normalized);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 19e8f1cd3ef695e499687d78824c32e7
|
||||
guid: ccf0966283c66ef4e83d7d3c12e61e9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
|
@ -14,7 +14,10 @@ public class Linker : MonoBehaviour
|
|||
}
|
||||
|
||||
void Update () {
|
||||
lineRenderer.SetPosition(0, firstObject.transform.position);
|
||||
lineRenderer.SetPosition(1, secondObject.transform.position);
|
||||
if (firstObject != null && secondObject != null)
|
||||
{
|
||||
lineRenderer.SetPosition(0, firstObject.transform.position);
|
||||
lineRenderer.SetPosition(1, secondObject.transform.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
Assets/Sprites/Harpoon.png
(Stored with Git LFS)
BIN
Assets/Sprites/Harpoon.png
(Stored with Git LFS)
Binary file not shown.
2
Assets/Sprites/Harpoon.png.meta
generated
2
Assets/Sprites/Harpoon.png.meta
generated
|
@ -44,7 +44,7 @@ TextureImporter:
|
|||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 9
|
||||
spritePivot: {x: 0.94438404, y: 0.38834447}
|
||||
spritePivot: {x: 0.39075083, y: 0.08269283}
|
||||
spritePixelsToUnits: 50
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
|
|
8
Assets/Sprites/Terrain.png.meta
generated
8
Assets/Sprites/Terrain.png.meta
generated
|
@ -60,7 +60,7 @@ TextureImporter:
|
|||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
|
@ -71,7 +71,7 @@ TextureImporter:
|
|||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
|
@ -82,7 +82,7 @@ TextureImporter:
|
|||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
|
@ -93,7 +93,7 @@ TextureImporter:
|
|||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
maxTextureSize: 8192
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
|
|
Loading…
Reference in a new issue