score? Scoregit push --set-upstream origin score-n-shit

This commit is contained in:
Dom Harris 2021-01-10 17:15:58 +00:00
parent 01607da25e
commit 99e949cd9b
11 changed files with 133 additions and 8 deletions

View File

@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 233269787904781725}
- component: {fileID: 2766037370157449026}
- component: {fileID: 2122656558574222561}
- component: {fileID: -3971665732303992234}
m_Layer: 7
m_Name: Enemy
m_TagString: Untagged
@ -109,7 +110,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d77551efeb20a4bdabb517c8351695ff, type: 3}
m_Name:
m_EditorClassIdentifier:
maxHealth: 1
maxHealth: 4
--- !u!114 &2122656558574222561
MonoBehaviour:
m_ObjectHideFlags: 0
@ -122,3 +123,16 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5b2c8b098025f4e2f997759b5c00fef7, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &-3971665732303992234
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1738226812227614583}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1c18e41c4d38f4467bda24e543fec25f, type: 3}
m_Name:
m_EditorClassIdentifier:
value: 1000

View File

@ -234,7 +234,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 186457103}
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalPosition: {x: 0, y: -2, z: 100}
m_LocalPosition: {x: 0, y: -2, z: 200}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -1016,6 +1016,7 @@ GameObject:
- component: {fileID: 1330494724}
- component: {fileID: 1330494723}
- component: {fileID: 1330494726}
- component: {fileID: 1330494725}
m_Layer: 5
m_Name: Score
m_TagString: Untagged
@ -1062,7 +1063,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 1,234,567,898,765,432
m_text: 0
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 0f0f54895994248b0bf34c4b4d27beef, type: 2}
m_sharedMaterial: {fileID: -3347474280721358513, guid: 0f0f54895994248b0bf34c4b4d27beef, type: 2}
@ -1139,6 +1140,18 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1330494721}
m_CullTransparentMesh: 1
--- !u!114 &1330494725
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1330494721}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3da04f2795dd4afe8551debe01be4561, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1330494726
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1153,6 +1166,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
timeSince: {fileID: 11400000, guid: 8f05f93192443bc42b8523048bde0dc4, type: 2}
scale: 0.25
ySquish: -0.15
characterSpacing: 10
--- !u!1 &1395215960
GameObject:
m_ObjectHideFlags: 0
@ -1406,6 +1421,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: bpm
value: 90
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:

View File

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Weapons.Scripts;
public class AddScoreOnDie : MonoBehaviour
{
[SerializeField] private ulong value = 100;
private EntityHealth _health;
private void Awake()
{
_health = GetComponent<EntityHealth>();
}
private void OnEnable()
{
_health.Die += Die;
}
private void OnDisable()
{
_health.Die -= Die;
}
private void Die()
{
Score.Value += value + (ulong)Random.Range(-5, 5);
}
}

View File

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

View File

@ -7,6 +7,7 @@ public class DisableOnDeath : MonoBehaviour
{
private EntityHealth _health;
private Renderer _renderer;
private Collider _collider;
private Color _color1;
private Color _color2;
@ -21,6 +22,7 @@ public class DisableOnDeath : MonoBehaviour
{
_health = GetComponent<EntityHealth>();
_renderer = GetComponentInChildren<Renderer>();
_collider = GetComponentInChildren<Collider>();
_color1 = _renderer.material.GetColor(Color1);
_color2 = _renderer.material.GetColor(Color2);
@ -29,7 +31,7 @@ public class DisableOnDeath : MonoBehaviour
private void OnEnable()
{
_health.Die += Die;
_collider.enabled = true;
_renderer.material.SetColor(Color1, _color1);
_renderer.material.SetColor(Color2, _color2);
}
@ -43,7 +45,7 @@ public class DisableOnDeath : MonoBehaviour
{
var oldName = gameObject.name;
gameObject.name = "disabled";
_collider.enabled = false;
float x = 0;
DOTween.To(
() => x,

17
Assets/Scripts/Score.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
public static class Score
{
private static ulong _value;
public static ulong Value
{
get => _value;
set
{
_value = value;
ScoreUpdated?.Invoke(_value);
}
}
public static event Action<ulong> ScoreUpdated;
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 22e5c22e25d5491e9a6fdabcd5788ebf
timeCreated: 1610298027

View File

@ -0,0 +1,27 @@
using TMPro;
using UnityEngine;
public class UpdateScore : MonoBehaviour
{
private TextMeshProUGUI _text;
private void Awake()
{
_text = GetComponent<TextMeshProUGUI>();
}
private void OnEnable()
{
Score.ScoreUpdated += OnScoreUpdated;
}
private void OnDisable()
{
Score.ScoreUpdated -= OnScoreUpdated;
}
private void OnScoreUpdated(ulong obj)
{
_text.text = $"{obj:n0}";
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3da04f2795dd4afe8551debe01be4561
timeCreated: 1610298154

View File

@ -116,7 +116,7 @@ MonoBehaviour:
surfaceOnly: 1
evenDistribution: 0
numSides: 3
numPerSide: 5
numPerSide: 10
flipVertical: 0
radius: 5
arc: 360

View File

@ -106,12 +106,12 @@ MonoBehaviour:
m_Bits: 128
accuracy: 2
zone:
numToSpawn: 2
numToSpawn: 4
offset: {x: 0, y: 0, z: 0}
spawnType: 1
spawnDir: 0
spawnPlane: 1
width: 1.5
width: 0.75
height: 0
surfaceOnly: 1
evenDistribution: 1