103
Assets/DistanceIndicator.prefab
Normal file
103
Assets/DistanceIndicator.prefab
Normal file
@@ -0,0 +1,103 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1199330263328928228
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8597013110441107654}
|
||||
- component: {fileID: 3936296354587379724}
|
||||
- component: {fileID: 6619072570133332227}
|
||||
m_Layer: 0
|
||||
m_Name: DistanceIndicator
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8597013110441107654
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1199330263328928228}
|
||||
serializedVersion: 2
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &3936296354587379724
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1199330263328928228}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
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: -3951105813050061920, guid: 46817c0fa76c6a671b18883470b5daed, type: 3}
|
||||
m_Color: {r: 1, g: 1, 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!114 &6619072570133332227
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1199330263328928228}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 23dc3f32eba4c9e5aad24589fdbfa30c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
multiplier: 2.8
|
||||
7
Assets/DistanceIndicator.prefab.meta
Normal file
7
Assets/DistanceIndicator.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca2da40bbabe0b0e9b9a1265c11abe06
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -114,6 +114,7 @@ MonoBehaviour:
|
||||
dashCooldownSeconds: 5
|
||||
lastAttackTime: 0
|
||||
lastDashTime: 0
|
||||
distanceIndicator: {fileID: 0}
|
||||
--- !u!50 &-4152331571693237436
|
||||
Rigidbody2D:
|
||||
serializedVersion: 5
|
||||
|
||||
@@ -319,6 +319,14 @@ PrefabInstance:
|
||||
propertyPath: dashDistance
|
||||
value: 1000
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
|
||||
propertyPath: swingDistance
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
|
||||
propertyPath: distanceIndicator
|
||||
value:
|
||||
objectReference: {fileID: 1199330263328928228, guid: ca2da40bbabe0b0e9b9a1265c11abe06, type: 3}
|
||||
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
|
||||
propertyPath: attackCooldownSeconds
|
||||
value: 3
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ShopButton : MonoBehaviour
|
||||
player.swingRange += 1;
|
||||
}
|
||||
else if (upgrade == "attackDistance") {
|
||||
player.swingDistance += 30;
|
||||
player.swingDistance += 0.5F;
|
||||
}
|
||||
else if (upgrade == "attackDamage") {
|
||||
player.damageStrength += 5;
|
||||
|
||||
@@ -14,6 +14,7 @@ public class Teo : MonoBehaviour
|
||||
public float dashCooldownSeconds = 5;
|
||||
public float lastAttackTime = 0;
|
||||
public float lastDashTime = 0;
|
||||
public GameObject distanceIndicator;
|
||||
Rigidbody2D controller;
|
||||
GameState gameState;
|
||||
bool dashing;
|
||||
@@ -45,14 +46,16 @@ public class Teo : MonoBehaviour
|
||||
if (Time.fixedTime-lastAttackTime < attackCooldownSeconds) {
|
||||
return;
|
||||
}
|
||||
Instantiate(distanceIndicator, transform);
|
||||
// Get all objects in range in the direction of cursor
|
||||
RaycastHit2D[] hits = Physics2D.CircleCastAll(
|
||||
transform.position,
|
||||
swingRange,
|
||||
new Vector2(
|
||||
Screen.width/2 - Input.mousePosition.x,
|
||||
Screen.height/2 - Input.mousePosition.y
|
||||
)
|
||||
Input.mousePosition.x - Screen.width/2,
|
||||
Input.mousePosition.y - Screen.height/2
|
||||
).normalized,
|
||||
swingDistance
|
||||
);
|
||||
// Damage all ratbots in scanned area
|
||||
foreach (RaycastHit2D hit in hits) {
|
||||
|
||||
26
Assets/UI overlay/DistanceIndicator.cs
Normal file
26
Assets/UI overlay/DistanceIndicator.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class DistanceIndicator : MonoBehaviour
|
||||
{
|
||||
public float multiplier;
|
||||
Teo player;
|
||||
SpriteRenderer sprite;
|
||||
float timeCreated;
|
||||
void Start() {
|
||||
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Teo>();
|
||||
sprite = GetComponent<SpriteRenderer>();
|
||||
timeCreated = Time.fixedTime;
|
||||
transform.localScale = new Vector3 (player.swingDistance*multiplier, player.swingDistance*multiplier, 1);
|
||||
StartCoroutine("KillMyself");
|
||||
}
|
||||
|
||||
void Update() {
|
||||
sprite.color = new Color (1F, 1F, 1F, 0.5F-(Time.fixedTime-timeCreated));
|
||||
}
|
||||
|
||||
IEnumerator KillMyself() {
|
||||
yield return new WaitForSeconds (0.5F);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
2
Assets/UI overlay/DistanceIndicator.cs.meta
Normal file
2
Assets/UI overlay/DistanceIndicator.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23dc3f32eba4c9e5aad24589fdbfa30c
|
||||
BIN
Assets/rangeIndicator.png
Normal file
BIN
Assets/rangeIndicator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 47 KiB |
142
Assets/rangeIndicator.png.meta
Normal file
142
Assets/rangeIndicator.png.meta
Normal file
@@ -0,0 +1,142 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46817c0fa76c6a671b18883470b5daed
|
||||
TextureImporter:
|
||||
internalIDToNameTable:
|
||||
- first:
|
||||
213: -3951105813050061920
|
||||
second: rangeIndicator_0
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 2
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: rangeIndicator_0
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1024
|
||||
height: 1024
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: -1
|
||||
bones: []
|
||||
spriteID: 0ab8b27623ada29c0800000000000000
|
||||
internalID: -3951105813050061920
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user