m_PersistentCalls:
m_Calls: []
m_FontData:
- m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
m_FontSize: 24
m_FontStyle: 1
m_BestFit: 0
m_PersistentCalls:
m_Calls: []
m_FontData:
- m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
m_FontSize: 14
m_FontStyle: 1
m_BestFit: 0
m_PersistentCalls:
m_Calls: []
m_FontData:
- m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
m_FontSize: 24
m_FontStyle: 1
m_BestFit: 0
m_PersistentCalls:
m_Calls: []
m_FontData:
- m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
- m_FontSize: 15
+ m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
+ m_FontSize: 12
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
- m_Type: 1
+ m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
+ m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
PlayerHoop: {fileID: 614591307}
EnemyHoop: {fileID: 1354192742}
dribbleSound: {fileID: 1174357921}
+ playerScoreText: {fileID: 140689492}
+ enemyScoreText: {fileID: 447684163}
--- !u!82 &1174357921
AudioSource:
m_ObjectHideFlags: 0
m_PersistentCalls:
m_Calls: []
m_FontData:
- m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
m_FontSize: 14
m_FontStyle: 1
m_BestFit: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
- m_Type: 1
+ m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
+ m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_PersistentCalls:
m_Calls: []
m_FontData:
- m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
- m_FontSize: 15
+ m_Font: {fileID: 12800000, guid: b6747d7b13b2c4b9cb022acf49f3277b, type: 3}
+ m_FontSize: 12
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 0
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1576856532
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1576856534}
+ - component: {fileID: 1576856533}
+ m_Layer: 0
+ m_Name: Square
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!212 &1576856533
+SpriteRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1576856532}
+ m_Enabled: 1
+ m_CastShadows: 0
+ m_ReceiveShadows: 0
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 0
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 0
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_FlipX: 0
+ m_FlipY: 0
+ m_DrawMode: 0
+ m_Size: {x: 1, y: 1}
+ m_AdaptiveModeThreshold: 0.5
+ m_SpriteTileMode: 0
+ m_WasSpriteAssigned: 1
+ m_MaskInteraction: 0
+ m_SpriteSortPoint: 0
+--- !u!4 &1576856534
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1576856532}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 761.59344, y: 167.65875, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 5
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1742973248
GameObject:
m_ObjectHideFlags: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
- m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
- m_Type: 1
+ m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3}
+ m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
using System;
using UnityEngine;
+using UnityEngine.UI;
namespace Controllers
{
/// </summary>
[SerializeField] public Ball ball;
+ [Header("Hoops")]
[SerializeField] public Hoop PlayerHoop;
[SerializeField] public Hoop EnemyHoop;
+ [Header("SFX")]
[SerializeField] public AudioSource dribbleSound;
+ [Header("UI")]
+ [SerializeField] private Text playerScoreText;
+ [SerializeField] private Text enemyScoreText;
+
private void Awake()
{
player = new Player { isEnemy = false, controller = this };
EnemyHoop.controller = this;
BallAnimation = ball.GetComponentInChildren<Animator>();
}
+
+ private void Start()
+ {
+ UpdateUI();
+ }
+
+ private void UpdateUI()
+ {
+ playerScoreText.text = $"{player.score}";
+ enemyScoreText.text = $"{enemy.score}";
+ }
public struct Player
{
{
score += 2;
}
+
+ controller.UpdateUI();
}
private State dribble => isEnemy ? State.EnemyDribble : State.PlayerDribble;
controller.BallAnimation.enabled = false;
controller.dribbleSound.Play();
Move(handPosition);
+
+ controller.ball.Rigidbody.bodyType = RigidbodyType2D.Kinematic;
+
return true;
}
controller.BallAnimation.enabled = true;
controller.dribbleSound.Stop();
controller.state = shoot;
+ controller.ball.Rigidbody.bodyType = RigidbodyType2D.Dynamic;
controller.ball.Shoot(hoop.transform.position);
lastShotPosition = playerTransform.position;
return true;
{
BallAnimation.enabled = true;
dribbleSound.Stop();
+ ball.Rigidbody.bodyType = RigidbodyType2D.Dynamic;
state = State.Idle;
}