Browse Source

finish line and victory

master
Josh 2 years ago
parent
commit
4d5f3aab26
  1. 20
      unity/Assets/Game.cs
  2. 447
      unity/Assets/Scenes/SampleScene.unity
  3. 21
      unity/Assets/Scripts/DragonMovement.cs
  4. BIN
      unity/Assets/Sprites/Finish-Line-PNG-HD.png
  5. 109
      unity/Assets/Sprites/Finish-Line-PNG-HD.png.meta
  6. 2
      unity/ProjectSettings/Physics2DSettings.asset
  7. 1
      unity/ProjectSettings/TagManager.asset

20
unity/Assets/Game.cs

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
public class Game : MonoBehaviour public class Game : MonoBehaviour
@ -10,9 +11,15 @@ public class Game : MonoBehaviour
const int NUM_CLOUDS = 6; const int NUM_CLOUDS = 6;
const float START_X = 1300; const float START_X = 1300;
[SerializeField] Text _victoryMessage;
[SerializeField] Text _restartMessage;
bool _victory = false;
void Start() void Start()
{ {
_victoryMessage.enabled = false;
_restartMessage.enabled = false;
for (int i = 0; i < NUM_CLOUDS; ++i) for (int i = 0; i < NUM_CLOUDS; ++i)
{ {
GameObject cloud = GameObject.Instantiate(_cloudPrefab); GameObject cloud = GameObject.Instantiate(_cloudPrefab);
@ -20,6 +27,19 @@ public class Game : MonoBehaviour
} }
} }
public void Victory(string dragonName, Color color)
{
if (_victory)
return;
_victory = true;
_restartMessage.enabled = true;
_victoryMessage.enabled = true;
_victoryMessage.text = dragonName.ToUpper() + " WINS!";
_victoryMessage.color = color;
}
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {

447
unity/Assets/Scenes/SampleScene.unity

@ -354,6 +354,8 @@ MonoBehaviour:
_fireballSpawnPoint: {fileID: 1850103814} _fireballSpawnPoint: {fileID: 1850103814}
_coneSpawnPoint: {fileID: 0} _coneSpawnPoint: {fileID: 0}
_flash: {fileID: 1001794173} _flash: {fileID: 1001794173}
_dragonName: Scarlet Dragon
_color: {r: 1, g: 0, b: 0, a: 1}
_attackType: 0 _attackType: 0
--- !u!114 &480143059 --- !u!114 &480143059
MonoBehaviour: MonoBehaviour:
@ -588,6 +590,8 @@ MonoBehaviour:
_fireballSpawnPoint: {fileID: 702048807} _fireballSpawnPoint: {fileID: 702048807}
_coneSpawnPoint: {fileID: 1094877703} _coneSpawnPoint: {fileID: 1094877703}
_flash: {fileID: 1754293195} _flash: {fileID: 1754293195}
_dragonName: Chartreuse Dragon
_color: {r: 0.21719734, g: 0.754717, b: 0, a: 1}
_attackType: 1 _attackType: 1
--- !u!95 &629347648 --- !u!95 &629347648
Animator: Animator:
@ -737,6 +741,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_cloudPrefab: {fileID: 8093627333698608799, guid: 222963b5f45b20141bf7dd413f3342cd, type: 3} _cloudPrefab: {fileID: 8093627333698608799, guid: 222963b5f45b20141bf7dd413f3342cd, type: 3}
_victoryMessage: {fileID: 1794958515}
_restartMessage: {fileID: 1744497687}
--- !u!4 &822168905 --- !u!4 &822168905
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -747,7 +753,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 852.68475, y: 429.9049, z: -52.78695} m_LocalPosition: {x: 852.68475, y: 429.9049, z: -52.78695}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children:
- {fileID: 1627385223}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -781,6 +788,72 @@ Transform:
m_Father: {fileID: 1208042752} m_Father: {fileID: 1208042752}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &871781049
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 871781052}
- component: {fileID: 871781051}
- component: {fileID: 871781050}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &871781050
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 871781049}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &871781051
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 871781049}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &871781052
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 871781049}
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: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1001794173 --- !u!1 &1001794173
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -984,6 +1057,8 @@ MonoBehaviour:
_fireballSpawnPoint: {fileID: 833231468} _fireballSpawnPoint: {fileID: 833231468}
_coneSpawnPoint: {fileID: 0} _coneSpawnPoint: {fileID: 0}
_flash: {fileID: 2065535042} _flash: {fileID: 2065535042}
_dragonName: Indigo Dragon
_color: {r: 0, g: 0.0880208, b: 1, a: 1}
_attackType: 0 _attackType: 0
--- !u!95 &1208042750 --- !u!95 &1208042750
Animator: Animator:
@ -1072,6 +1147,115 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1369941868
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1369941870}
- component: {fileID: 1369941869}
- component: {fileID: 1369941871}
m_Layer: 0
m_Name: FinishLine
m_TagString: FinishLine
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1369941869
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369941868}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
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_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: 21300000, guid: ad77fe3881b5f80418208f753957b663, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 2.47, y: 20}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1369941870
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369941868}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 1873.6, y: 539.4, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1369941871
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1369941868}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 130, y: 1052.6316}
newSize: {x: 2.47, y: 20}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 130, y: 1076}
m_EdgeRadius: 0
--- !u!1 &1588360791 --- !u!1 &1588360791
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1163,6 +1347,8 @@ MonoBehaviour:
_fireballSpawnPoint: {fileID: 1779421298} _fireballSpawnPoint: {fileID: 1779421298}
_coneSpawnPoint: {fileID: 577405911} _coneSpawnPoint: {fileID: 577405911}
_flash: {fileID: 78464504} _flash: {fileID: 78464504}
_dragonName: Butterscotch Dragon
_color: {r: 1, g: 0.6401813, b: 0, a: 1}
_attackType: 1 _attackType: 1
--- !u!95 &1588360796 --- !u!95 &1588360796
Animator: Animator:
@ -1252,6 +1438,186 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1627385222
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1627385223}
- component: {fileID: 1627385226}
- component: {fileID: 1627385225}
- component: {fileID: 1627385224}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1627385223
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1627385222}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 1794958514}
- {fileID: 1744497686}
m_Father: {fileID: 822168905}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1627385224
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1627385222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1627385225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1627385222}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1627385226
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1627385222}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &1744497685
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1744497686}
- component: {fileID: 1744497688}
- component: {fileID: 1744497687}
m_Layer: 5
m_Name: restart
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1744497686
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1744497685}
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: 1627385223}
m_RootOrder: 1
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: -82.37}
m_SizeDelta: {x: 1920, y: 1080}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1744497687
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1744497685}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 27
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 300
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: press R to restart
--- !u!222 &1744497688
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1744497685}
m_CullTransparentMesh: 1
--- !u!1 &1754293195 --- !u!1 &1754293195
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1364,6 +1730,85 @@ Transform:
m_Father: {fileID: 1588360798} m_Father: {fileID: 1588360798}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1794958513
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1794958514}
- component: {fileID: 1794958516}
- component: {fileID: 1794958515}
m_Layer: 5
m_Name: Victory
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1794958514
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794958513}
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: 1627385223}
m_RootOrder: 0
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: 80.94}
m_SizeDelta: {x: 1920, y: 1080}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1794958515
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794958513}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 44
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 300
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: BLUE WINS!
--- !u!222 &1794958516
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794958513}
m_CullTransparentMesh: 1
--- !u!1 &1850103814 --- !u!1 &1850103814
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

21
unity/Assets/Scripts/DragonMovement.cs

@ -15,9 +15,14 @@ public class DragonMovement : MonoBehaviour
[SerializeField] GameObject _fireballSpawnPoint; [SerializeField] GameObject _fireballSpawnPoint;
[SerializeField] GameObject _coneSpawnPoint; [SerializeField] GameObject _coneSpawnPoint;
[SerializeField] GameObject _flash; [SerializeField] GameObject _flash;
[SerializeField] string _dragonName;
[SerializeField] Color _color;
float _stunTime = 0f; float _stunTime = 0f;
float _debugCurSpeed; float _debugCurSpeed;
bool _victory = false;
public enum AttackType public enum AttackType
{ {
FIREBALL, FIREBALL,
@ -38,9 +43,15 @@ public class DragonMovement : MonoBehaviour
CheckCloudCollision(collision); CheckCloudCollision(collision);
if (collision.CompareTag("FinishLine"))
{
Game game = FindObjectOfType<Game>();
game.Victory(_dragonName, _color);
}
if (collision.CompareTag("Lightning")) if (collision.CompareTag("Lightning"))
{ {
Stun(.2f); Stun(.4f);
} }
if (collision.CompareTag("Fireball")) if (collision.CompareTag("Fireball"))
@ -53,7 +64,7 @@ public class DragonMovement : MonoBehaviour
} }
else else
{ {
Stun(.2f); Stun(.6f);
} }
} }
} }
@ -95,6 +106,12 @@ public class DragonMovement : MonoBehaviour
Flap(); Flap();
Shoot(); Shoot();
} }
if (_victory)
{
float scale = 8f * Time.deltaTime;
transform.localScale = transform.localScale + new Vector3(scale, scale, 0f);
}
} }
void Flap() void Flap()

BIN
unity/Assets/Sprites/Finish-Line-PNG-HD.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

109
unity/Assets/Sprites/Finish-Line-PNG-HD.png.meta

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: ad77fe3881b5f80418208f753957b663
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 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: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 1.9
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
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

2
unity/ProjectSettings/Physics2DSettings.asset

@ -4,7 +4,7 @@
Physics2DSettings: Physics2DSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 5 serializedVersion: 5
m_Gravity: {x: 0, y: -432.82} m_Gravity: {x: 0, y: -332.82}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 0}
m_VelocityIterations: 8 m_VelocityIterations: 8
m_PositionIterations: 3 m_PositionIterations: 3

1
unity/ProjectSettings/TagManager.asset

@ -7,6 +7,7 @@ TagManager:
- Fireball - Fireball
- Lightning - Lightning
- Cloud - Cloud
- FinishLine
layers: layers:
- Default - Default
- TransparentFX - TransparentFX

Loading…
Cancel
Save