Commit 25e41e96 authored by Yousef Sameh's avatar Yousef Sameh

working game

parent 02ee33b5
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
fileFormatVersion: 2
guid: 54062de4e8c3d69e0905f25467cc08d7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9147284515358783809
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8111532012562978872}
- component: {fileID: 8282903751184369725}
- component: {fileID: 5291095652839668027}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8111532012562978872
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9147284515358783809}
serializedVersion: 2
m_LocalRotation: {x: 0.1617297, y: -0.8373186, z: 0.39044812, w: 0.34683046}
m_LocalPosition: {x: 19, y: 10, z: 15.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 50, y: -135, z: 0}
--- !u!108 &8282903751184369725
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9147284515358783809}
m_Enabled: 1
serializedVersion: 12
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize2D: {x: 0.5, y: 0.5}
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ForceVisible: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
m_LightUnit: 1
m_LuxAtDistance: 1
m_EnableSpotReflector: 1
--- !u!114 &5291095652839668027
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9147284515358783809}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.UniversalAdditionalLightData
m_UsePipelineSettings: 1
m_AdditionalLightsShadowResolutionTier: 2
m_CustomShadowLayers: 0
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
m_SoftShadowQuality: 0
m_RenderingLayersMask:
serializedVersion: 0
m_Bits: 1
m_ShadowRenderingLayersMask:
serializedVersion: 0
m_Bits: 1
m_Version: 4
m_LightLayerMask: 1
m_ShadowLayerMask: 1
m_RenderingLayers: 1
m_ShadowRenderingLayers: 1
fileFormatVersion: 2
guid: 07be7cce7f323a6e0857a0041610e75a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bcb536de0fc95435c8aa05ec7057d856
guid: bab83bbe539b62de5bfd9847af0c21df
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
......
This diff is collapsed.
fileFormatVersion: 2
guid: 0da29fb7b44797c9d8fa7d1c3a9e8532
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-611070109137573787
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.DepthOfField
active: 1
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 106.4
gaussianEnd:
m_OverrideState: 1
m_Value: 114.67
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 0.5
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 20
aperture:
m_OverrideState: 1
m_Value: 31.4
focalLength:
m_OverrideState: 1
m_Value: 241
bladeCount:
m_OverrideState: 1
m_Value: 4
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: CSVolume
m_EditorClassIdentifier: Unity.RenderPipelines.Core.Runtime::UnityEngine.Rendering.VolumeProfile
components:
- {fileID: -611070109137573787}
fileFormatVersion: 2
guid: 38487a2abc17859078d5e237685101f0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
This source diff could not be displayed because it is too large. You can view the blob instead.
fileFormatVersion: 2
guid: 159272ade9986c75fa5453d36844597e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba1d671b8df1409294a2e77970855f56, type: 3}
m_Name: UniTextAppearance_NoUnderlay
m_EditorClassIdentifier: LightSide.UniText::UniTextAppearance
defaultMaterials:
items:
- {fileID: 2100000, guid: 8075bb0621b2ef033b8afd222b6b385e, type: 2}
fontMaterials:
items:
- font: {fileID: 11400000, guid: 9f194bcdf6b582b4c8731cdfe455216c, type: 2}
materials:
items:
- {fileID: 2100000, guid: c787515284273dd4fb79cd7c0d20619b, type: 2}
fileFormatVersion: 2
guid: 3a559cf5d653f05ea807e1be5655df92
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UniTextMaterial_NoUnderlay
m_Shader: {fileID: 4800000, guid: c71b2c08fa554665a48dece0279d5360, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 824087930418221426, guid: 1ec898e0cfcf3b2438ab0b77f44b7bc2, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _ColorMask: 15
- _CullMode: 0
- _FaceDilate: 0
- _GradientScale: 10
- _MaskSoftnessX: 0
- _MaskSoftnessY: 0
- _OutlineDilate: 1
- _OutlineSoftness: 0
- _OutlineWidth: 0.09
- _PerspectiveFilter: 0.875
- _ScaleRatioA: 1
- _ScaleRatioB: 1
- _ScaleRatioC: 1
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
- _Sharpness: 0
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _TextureHeight: 1024
- _TextureWidth: 1024
- _UnderlayDilate: 1
- _UnderlayOffsetX: 0
- _UnderlayOffsetY: -0.18
- _UnderlaySoftness: 0
- _VertexOffsetX: 0
- _VertexOffsetY: 0
- _WeightBold: 1
- _WeightNormal: 0
m_Colors:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
fileFormatVersion: 2
guid: 8075bb0621b2ef033b8afd222b6b385e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -24,6 +24,11 @@ namespace com.al_arcade.cs
[SerializeField] private float feedbackDuration = 1.5f;
[SerializeField] private float wordClickCooldown = 0.3f;
[Header("Arc Settings")]
[SerializeField] private float arcRadius = 8f;
[SerializeField] private float arcSpanDegrees = 120f;
[SerializeField] private float wordGap = 0.1f;
[Header("References")]
public CsBotController bot;
public CsUIManager uiManager;
......@@ -279,9 +284,7 @@ namespace com.al_arcade.cs
int wordCount = question.words.Length;
float padding = 0.6f;
float gapBetween = 0.25f;
float padding = 0.1f;
float charWidth = 0.32f;
float[] wordWidths = new float[wordCount];
......@@ -293,50 +296,71 @@ namespace com.al_arcade.cs
wordWidths[i] = w;
totalWidth += w;
}
totalWidth += (wordCount - 1) * gapBetween;
float maxAllowedWidth = 14f;
float scaleFactor = 1f;
if (totalWidth > maxAllowedWidth)
{
scaleFactor = maxAllowedWidth / totalWidth;
totalWidth = maxAllowedWidth;
for (int i = 0; i < wordCount; i++)
wordWidths[i] *= scaleFactor;
}
// Arc centre = camera position
Camera cam = Camera.main;
Vector3 arcCenter = cam != null ? cam.transform.position + Vector3.up * 0.5f : Vector3.zero;
// Total arc-length consumed by words + gaps between them
float totalArcLength = 0f;
for (int i = 0; i < wordCount; i++)
totalArcLength += wordWidths[i];
totalArcLength += (wordCount - 1) * wordGap;
Vector3 basePos = bot != null
? bot.transform.position + Vector3.up * 3.5f
: Vector3.up * 4f;
// Convert arc-length to angle: arcLength = radius * angleInRadians
float totalAngleRad = totalArcLength / arcRadius;
float totalAngleDeg = totalAngleRad * Mathf.Rad2Deg;
// Clamp to the configured arc span
float usedSpanDeg = Mathf.Min(totalAngleDeg, arcSpanDegrees);
float spanScale = usedSpanDeg / totalAngleDeg;
float startX = totalWidth / 2f;
float currentX = startX;
// Start from the right edge, centered on 90° (straight ahead in XZ)
float startAngleDeg = 90f - usedSpanDeg * 0.5f;
// Running arc-length cursor (from the start edge)
float cursorArcLength = 0f;
for (int i = 0; i < wordCount; i++)
{
var word = question.words[i];
float halfW = wordWidths[i] / 2f;
float posX = currentX - halfW;
// Center of this word along the arc
float wordCenterArc = cursorArcLength + wordWidths[i] * 0.5f;
// Scale arc-length to fit within the allowed span
float arcFraction = totalArcLength > 0 ? wordCenterArc / totalArcLength : 0.5f;
float angleDeg = startAngleDeg + arcFraction * usedSpanDeg;
float angleRad = angleDeg * Mathf.Deg2Rad;
Vector3 pos = arcCenter + new Vector3(
Mathf.Cos(angleRad) * arcRadius,
0f,
Mathf.Sin(angleRad) * arcRadius
);
var word = question.words[i];
var wordObj = new GameObject($"Word_{i}_{word.word_text}");
if (wordContainer != null)
wordObj.transform.SetParent(wordContainer);
wordObj.transform.position = basePos + Vector3.right * posX;
wordObj.transform.position = pos;
var wb = wordObj.AddComponent<CsWordButton>();
wb.Setup(word.word_text, word.is_wrong, i, wordWidths[i], scaleFactor);
_wordButtons.Add(wb);
wordObj.transform.localScale = Vector3.zero;
wordObj.transform.DOScale(Vector3.one, 0.4f)
.SetDelay(i * 0.08f)
.SetEase(Ease.OutBack);
currentX -= wordWidths[i] + gapBetween;
cursorArcLength += wordWidths[i] + wordGap;
}
}
......
......@@ -8,6 +8,7 @@ using TMPro;
namespace com.al_arcade.cs
{
using shared;
using UnityEngine.Rendering.Universal;
[AddComponentMenu("Science Street/CS Prefab Builder")]
public class CsPrefabBuilder : MonoBehaviour
......@@ -39,6 +40,8 @@ namespace com.al_arcade.cs
"If null, a procedural bot is created.")]
[SerializeField] private GameObject botPrefab;
[SerializeField] private Vector3 botSpawnPosition = Vector3.zero;
[SerializeField] private Quaternion botSpawnRotation = Quaternion.identity;
[Header("Word Card (optional)")]
......@@ -140,7 +143,7 @@ namespace com.al_arcade.cs
if (botPrefab != null)
{
var botObj = Instantiate(botPrefab, botSpawnPosition, Quaternion.identity);
var botObj = Instantiate(botPrefab, botSpawnPosition, botSpawnRotation);
botObj.name = "Bot";
_bot = botObj.GetComponent<CsBotController>();
if (_bot == null)
......@@ -217,6 +220,12 @@ namespace com.al_arcade.cs
cam.clearFlags = CameraClearFlags.SolidColor;
cam.backgroundColor = cameraBgColor;
cam.transform.position = cameraPosition;
var cameraData = cam.GetUniversalAdditionalCameraData();
cameraData.renderPostProcessing = true;
cameraData.antialiasing = AntialiasingMode.SubpixelMorphologicalAntiAliasing;
cameraData.antialiasingQuality = AntialiasingQuality.High;
cam.transform.rotation = Quaternion.Euler(cameraRotation);
cam.fieldOfView = cameraFOV;
cam.nearClipPlane = 0.1f;
......@@ -241,24 +250,24 @@ namespace com.al_arcade.cs
{
var audio = SSAudioManager.EnsureInstance();
if (sfxCorrect != null) audio.sfxCorrect = sfxCorrect;
if (sfxWrong != null) audio.sfxWrong = sfxWrong;
if (sfxClick != null) audio.sfxClick = sfxClick;
if (sfxWrong != null) audio.sfxWrong = sfxWrong;
if (sfxClick != null) audio.sfxClick = sfxClick;
if (sfxVictory != null) audio.sfxVictory = sfxVictory;
if (sfxDefeat != null) audio.sfxDefeat = sfxDefeat;
if (sfxWhoosh != null) audio.sfxWhoosh = sfxWhoosh;
if (sfxPop != null) audio.sfxPop = sfxPop;
if (sfxSlam != null) audio.sfxSlam = sfxSlam;
if (sfxCheer != null) audio.sfxCheer = sfxCheer;
if (sfxDefeat != null) audio.sfxDefeat = sfxDefeat;
if (sfxWhoosh != null) audio.sfxWhoosh = sfxWhoosh;
if (sfxPop != null) audio.sfxPop = sfxPop;
if (sfxSlam != null) audio.sfxSlam = sfxSlam;
if (sfxCheer != null) audio.sfxCheer = sfxCheer;
}
private void SetupParticleManager()
{
var particles = SSParticleManager.EnsureInstance();
if (correctBurstParticle != null) particles.correctBurstPrefab = correctBurstParticle;
if (wrongBurstParticle != null) particles.wrongBurstPrefab = wrongBurstParticle;
if (confettiParticle != null) particles.confettiPrefab = confettiParticle;
if (sparksParticle != null) particles.sparksPrefab = sparksParticle;
if (starBurstParticle != null) particles.starBurstPrefab = starBurstParticle;
if (wrongBurstParticle != null) particles.wrongBurstPrefab = wrongBurstParticle;
if (confettiParticle != null) particles.confettiPrefab = confettiParticle;
if (sparksParticle != null) particles.sparksPrefab = sparksParticle;
if (starBurstParticle != null) particles.starBurstPrefab = starBurstParticle;
}
private void OnRestartClicked()
......
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using ALArcade.ArabicTMP;
namespace com.al_arcade.cs
{
using LightSide;
using shared;
[RequireComponent(typeof(BoxCollider))]
......@@ -13,9 +15,10 @@ namespace com.al_arcade.cs
public bool IsWrong { get; private set; }
public int Index { get; private set; }
private ArabicTextMeshPro _text;
private GameObject _background;
private Material _bgMaterial;
private Canvas _canvas;
private UniText _uniText; // Assuming the class name is UniText in UniText namespace
private BoxCollider _collider;
private bool _isHighlighted;
private Sequence _idleAnim;
......@@ -44,10 +47,9 @@ namespace com.al_arcade.cs
private void BuildVisuals()
{
var shader = Shader.Find("Universal Render Pipeline/Lit")
var shader = Shader.Find("ScienceStreet/SciFiTextBackground")
?? Shader.Find("Standard") ?? Shader.Find("Unlit/Color");
_background = GameObject.CreatePrimitive(PrimitiveType.Cube);
_background.name = "WordBg";
_background.transform.SetParent(transform);
......@@ -56,42 +58,55 @@ namespace com.al_arcade.cs
Destroy(_background.GetComponent<Collider>());
_bgMaterial = new Material(shader) { color = SSColorPalette.NeutralWord };
_bgMaterial.SetFloat("_State", 0f);
_background.GetComponent<Renderer>().material = _bgMaterial;
_background.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
var canvasObj = new GameObject("WordCanvas");
canvasObj.transform.SetParent(transform);
canvasObj.transform.localPosition = new Vector3(0, 0, -0.05f);
canvasObj.transform.localRotation = Quaternion.identity;
_canvas = canvasObj.AddComponent<Canvas>();
_canvas.renderMode = RenderMode.WorldSpace;
canvasObj.AddComponent<GraphicRaycaster>();
var textObj = new GameObject("WordText");
textObj.transform.SetParent(transform);
textObj.transform.localPosition = new Vector3(0, 0, -0.05f);
var rt = canvasObj.GetComponent<RectTransform>();
float canvasScale = 0.02f;
rt.localScale = new Vector3(canvasScale, canvasScale, canvasScale);
rt.sizeDelta = new Vector2(_cardWidth / canvasScale, _cardHeight / canvasScale);
var textObj = new GameObject("UniText");
textObj.transform.SetParent(canvasObj.transform);
textObj.transform.localPosition = Vector3.zero;
textObj.transform.localRotation = Quaternion.identity;
textObj.transform.localScale = Vector3.one;
var textRt = textObj.AddComponent<RectTransform>();
textRt.anchorMin = Vector2.zero;
textRt.anchorMax = Vector2.one;
textRt.sizeDelta = Vector2.zero;
_text = textObj.AddComponent<ArabicTextMeshPro>();
_text.arabicText = WordText;
_text.fontSize = 4.5f;
_text.alignment = TMPro.TextAlignmentOptions.Center;
_text.color = SSColorPalette.TextDark;
_text.fontStyle = TMPro.FontStyles.Bold;
_text.enableAutoSizing = true;
_text.fontSizeMin = 2f;
_text.fontSizeMax = 5f;
_text.rectTransform.sizeDelta = new Vector2(_cardWidth - 0.2f, _cardHeight - 0.1f);
_text.enableWordWrapping = false;
_text.overflowMode = TMPro.TextOverflowModes.Ellipsis;
SSFontManager.Apply(_text);
_uniText = textObj.AddComponent<UniText>();
_uniText.Text = WordText;
_uniText.HorizontalAlignment = HorizontalAlignment.Center;
_uniText.VerticalAlignment = VerticalAlignment.Middle;
_uniText.FontSize = 20;
// _uniText.AutoSize = true;
_collider = GetComponent<BoxCollider>();
_collider.size = new Vector3(_cardWidth, _cardHeight, 0.2f);
var shadow = GameObject.CreatePrimitive(PrimitiveType.Cube);
shadow.name = "Shadow";
shadow.transform.SetParent(transform);
shadow.transform.localPosition = new Vector3(0.04f, -0.04f, 0.02f);
shadow.transform.localScale = new Vector3(_cardWidth, _cardHeight, 0.06f);
Destroy(shadow.GetComponent<Collider>());
shadow.GetComponent<Renderer>().material =
new Material(shader) { color = new Color(0, 0, 0, 0.12f) };
// var shadow = GameObject.CreatePrimitive(PrimitiveType.Cube);
// shadow.name = "Shadow";
// shadow.transform.SetParent(transform);
// shadow.transform.localPosition = new Vector3(0.04f, -0.04f, 0.02f);
// shadow.transform.localScale = new Vector3(_cardWidth, _cardHeight, 0.06f);
// Destroy(shadow.GetComponent<Collider>());
// shadow.GetComponent<Renderer>().material =
// new Material(shader) { color = new Color(0, 0, 0, 0.12f) };
}
private void StartIdleAnimation()
......@@ -135,6 +150,7 @@ namespace com.al_arcade.cs
DOTween.Kill(_bgMaterial, "hover");
_bgMaterial.DOColor(SSColorPalette.WithAlpha(SSColorPalette.Primary, 0.3f), 0.2f)
.SetId("hover");
_bgMaterial.SetFloat("_State", 1f); // highlighted on hover
DOTween.Kill(transform, "hoverScale");
transform.DOScale(Vector3.one * 1.1f, 0.2f).SetEase(Ease.OutQuad)
.SetId("hoverScale");
......@@ -145,6 +161,7 @@ namespace com.al_arcade.cs
if (_isHighlighted) return;
DOTween.Kill(_bgMaterial, "hover");
_bgMaterial.DOColor(SSColorPalette.NeutralWord, 0.2f).SetId("hover");
_bgMaterial.SetFloat("_State", 0f); // back to neutral
DOTween.Kill(transform, "hoverScale");
transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.OutQuad).SetId("hoverScale");
}
......@@ -165,8 +182,11 @@ namespace com.al_arcade.cs
? SSColorPalette.WrongWord
: SSColorPalette.CorrectWord;
// Set shader state: 1 = highlighted (waiting for drop)
_bgMaterial.SetFloat("_State", 1f);
_bgMaterial.DOColor(targetColor, 0.3f);
if (_text != null) _text.color = Color.white;
// if (_text != null) _text.color = Color.white;
transform.DOPunchScale(Vector3.one * 0.2f, 0.4f, 8, 0.3f);
......@@ -182,11 +202,18 @@ namespace com.al_arcade.cs
transform.DOShakePosition(0.3f, 0.15f, 15, 90, false, true).SetId("shakeWrong");
transform.DOShakeRotation(0.3f, 5f, 15);
// Flash shader to wrong state, then back to neutral
_bgMaterial.SetFloat("_State", 3f);
Color orig = _bgMaterial.color;
DOTween.Kill(_bgMaterial, "shakeColor");
_bgMaterial.DOColor(SSColorPalette.WithAlpha(SSColorPalette.Danger, 0.3f), 0.1f)
.SetId("shakeColor")
.OnComplete(() => _bgMaterial.DOColor(orig, 0.3f));
.OnComplete(() =>
{
_bgMaterial.DOColor(orig, 0.3f);
_bgMaterial.SetFloat("_State", 0f); // back to neutral
});
}
public void ReplaceText(string newText)
......@@ -196,11 +223,11 @@ namespace com.al_arcade.cs
seq.Append(transform.DOScale(Vector3.one * 0.5f, 0.2f).SetEase(Ease.InBack));
seq.AppendCallback(() =>
{
if (_text != null) _text.arabicText = newText;
if (_uniText != null) _uniText.Text = newText;
WordText = newText;
DOTween.Kill(_bgMaterial);
_bgMaterial.color = SSColorPalette.CorrectWord;
if (_text != null) _text.color = Color.white;
_bgMaterial.SetFloat("_State", 2f); // correct state
});
seq.Append(transform.DOScale(Vector3.one * 1.2f, 0.3f).SetEase(Ease.OutBack));
seq.Append(transform.DOScale(Vector3.one, 0.15f));
......
using UnityEngine;
public class FutureCar : MonoBehaviour
{
[Header("Main Settings")]
[Tooltip("Check to float in place, uncheck to move back and forth.")]
public bool isFloatingInPlace = true;
[Header("Floating Options (Only used if checked above)")]
public float floatSpeed = 1f;
public float floatAmplitude = 0.5f;
[Header("Moving Options (Only used if unchecked above)")]
public float moveSpeed = 5f;
public float travelDistance = 20f;
public float rotationSpeed = 3f;
private Vector3 startPosition;
private Vector3 targetPosition;
private bool movingToTarget = true;
private float initialY;
void Start()
{
// Store the starting spot
startPosition = transform.position;
initialY = transform.position.y;
// Calculate the end of the patrol path based on the car's initial forward direction
targetPosition = startPosition + (transform.forward * travelDistance);
}
void Update()
{
if (isFloatingInPlace)
{
ApplyFloatingMotion();
}
else
{
ApplyPatrolMotion();
}
}
private void ApplyFloatingMotion()
{
// Simple vertical bobbing using a Sine wave
float newY = initialY + (Mathf.Sin(Time.time * floatSpeed) * floatAmplitude);
transform.position = new Vector3(transform.position.x, newY, transform.position.z);
}
private void ApplyPatrolMotion()
{
// Determine which end of the line we are headed to
Vector3 destination = movingToTarget ? targetPosition : startPosition;
// 1. Move the car
transform.position = Vector3.MoveTowards(transform.position, destination, moveSpeed * Time.deltaTime);
// 2. Rotate the car to face the current destination
Vector3 direction = (destination - transform.position).normalized;
if (direction != Vector3.zero)
{
Quaternion lookRotation = Quaternion.LookRotation(direction);
transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * rotationSpeed);
}
// 3. If we are very close to the destination, flip the boolean to go the other way
if (Vector3.Distance(transform.position, destination) < 0.1f)
{
movingToTarget = !movingToTarget;
}
}
// This helps you see the path in the Scene View without pressing play
private void OnDrawGizmosSelected()
{
if (!isFloatingInPlace)
{
Gizmos.color = Color.cyan;
Vector3 endPoint = Application.isPlaying ? targetPosition : transform.position + (transform.forward * travelDistance);
Vector3 startPoint = Application.isPlaying ? startPosition : transform.position;
Gizmos.DrawLine(startPoint, endPoint);
Gizmos.DrawWireSphere(endPoint, 0.5f);
}
}
}
fileFormatVersion: 2
guid: c7f3fdf6e62442c5485a9ff394896b54
\ No newline at end of file
fileFormatVersion: 2
guid: 9e9f7f46a1ba34c338eb95b193ae1327
guid: 6861b763abb74de18870c6b4415ab775
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
......
fileFormatVersion: 2
guid: b564a59b163fee403b6e79f2095be45a
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TextBackground
m_Shader: {fileID: 4800000, guid: b564a59b163fee403b6e79f2095be45a, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs: []
m_Ints: []
m_Floats:
- _AnimSpeed: 1
- _Brightness: 1
- _CornerRadius: 0.1
- _DotBrightness: 0.7
- _DotFlickerSpeed: 3
- _DotScale: 12
- _GridBrightness: 0.6
- _GridPulseSpeed: 1.5
- _GridScale: 8
- _GridThickness: 0.02
- _HexBrightness: 0.868
- _HexPulseSpeed: 0.8
- _HexScale: 5
- _ScanBrightness: 0
- _ScanCount: 2
- _ScanSpeed: 0.8
- _ScanWidth: 0.01
- _VignetteStrength: 0.6
m_Colors:
- _ColorDeep: {r: 0.01, g: 0.02, b: 0.079999976, a: 1}
- _ColorGlow: {r: 0.19999996, g: 0.6, b: 1, a: 1}
- _ColorHighlight: {r: 0.09999997, g: 0.39999998, b: 0.9, a: 1}
- _ColorMid: {r: 0.02, g: 0.079999976, b: 0.24999997, a: 1}
- _EdgeGlowColor: {r: 0.049999982, g: 0.19999996, b: 0.5, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
fileFormatVersion: 2
guid: 8a199a04dfa880189b698baab4b9adca
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -99,6 +99,8 @@ MonoBehaviour:
references:
version: 2
RefIds:
- rid: -2
type: {class: , ns: , asm: }
- rid: 142531261805101056
type: {class: RayTracingRenderPipelineResources, ns: UnityEngine.Rendering.UnifiedRayTracing, asm: Unity.UnifiedRayTracing.Runtime}
data:
......@@ -276,9 +278,9 @@ MonoBehaviour:
m_CoreBlitPS: {fileID: 4800000, guid: 93446b5c5339d4f00b85c159e1159b7c, type: 3}
m_CoreBlitColorAndDepthPS: {fileID: 4800000, guid: d104b2fc1ca6445babb8e90b0758136b, type: 3}
m_SamplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3}
m_TerrainDetailLit: {fileID: 0}
m_TerrainDetailGrassBillboard: {fileID: 0}
m_TerrainDetailGrass: {fileID: 0}
m_TerrainDetailLit: {fileID: 4800000, guid: f6783ab646d374f94b199774402a5144, type: 3}
m_TerrainDetailGrassBillboard: {fileID: 4800000, guid: 29868e73b638e48ca99a19ea58c48d90, type: 3}
m_TerrainDetailGrass: {fileID: 4800000, guid: e507fdfead5ca47e8b9a768b51c291a1, type: 3}
- rid: 6852985685364965381
type: {class: UniversalRenderPipelineRuntimeTextures, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
data:
......
fileFormatVersion: 2
guid: 92a80e6f6cd90464b8f87b98fc72999a
timeCreated: 1580355522
licenseType: Store
guid: 070647c6023a9cac1af4d5d87d35466e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b88dcd9233eab8ea488d8c9c180d6fd0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c1f8983beb12bb84796c28939f4596ab, type: 3}
m_Name: UniTextSettings
m_EditorClassIdentifier:
gradients: {fileID: 11400000, guid: 25571032a92321f4997329d90f499d06, type: 2}
defaultFontStack: {fileID: 11400000, guid: 72f6e3edfbc82804791ebe8e4814fa46, type: 2}
defaultAppearance: {fileID: 11400000, guid: 3a559cf5d653f05ea807e1be5655df92, type: 2}
fileFormatVersion: 2
guid: 35e7591be697d4cfc9d6925a15818655
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
<Solution>
<Project Path="Assembly-CSharp.csproj" />
<Project Path="LightSide.UniText.csproj" />
<Project Path="LightSide.UniText.Editor.csproj" />
<Project Path="Assembly-CSharp-firstpass.csproj" />
<Project Path="Assembly-CSharp-Editor.csproj" />
</Solution>
......@@ -12,6 +12,7 @@
"com.unity.timeline": "1.8.10",
"com.unity.ugui": "2.0.0",
"com.unity.visualscripting": "1.9.9",
"media.lightside.unitext": "https://github.com/LightSideMeowshop/unitext.git",
"com.unity.modules.accessibility": "1.0.0",
"com.unity.modules.adaptiveperformance": "1.0.0",
"com.unity.modules.ai": "1.0.0",
......
......@@ -10,7 +10,7 @@
"url": "https://packages.unity.com"
},
"com.unity.burst": {
"version": "1.8.28",
"version": "1.8.25",
"depth": 2,
"source": "registry",
"dependencies": {
......@@ -200,6 +200,16 @@
},
"url": "https://packages.unity.com"
},
"media.lightside.unitext": {
"version": "https://github.com/LightSideMeowshop/unitext.git",
"depth": 0,
"source": "git",
"dependencies": {
"com.unity.ugui": "1.0.0",
"com.unity.modules.ui": "1.0.0"
},
"hash": "370af98cbf7ab680c86682884429a2db95121844"
},
"com.unity.modules.accessibility": {
"version": "1.0.0",
"depth": 0,
......
......@@ -12,11 +12,13 @@ MonoBehaviour:
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_EnablePreviewPackages: 0
m_EnablePackageDependencies: 0
m_EnablePreReleasePackages: 0
m_AdvancedSettingsExpanded: 1
m_ScopedRegistriesSettingsExpanded: 1
m_SeeAllPackageVersions: 0
m_DismissPreviewPackagesInUse: 0
oneTimeWarningShown: 0
oneTimePackageErrorsPopUpShown: 1
m_Registries:
- m_Id: main
m_Name:
......@@ -24,20 +26,15 @@ MonoBehaviour:
m_Scopes: []
m_IsDefault: 1
m_Capabilities: 7
m_ConfigSource: 0
m_Compliance:
m_Status: 0
m_Violations: []
m_UserSelectedRegistryName:
m_UserAddingNewScopedRegistry: 0
m_RegistryInfoDraft:
m_ErrorMessage:
m_Original:
m_Id:
m_Name:
m_Url:
m_Scopes: []
m_IsDefault: 0
m_Capabilities: 0
m_Modified: 0
m_Name:
m_Url:
m_Scopes:
-
m_SelectedScopeIndex: 0
m_ErrorMessage:
m_UserModificationsInstanceId: -898
m_OriginalInstanceId: -900
m_LoadAssets: 0
......@@ -837,7 +837,7 @@ PlayerSettings:
PS4: DOTWEEN
PS5: DOTWEEN
QNX: DOTWEEN
Standalone: DOTWEEN
Standalone: DOTWEEN;UNITEXT
VisionOS: DOTWEEN
WebGL: DOTWEEN
Windows Store Apps: DOTWEEN
......
m_EditorVersion: 6000.3.9f1
m_EditorVersionWithRevision: 6000.3.9f1 (7a9955a4f2fa)
m_EditorVersion: 6000.3.0f1
m_EditorVersionWithRevision: 6000.3.0f1 (d1870ce95baf)
{
"gradients": "25571032a92321f4997329d90f499d06",
"defaultFontStack": "72f6e3edfbc82804791ebe8e4814fa46",
"defaultAppearance": "3a559cf5d653f05ea807e1be5655df92"
}
\ No newline at end of file
......@@ -9,20 +9,14 @@ EditorUserSettings:
value: 5a08575f5207595a0f5d59741173094444164f7d7d2a23317c7a4465bbe1646d
flags: 0
RecentlyUsedSceneGuid-1:
value: 0502565f000c0d5a0908597b43720f4443154f7d787d74337b7b1e60e1e4363b
value: 5500005f0702580d085e5524117b5e444f1549297c2c276374794a65b1b4303a
flags: 0
RecentlyUsedSceneGuid-2:
value: 5500005f0702580d085e5524117b5e444f1549297c2c276374794a65b1b4303a
value: 0502565f000c0d5a0908597b43720f4443154f7d787d74337b7b1e60e1e4363b
flags: 0
RecentlyUsedSceneGuid-3:
value: 0003525055055d020e0b0a7216755d444215417e787d27362e2f4866b2e1323e
flags: 0
RecentlyUsedSceneGuid-4:
value: 5701055506000a030f5c542744260844404f4d73797975367c2c1e6ab7e2653d
flags: 0
RecentlyUsedSceneGuid-5:
value: 5304575f5c0c51035d5a5e771271594417154e7c2d7b70647b7b4c35bbe1646d
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
flags: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment