Browse Source

variation where you have to pick up resources first

shapesWithPickups
Josh 1 year ago
parent
commit
4541d80a62
  1. 20
      namedropper/Assets/CardDataDrawer.cs
  2. 1
      namedropper/Assets/Prefabs/Category Prefab.prefab
  3. 8
      namedropper/Assets/Prefabs/Player Prefab.prefab
  4. 208
      namedropper/Assets/Prefabs/ShapePickupPrefab.prefab
  5. 7
      namedropper/Assets/Prefabs/ShapePickupPrefab.prefab.meta
  6. 14
      namedropper/Assets/Scenes/Game.unity
  7. 14
      namedropper/Assets/Scripts/CardData.cs
  8. 6
      namedropper/Assets/Scripts/Category.cs
  9. 22
      namedropper/Assets/Scripts/Game.cs
  10. 1
      namedropper/Assets/Scripts/GameManager.cs
  11. 2
      namedropper/Assets/Scripts/Level.cs
  12. 14
      namedropper/Assets/Scripts/Player.cs
  13. 10
      namedropper/Assets/Scripts/Wraparound.cs
  14. 18
      namedropper/Assets/ShapePickup.cs
  15. 11
      namedropper/Assets/ShapePickup.cs.meta

20
namedropper/Assets/CardDataDrawer.cs

@ -9,13 +9,33 @@ public class CardDataDrawer : MonoBehaviour
public CardData _cardData;
[SerializeField] bool _generateStars = false;
public int _numStarGenerators;
[SerializeField] bool _randomizeAtStart = false;
// Start is called before the first frame update
void Start()
{
if (_randomizeAtStart)
Randomize();
else
InitEmpty();
}
public void InitEmpty()
{
_cardData = new CardData();
_cardData._shapes = new CardData.Shape[4];
for (int i = 0; i < _cardData._shapes.Length; i++) {
_cardData._shapes[i] = CardData.Shape.NONE;
}
Redraw();
}
public void AddShape(CardData.Shape shape)
{
_cardData.AddShape(shape);
Redraw();
}
public void Randomize()
{
_cardData = new CardData();

1
namedropper/Assets/Prefabs/Category Prefab.prefab

@ -272,6 +272,7 @@ MonoBehaviour:
- {fileID: 7294958316878599169}
_generateStars: 0
_numStarGenerators: 0
_randomizeAtStart: 1
--- !u!1 &1499098757547953155
GameObject:
m_ObjectHideFlags: 0

8
namedropper/Assets/Prefabs/Player Prefab.prefab

@ -17,7 +17,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &482762097022507376
RectTransform:
m_ObjectHideFlags: 0
@ -627,7 +627,7 @@ RectTransform:
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: -6.4, y: 29.900024}
m_AnchoredPosition: {x: 29.9, y: 29.900024}
m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7158204951566801307
@ -902,3 +902,7 @@ MonoBehaviour:
- {fileID: 8283750470600269748}
- {fileID: 9032701300591666026}
- {fileID: 1933936841026696079}
- {fileID: 482245573507682842}
_generateStars: 0
_numStarGenerators: 0
_randomizeAtStart: 0

208
namedropper/Assets/Prefabs/ShapePickupPrefab.prefab

@ -0,0 +1,208 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5771291237398470923
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5771291237398470962}
- component: {fileID: 5771291237398470960}
- component: {fileID: 5771291237398470961}
- component: {fileID: 5771291237398470924}
- component: {fileID: 5771291237398470963}
- component: {fileID: 2063177072779361088}
- component: {fileID: 6011139098167670469}
m_Layer: 6
m_Name: ShapePickupPrefab
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5771291237398470962
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
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:
- {fileID: 4660071920460499956}
m_Father: {fileID: 0}
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: -688, y: 375}
m_SizeDelta: {x: 157, y: 164}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!58 &5771291237398470960
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
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}
serializedVersion: 2
m_Radius: 22
--- !u!222 &5771291237398470961
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
m_CullTransparentMesh: 1
--- !u!50 &5771291237398470924
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 0.5
m_LinearDrag: 4.05
m_AngularDrag: 0.05
m_GravityScale: 20
m_Material: {fileID: 0}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!114 &5771291237398470963
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 37dfc580ad57d894caaababe502afb5b, type: 3}
m_Name:
m_EditorClassIdentifier:
_useWorldSpace: 0
--- !u!114 &2063177072779361088
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b48c5dafd05dc7840baa2bf4b27956de, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6011139098167670469
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5771291237398470923}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ecbd2bb57a5bb334797ba646e21cceaa, type: 3}
m_Name:
m_EditorClassIdentifier:
_shapeSprites:
- {fileID: 5825873085182898028}
_generateStars: 0
_numStarGenerators: 0
_randomizeAtStart: 1
--- !u!1 &5825873085182898028
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4660071920460499956}
- component: {fileID: 5314735369495698418}
- component: {fileID: 1183686844869259322}
m_Layer: 0
m_Name: ShapeBottomLeft
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4660071920460499956
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5825873085182898028}
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: 5771291237398470962}
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: 0}
m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5314735369495698418
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5825873085182898028}
m_CullTransparentMesh: 1
--- !u!114 &1183686844869259322
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5825873085182898028}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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_Sprite: {fileID: 21300000, guid: 0dd1fab3f4264c54c9669b0270cb29e3, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

7
namedropper/Assets/Prefabs/ShapePickupPrefab.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 01a391ee37d75bf4ebff52cec3205edf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
namedropper/Assets/Scenes/Game.unity

@ -1425,7 +1425,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &903959529
Transform:
m_ObjectHideFlags: 0
@ -1589,7 +1589,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &974885549
Transform:
m_ObjectHideFlags: 0
@ -2422,7 +2422,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1200810652
Transform:
m_ObjectHideFlags: 0
@ -3656,7 +3656,7 @@ MonoBehaviour:
CategoriesRound2: {fileID: 1146299634}
CategoriesRound3: {fileID: 1391939818}
_canvas: {fileID: 1666960091}
_powerupPrefab: {fileID: 2355887706657292512, guid: fe820c2aff8b39b4e9017b4b0e042dae, type: 3}
_powerupPrefab: {fileID: 5771291237398470923, guid: 01a391ee37d75bf4ebff52cec3205edf, type: 3}
--- !u!4 &1641253473
Transform:
m_ObjectHideFlags: 0
@ -3988,7 +3988,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1729924321
Transform:
m_ObjectHideFlags: 0
@ -4468,7 +4468,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1959472267
Transform:
m_ObjectHideFlags: 0
@ -4552,7 +4552,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1973273086
Transform:
m_ObjectHideFlags: 0

14
namedropper/Assets/Scripts/CardData.cs

@ -43,7 +43,7 @@ public class CardData
break;
}
if (_shapes[i] == tempOtherShapes[j])
if (_shapes[i] == tempOtherShapes[j] && _shapes[i] != Shape.NONE)
{
score++;
tempOtherShapes[j] = Shape.NONE;
@ -55,6 +55,18 @@ public class CardData
return score;
}
public void AddShape(Shape shape)
{
for (int i=0; i < _shapes.Length; ++i)
{
if (_shapes[i] == Shape.NONE)
{
_shapes[i] = shape;
return;
}
}
}
public void Randomize(int count)
{

6
namedropper/Assets/Scripts/Category.cs

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;
@ -89,7 +89,7 @@ public class Category : MonoBehaviour
for (int i=0; i < _shields; i++)
{
_shieldsText.text += "O";
_shieldsText.text += "⬤";
}
if (IsStarGenerator())
@ -98,7 +98,7 @@ public class Category : MonoBehaviour
for (int i = 0; i < _shields - NUM_SHIELDS_FOR_GENERATOR; i++)
{
_shieldsText.text += "O";
_shieldsText.text += "";
}
}

22
namedropper/Assets/Scripts/Game.cs

@ -33,6 +33,7 @@ public class Game : Level
// Start is called before the first frame update
void Awake()
{
SpawnPowerup();
GameManager.TurnOnGravity();
base.Awake();
@ -57,6 +58,7 @@ public class Game : Level
GameDataManager.Instance.CurrentTopic = GameDataManager.Instance.GetRandomTopicData();
}
/*
foreach (Category category in _categories)
{
CategoryData categoryData = GameDataManager.Instance.GetRandomCategoryData(GameDataManager.Instance.CurrentTopic);
@ -65,6 +67,7 @@ public class Game : Level
category.Elements = categoryData.Elements;
category.ResetElements();
}
*/
if (GameManager.Instance.NumTeams == 1)
@ -111,23 +114,20 @@ public class Game : Level
}
float _maxTime = 1.0f;
const float MINTIME = .5f;
void SpawnPowerup()
{
/*
if (GameManager.Instance.Round >= 2)
{
print("spawning powerup");
GameObject powerup = Instantiate(_powerupPrefab);
powerup.transform.parent = _canvas.gameObject.transform;
powerup.transform.position = new Vector3(Random.Range(100f, 1080f-100f), Random.Range(225f, 820f), powerup.transform.position.z);
powerup.transform.position = new Vector3(Random.Range(0f, 1920f), Random.Range(0f, 1080f), powerup.transform.position.z);
_maxTime -= 0.01f;
if (_maxTime < MINTIME)
_maxTime = MINTIME;
if (GameManager.Instance.Round == 3)
Invoke("SpawnPowerup", Random.Range(7f, 16f));
else
Invoke("SpawnPowerup", Random.Range(10f, 20f));
}
*/
Invoke("SpawnPowerup", Random.Range(MINTIME, _maxTime));
}
void StartGame()

1
namedropper/Assets/Scripts/GameManager.cs

@ -50,6 +50,7 @@ public class GameManager
Reset();
}
void Reset()
{
Score1 = 0;

2
namedropper/Assets/Scripts/Level.cs

@ -116,7 +116,7 @@ public class Level : MonoBehaviour
if (GameManager.Instance.PlayerJoined[player.GetComponent<Player>()._playerNumber] == true ||
SceneManager.GetActiveScene().name == "Title" ||
SceneManager.GetActiveScene().name == "Ontology" ||
SceneManager.GetActiveScene().name == "GameX"
SceneManager.GetActiveScene().name == "Game"
)
{
player.SetActive(true);

14
namedropper/Assets/Scripts/Player.cs

@ -220,11 +220,21 @@ public class Player : MonoBehaviour
_dropping = false;
_rigidbody.velocity = Vector3.zero;
PickNewWord();
GetComponent<CardDataDrawer>().Randomize();
GetComponent<CardDataDrawer>().InitEmpty();
}
private void OnTriggerEnter2D(Collider2D collision)
{
// shape pickup
ShapePickup shapePickup = collision.gameObject.GetComponent<ShapePickup>();
if (shapePickup != null)
{
GetComponent<CardDataDrawer>().AddShape(shapePickup.GetComponent<CardDataDrawer>()._cardData._shapes[0]);
GameObject.Destroy(shapePickup.gameObject);
GameObject.Destroy(shapePickup);
return;
}
//join
JoinGameBox joinGameBox = collision.gameObject.GetComponent<JoinGameBox>();
if (joinGameBox != null)
@ -402,6 +412,8 @@ public class Player : MonoBehaviour
}
//RACE GAME
//midpoint
if (collision.gameObject.CompareTag("Midpoint"))

10
namedropper/Assets/Scripts/Wraparound.cs

@ -48,17 +48,17 @@ public class Wraparound : MonoBehaviour
}
//game scene
if (GameManager.Instance.Round == 3)
if (true)
{
if (this.transform.localPosition.x < -782)
if (this.transform.localPosition.x < -960)
{
this.transform.localPosition = new Vector3(782, transform.localPosition.y, transform.localPosition.z);
this.transform.localPosition = new Vector3(960, transform.localPosition.y, transform.localPosition.z);
}
if (this.transform.localPosition.x > 782)
if (this.transform.localPosition.x > 960)
{
this.transform.localPosition = new Vector3(-782, transform.localPosition.y, transform.localPosition.z);
this.transform.localPosition = new Vector3(-960, transform.localPosition.y, transform.localPosition.z);
}
}
else if (GameManager.Instance.Round == 2)

18
namedropper/Assets/ShapePickup.cs

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShapePickup : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
namedropper/Assets/ShapePickup.cs.meta

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