Browse Source

added redlight greenlight and tuned that and gold miner with Nik

master
Josh 1 year ago
parent
commit
8925227abb
  1. 21
      namedropper/Assets/GoldMiner.cs
  2. 12
      namedropper/Assets/GoldMinerTarget.cs
  3. 114
      namedropper/Assets/Scenes/GoldMiner.unity
  4. 5874
      namedropper/Assets/Scenes/RedLight.unity
  5. 7
      namedropper/Assets/Scenes/RedLight.unity.meta
  6. 54
      namedropper/Assets/Scripts/Player.cs
  7. 74
      namedropper/Assets/Scripts/RedLightGreenLight.cs
  8. 11
      namedropper/Assets/Scripts/RedLightGreenLight.cs.meta
  9. 3
      namedropper/Assets/Scripts/ScoreStack.cs
  10. 5
      namedropper/Assets/Scripts/TrackballInputManager.cs
  11. 28
      namedropper/Assets/Spinner.cs
  12. BIN
      namedropper/Assets/Sprites/finishline.jpg
  13. 123
      namedropper/Assets/Sprites/finishline.jpg.meta
  14. 3
      namedropper/ProjectSettings/EditorBuildSettings.asset
  15. 1
      namedropper/ProjectSettings/TagManager.asset

21
namedropper/Assets/GoldMiner.cs

@ -10,12 +10,25 @@ public class GoldMiner : Level
// Start is called before the first frame update
void Start()
{
for (int i = 0; i < 35; ++i)
for (int i = 0; i < 100; ++i)
{
GameObject target = Instantiate(_goldMinerTargetPrefab);
target.transform.parent = _canvas.gameObject.transform;
target.transform.localPosition = new Vector3(Random.Range(-928, 928), Random.Range(-256f, 490f), target.transform.position.z);
SpawnGold();
}
//Invoke("SpawnMoreGold", 3f);
}
void SpawnMoreGold()
{
SpawnGold();
Invoke("SpawnMoreGold", 2f);
}
private void SpawnGold()
{
GameObject target = Instantiate(_goldMinerTargetPrefab);
target.transform.parent = _canvas.gameObject.transform;
target.transform.localPosition = new Vector3(Random.Range(-928, 928), Random.Range(-256f, 490f), target.transform.position.z);
}
// Update is called once per frame

12
namedropper/Assets/GoldMinerTarget.cs

@ -7,18 +7,24 @@ public class GoldMinerTarget : MonoBehaviour
{
[SerializeField] TMPro.TMP_Text _text;
public int _value;
public const float MIN_SCALE = .3f;
public const float MIN_SCALE = .2f;
// Start is called before the first frame update
void Start()
{
_value = Random.Range(-1, 4);
_value = Random.Range(-1, 8);
_value /= 2;
if (_value < 0)
_value = 0;
_text.text = _value.ToString();
float scale = Random.Range(MIN_SCALE, 1.25f);
float actualMinScale = MIN_SCALE;
if (_value <= 0)
actualMinScale = MIN_SCALE * 2;
float scale = Random.Range(actualMinScale, .75f);
transform.localScale = new Vector3(scale, scale, transform.localScale.z);
}

114
namedropper/Assets/Scenes/GoldMiner.unity

@ -3366,63 +3366,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1466997550
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalPosition.x
value: 1822
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalPosition.y
value: 28
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817953, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2286698427935817959, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
propertyPath: m_Name
value: ScoreStackRed
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7c1022cdecec0fd43a849e560913a9b0, type: 3}
--- !u!1001 &1546442639
PrefabInstance:
m_ObjectHideFlags: 0
@ -4100,63 +4043,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &1687385366
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalPosition.x
value: 108
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalPosition.y
value: 28
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818291, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2980751867113818293, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
propertyPath: m_Name
value: ScoreStackGreen
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 790b53bfae3a1424bb8a7aca77f1a2da, type: 3}
--- !u!1 &1729924320
GameObject:
m_ObjectHideFlags: 0

5874
namedropper/Assets/Scenes/RedLight.unity

File diff suppressed because it is too large

7
namedropper/Assets/Scenes/RedLight.unity.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c47ffd3450f93bd488df38f9f870218d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

54
namedropper/Assets/Scripts/Player.cs

@ -47,6 +47,7 @@ public class Player : MonoBehaviour
public bool _goldMinerReturning = false;
GameObject _carrying = null;
float _carriedWeight = 1f;
public float _lastVelocityMagnitudeAdded = 0f;
public float StunTime{
get
{
@ -64,6 +65,7 @@ public class Player : MonoBehaviour
private bool _touchedMidpoint;
private RaceGame _raceGame;
private GoldMiner _goldMinerGame;
private RedLightGreenLight _redlightGreenlightGame;
private void Awake()
{
@ -84,6 +86,9 @@ public class Player : MonoBehaviour
_game = FindObjectOfType<Game>();
_raceGame = FindObjectOfType<RaceGame>();
_goldMinerGame = FindObjectOfType<GoldMiner>();
_redlightGreenlightGame = FindObjectOfType<RedLightGreenLight>();
if (_redlightGreenlightGame != null)
_curSpeed *= 5f;
_originalPosition = transform.position;
@ -165,7 +170,8 @@ public class Player : MonoBehaviour
public void SetName(string name)
{
_text.text = name;
if (_text!= null)
_text.text = name;
}
public void BecomeInvisible()
@ -218,10 +224,15 @@ public class Player : MonoBehaviour
}
}
public void ResetToOriginalPosition()
{
transform.position = _originalPosition;
}
void Respawn()
{
this.gameObject.SetActive(true);
transform.position = _originalPosition;
ResetToOriginalPosition();
_dropping = false;
_rigidbody.velocity = Vector3.zero;
PickNewWord();
@ -358,7 +369,7 @@ public class Player : MonoBehaviour
// gold miner target
GoldMinerTarget goldMinerTarget = collision.gameObject.GetComponent<GoldMinerTarget>();
if (goldMinerTarget != null && _goldMinerLaunched)
if (goldMinerTarget != null && _goldMinerLaunched && _carrying == null)
{
this._rigidbody.velocity = Vector3.zero;
goldMinerTarget.transform.parent = this.transform;
@ -385,6 +396,21 @@ public class Player : MonoBehaviour
_touchedMidpoint = true;
}
//redlight greenlight finish line
if (collision.gameObject.CompareTag("RedlightGreenlightFinishLine"))
{
Debug.Log("scored!");
int score = 10;
if (GameManager.Instance.Round == 3)
score *= 2;
_redlightGreenlightGame.AddScore(score, _playerNumber);
_laps++;
_text.text = _laps + " point";
if (_laps > 1)
_text.text += "s";
ResetToOriginalPosition();
}
//finish line
if (collision.gameObject.CompareTag("FinishLine"))
{
@ -454,14 +480,21 @@ public class Player : MonoBehaviour
{
SceneManager.LoadScene("TopicSelect");
}
float _goldMinerInputTimeout = 0f;
public void AddVelocity(Vector2 velocity)
{
_lastVelocityMagnitudeAdded = velocity.magnitude;
if (_goldMiner)
{
if (_goldMinerLaunched == false && velocity.y > 0f)
//SetName(velocity.y.ToString());
if ((_goldMinerLaunched == false || _goldMinerInputTimeout > 0) && _carrying == false && velocity.y > 10.02f )
{
_rigidbody.velocity += velocity * 5000f;
_rigidbody.velocity += velocity * 1000f * Time.deltaTime;
if (_goldMinerLaunched == false)
_goldMinerInputTimeout = .2f;
_goldMinerLaunched = true;
}
}
@ -477,6 +510,7 @@ public class Player : MonoBehaviour
// Update is called once per frame
void Update()
{
_goldMinerInputTimeout -= Time.deltaTime;
_stunTime -= Time.deltaTime;
if (Game.Paused)
{
@ -486,19 +520,19 @@ public class Player : MonoBehaviour
if (_goldMinerLaunched && _goldMinerReturning == false)
{
if (this._rigidbody.velocity.magnitude <= 0f)
if (this._rigidbody.velocity.magnitude <= 10f)
{
_goldMinerReturning = true;
_carriedWeight = 1f;
}
}
const float RETURN_SPEED = 500f;
const float RETURN_SPEED = 125f;
if (_goldMinerReturning)
{
transform.position = Vector3.MoveTowards(transform.position, _originalPosition, RETURN_SPEED * Time.deltaTime * _carriedWeight);
transform.position = Vector3.MoveTowards(transform.position, _originalPosition, RETURN_SPEED * Time.deltaTime * _carriedWeight* _carriedWeight * 171f);
if ((transform.position - _originalPosition).magnitude <= .1f)
if ((transform.position - _originalPosition).magnitude <= .2f)
{
_goldMinerLaunched = false;
_goldMinerReturning = false;

74
namedropper/Assets/Scripts/RedLightGreenLight.cs

@ -0,0 +1,74 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RedLightGreenLight : Level
{
[SerializeField] SpriteRenderer _background;
[SerializeField] UnityEngine.UI.Text _redLightGreenLightText;
enum StopLight
{
GREEN,
YELLOW,
RED
}
StopLight _stopLight;
// Start is called before the first frame update
void Start()
{
_stopLight = StopLight.YELLOW;
ToggleColor();
}
// Update is called once per frame
void Update()
{
foreach (GameObject player in _players)
{
//player.GetComponent<Player>().SetName(Mathf.Round(player.GetComponent<Player>()._lastVelocityMagnitudeAdded).ToString());
if (_stopLight == StopLight.RED)
{
if (player.GetComponent<Player>()._lastVelocityMagnitudeAdded > 10.0f)
{
player.GetComponent<Player>().ResetToOriginalPosition();
_redLightGreenLightText.text = "RED LIGHT\nBUSTED!";
//player.GetComponent<Player>().SetName(player.GetComponent<Rigidbody2D>().velocity.magnitude.ToString());
}
}
}
}
void ToggleColor()
{
if (_stopLight == StopLight.GREEN)
_stopLight = StopLight.YELLOW;
else if (_stopLight == StopLight.YELLOW)
_stopLight = StopLight.RED;
else if (_stopLight == StopLight.RED)
_stopLight = StopLight.GREEN;
float length;
if (_stopLight == StopLight.RED)
{
_redLightGreenLightText.text = "RED LIGHT";
_background.color = Color.red;
length = Random.Range(0.5f, 5f);
}
else if (_stopLight == StopLight.GREEN)
{
_redLightGreenLightText.text = "GREEN LIGHT";
_background.color = Color.green;
length = Random.Range(0.5f, 3f);
}
else // (_stopLight == StopLight.YELLOW)
{
_redLightGreenLightText.text = "";
_background.color = Color.yellow;
length = Random.Range(0.5f, 1f);
}
Invoke("ToggleColor", length);
}
}

11
namedropper/Assets/Scripts/RedLightGreenLight.cs.meta

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

3
namedropper/Assets/Scripts/ScoreStack.cs

@ -28,6 +28,9 @@ public class ScoreStack : MonoBehaviour
public void AddChecker(int amount, bool dark)
{
if (amount <= 0)
return;
GameObject checker = new GameObject("checker");
checker.transform.parent = this.transform;
checker.transform.localScale = new Vector3(2.5f, 2.5f, 1f);

5
namedropper/Assets/Scripts/TrackballInputManager.cs

@ -108,6 +108,11 @@ public class TrackballInputManager : MonoBehaviour
_ignoredDevices.Add(65628);
_ignoredDevices.Add(131158);
_ignoredDevices.Add(0);
_ignoredDevices.Add(10033557);
_ignoredDevices.Add(42076147);
_ignoredDevices.Add(1512667);
_ignoredDevices.Add(104598561);
_ignoredDevices.Add(296553843);

28
namedropper/Assets/Spinner.cs

@ -27,17 +27,19 @@ public class Spinner : MonoBehaviour
{
InitAudioSources();
_gameList.Add("Popstar Pursuit");
_gameList.Add("Bumper Budz 500");
_gameList.Add("Ontology: The Game");
_gameList.Add("TV Party");
_gameList.Add("Gold Digger");
_gameList.Add("Netflix & Skill");
_gameList.Add("Pixel Prodigies");
_gameList.Add("Let's Get Tipsy");
_gameList.Add("Record Scratch");
_gameList.Add("49er");
_gameList.Add("Crazy Kart");
_gameList.Add("Redlight Greenlight"); //r
//_gameList.Add("Popstar Pursuit"); //n
_gameList.Add("Bumper Budz 500"); //z
_gameList.Add("Ontology: The Game"); //o
_gameList.Add("TV Party"); //n
_gameList.Add("Gold Digger"); //g
_gameList.Add("Squid Game"); //r
_gameList.Add("Netflix & Skill"); //n
_gameList.Add("Pixel Prodigies"); //n
_gameList.Add("Let's Get Tipsy"); //n
_gameList.Add("Record Scratch"); //n
_gameList.Add("49er"); //g
_gameList.Add("Crazy Kart"); //z
//Spin();
}
@ -242,6 +244,10 @@ public class Spinner : MonoBehaviour
{
sceneName = "Ontology";
}
else if (gameName.Contains("Redlight") || gameName.Contains("Squid Game"))
{
sceneName = "RedLight";
}
else
{
Debug.LogError("unknown game name: " + gameName);

BIN
namedropper/Assets/Sprites/finishline.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

123
namedropper/Assets/Sprites/finishline.jpg.meta

@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: bbc37636b347510438c5d26ddd145167
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
ignoreMasterTextureLimit: 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: 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
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
- serializedVersion: 3
buildTarget: Server
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: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

3
namedropper/ProjectSettings/EditorBuildSettings.asset

@ -44,6 +44,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/RaceGame.unity
guid: 4b27426029785474c988419c9328a8ba
- enabled: 1
path: Assets/Scenes/RedLight.unity
guid: c47ffd3450f93bd488df38f9f870218d
- enabled: 1
path: Assets/Scenes/LevelSelectScene.unity
guid: 7477ac64c25d07743a1fe5ca97591ca0

1
namedropper/ProjectSettings/TagManager.asset

@ -6,6 +6,7 @@ TagManager:
tags:
- FinishLine
- Midpoint
- RedlightGreenlightFinishLine
layers:
- Default
- TransparentFX

Loading…
Cancel
Save