Browse Source

at wonderville

shapes
Josh 1 year ago
parent
commit
0340087599
  1. 26
      namedropper/Assets/CardDataDrawer.cs
  2. 5
      namedropper/Assets/Prefabs/Category Prefab.prefab
  3. BIN
      namedropper/Assets/Resources/shapes/diamond.png
  4. BIN
      namedropper/Assets/Resources/shapes/wild.png
  5. 123
      namedropper/Assets/Resources/shapes/wild.png.meta
  6. 28
      namedropper/Assets/Scenes/Game.unity
  7. 15
      namedropper/Assets/Scripts/CardData.cs
  8. 18
      namedropper/Assets/Scripts/Category.cs
  9. 3
      namedropper/Assets/Scripts/GameOverScreen.cs
  10. 13
      namedropper/Assets/Scripts/Level.cs
  11. 8
      namedropper/Assets/Scripts/Player.cs

26
namedropper/Assets/CardDataDrawer.cs

@ -7,6 +7,8 @@ public class CardDataDrawer : MonoBehaviour
{
[SerializeField] GameObject[] _shapeSprites;
public CardData _cardData;
[SerializeField] bool _generateStars = false;
public int _numStarGenerators;
// Start is called before the first frame update
void Start()
@ -25,9 +27,31 @@ public class CardDataDrawer : MonoBehaviour
public void Redraw()
{
_numStarGenerators = 0;
foreach (Category category in GameObject.FindObjectsOfType<Category>())
{
if (category.IsStarGenerator() && category._color == GetComponent<Player>()?._team && _generateStars)
_numStarGenerators++;
}
for (int i = 0; i < _shapeSprites.Length; i++)
{
_shapeSprites[i].GetComponent<Image>().sprite = _cardData.GetSprite(i);
Sprite sprite;
if (i < _numStarGenerators)
{
string filename = "shapes/wild";
sprite = Resources.Load<Sprite>(filename);
_shapeSprites[i].GetComponent<Image>().color = Color.yellow;
}
else
{
_shapeSprites[i].GetComponent<Image>().color = Color.white;
sprite = _cardData.GetSprite(i);
}
_shapeSprites[i].GetComponent<Image>().sprite = sprite;
if (_cardData._shapes[i] == CardData.Shape.NONE)
_shapeSprites[i].SetActive(false);

5
namedropper/Assets/Prefabs/Category Prefab.prefab

@ -227,6 +227,7 @@ MonoBehaviour:
_feedbackBad: {fileID: 3551932467328341787}
_streak: {fileID: 1565607471538169626}
_shieldsText: {fileID: 3173673145629268070}
_color: 2
--- !u!61 &1085594869219034861
BoxCollider2D:
m_ObjectHideFlags: 0
@ -269,6 +270,8 @@ MonoBehaviour:
- {fileID: 4698135363407727744}
- {fileID: 1925658209779528050}
- {fileID: 7294958316878599169}
_generateStars: 0
_numStarGenerators: 0
--- !u!1 &1499098757547953155
GameObject:
m_ObjectHideFlags: 0
@ -449,7 +452,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1499098758628412651
Transform:
m_ObjectHideFlags: 0

BIN
namedropper/Assets/Resources/shapes/diamond.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
namedropper/Assets/Resources/shapes/wild.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

123
namedropper/Assets/Resources/shapes/wild.png.meta

@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: a9a84387ccd6bba4aa1bee072bcd3127
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:

28
namedropper/Assets/Scenes/Game.unity

@ -140,7 +140,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &23665175
RectTransform:
m_ObjectHideFlags: 0
@ -360,6 +360,10 @@ PrefabInstance:
propertyPath: m_fontColor32.rgba
value: 4294967295
objectReference: {fileID: 0}
- target: {fileID: 8866676399730726846, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _generateStars
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333299688696, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_Text
value: Josh
@ -1238,6 +1242,10 @@ PrefabInstance:
propertyPath: m_fontColor32.rgba
value: 4278190080
objectReference: {fileID: 0}
- target: {fileID: 8866676399730726846, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _generateStars
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _team
value: 0
@ -2086,7 +2094,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1499098758628412650, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3}
propertyPath: m_IsActive
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1499098758628412651, guid: f3f23d9506e39c54cbd07779c62329a3, type: 3}
propertyPath: m_LocalScale.x
@ -3184,9 +3192,11 @@ MonoBehaviour:
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: D&D Monsters
m_Text: 'match as many
sas psdsd'
--- !u!222 &1415156233
CanvasRenderer:
m_ObjectHideFlags: 0
@ -3231,7 +3241,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.026343895, g: 0.09431403, b: 0.1509434, a: 0}
m_BackGroundColor: {r: 0.103773594, g: 0.103773594, b: 0.103773594, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
@ -4653,6 +4663,10 @@ PrefabInstance:
propertyPath: m_fontColor32.rgba
value: 4294967295
objectReference: {fileID: 0}
- target: {fileID: 8866676399730726846, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _generateStars
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333299688696, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: m_Text
value: Josh
@ -5098,6 +5112,10 @@ PrefabInstance:
propertyPath: m_fontColor32.rgba
value: 4278190080
objectReference: {fileID: 0}
- target: {fileID: 8866676399730726846, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _generateStars
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9049015333349338377, guid: 56b5ab1b6ee02794ab9664e282d1930a, type: 3}
propertyPath: _team
value: 1

15
namedropper/Assets/Scripts/CardData.cs

@ -14,16 +14,16 @@ public class CardData
DIAMOND,
//HEART,
HOURGLASS,
//SPADE,
SPADE,
//SQUARE,
STAR,
//STAR,
TRIANGLE,
X
}
public Shape[] _shapes;
public int CompareMatches(CardData otherCardData)
public int CompareMatches(int numStars, CardData otherCardData)
{
int score = 0;
Shape[] tempOtherShapes = new Shape[otherCardData._shapes.Length];
@ -37,6 +37,12 @@ public class CardData
{
for (int j = 0; j < tempOtherShapes.Length; j++)
{
if (i < numStars)
{
score++;
break;
}
if (_shapes[i] == tempOtherShapes[j])
{
score++;
@ -51,6 +57,7 @@ public class CardData
public void Randomize(int count)
{
_shapes = new Shape[count];
var rnd = new System.Random(Guid.NewGuid().GetHashCode());
@ -62,6 +69,8 @@ public class CardData
}
while (_shapes[i] == Shape.NONE);
}
}
public Sprite GetSprite(int i)

18
namedropper/Assets/Scripts/Category.cs

@ -16,8 +16,9 @@ public class Category : MonoBehaviour
[SerializeField] GameObject _streak;
[SerializeField] TMPro.TMP_Text _shieldsText;
Player.Team _color = Player.Team.NEUTRAL;
public Player.Team _color = Player.Team.NEUTRAL;
int _shields = 0;
const int NUM_SHIELDS_FOR_GENERATOR = 4;
private void Awake()
{
@ -60,6 +61,11 @@ public class Category : MonoBehaviour
return 0;
}
public bool IsStarGenerator()
{
return _shields >= NUM_SHIELDS_FOR_GENERATOR;
}
public void AddScore(int score, Player.Team team)
{
if (score <= 0)
@ -86,6 +92,16 @@ public class Category : MonoBehaviour
_shieldsText.text += "O";
}
if (IsStarGenerator())
{
_shieldsText.text = "STAR ";
for (int i = 0; i < _shields - NUM_SHIELDS_FOR_GENERATOR; i++)
{
_shieldsText.text += "O";
}
}
Color newColor = Color.white;
if (_color == Player.Team.GREEN)
{

3
namedropper/Assets/Scripts/GameOverScreen.cs

@ -10,6 +10,9 @@ public class GameOverScreen : Level
void Start()
{
_gameOverMessage.text = "GAME OVER\n\nPress R\nto play again";
return;
if (GameManager.Instance.NumTeams == 1) {
int score = GameManager.Instance.Score1 + GameManager.Instance.Score2 + GameManager.Instance.Score3 + GameManager.Instance.Score4;

13
namedropper/Assets/Scripts/Level.cs

@ -56,12 +56,17 @@ public class Level : MonoBehaviour
IEnumerator StartupProcess()
{
ActivatePlayers(false);
Topic.color = Color.white;
RoundNumber.color = Color.blue;
if (Topic != null)
Topic.gameObject.SetActive(false);
yield return new WaitForSeconds(1f);
//if (Topic != null)
//Topic.gameObject.SetActive(true);
//yield return new WaitForSeconds(2f);
if (Topic != null)
Topic.gameObject.SetActive(true);
Topic.text = "Match as many shapes\nas you can!";
yield return new WaitForSeconds(2f);
if (RoundNumber != null)
RoundNumber.text = "";
if (Topic != null)
{
@ -111,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 == "Game"
SceneManager.GetActiveScene().name == "GameX"
)
{
player.SetActive(true);

8
namedropper/Assets/Scripts/Player.cs

@ -13,7 +13,7 @@ public class Player : MonoBehaviour
[SerializeField] KeyCode _keyRight;
[SerializeField] KeyCode _keyDown;
[SerializeField] KeyCode _keyDrop;
[SerializeField] Team _team;
public Team _team;
[SerializeField] TMPro.TextMeshProUGUI _text;
[SerializeField] List<TMPro.TMP_FontAsset> _longFonts = new List<TMPro.TMP_FontAsset>();
[SerializeField] List<TMPro.TMP_FontAsset> _shortFonts = new List<TMPro.TMP_FontAsset>();
@ -254,7 +254,7 @@ public class Player : MonoBehaviour
return;
}
CardData categoryCardData = collision.gameObject.GetComponent<CardDataDrawer>()._cardData;
CardData categoryCardData = collision.gameObject.GetComponent<CardDataDrawer>()?._cardData;
if (categoryCardData != null)
@ -262,7 +262,7 @@ public class Player : MonoBehaviour
int score = 0;
string message = "";
CardData myCardData = GetComponent<CardDataDrawer>()._cardData;
score = myCardData.CompareMatches(categoryCardData);
score = myCardData.CompareMatches(GetComponent<CardDataDrawer>()._numStarGenerators, categoryCardData);
collision.gameObject.GetComponent<CardDataDrawer>().Redraw();
/*
if (categoryCardData._shape == myCardData._shape) {
@ -288,7 +288,7 @@ public class Player : MonoBehaviour
category.AddScore(score, _team);
this.gameObject.SetActive(false);
Invoke("Respawn", 1f);
Invoke("Respawn", 1.5f);
}
/*

Loading…
Cancel
Save