Исправил баг с залипанием кнопки в меню

This commit is contained in:
Vladislav Likhenko 2024-08-14 15:49:46 +03:00
parent f8e6da58b4
commit 36018dbfb4
12 changed files with 152 additions and 20 deletions

View File

@ -2,14 +2,14 @@ using UnityEngine;
public class MinimapStatrScript : MonoBehaviour public class MinimapStatrScript : MonoBehaviour
{ {
[SerializeField] private FollowTarget _FollowTarget; [SerializeField] private FollowTarget _followTarget;
[SerializeField] private FollowYRotation _FollowYRotation; [SerializeField] private FollowYRotation _followYRotation;
[SerializeField] private SelectCarGameScript _SelectCarGameScript; [SerializeField] private SelectCarGameScript _SelectCarGameScript;
private void Start() private void Start()
{ {
_FollowTarget.target = _SelectCarGameScript._CurrentCar.transform; _followTarget.target = _SelectCarGameScript._CurrentCar.transform;
_FollowYRotation.target = _SelectCarGameScript._CurrentCar.transform; _followYRotation.target = _SelectCarGameScript._CurrentCar.transform;
} }
} }

View File

@ -8,15 +8,15 @@ public class CheckNumPlayerScript : MonoBehaviour
[SerializeField] private SetActiveScript _setActiveFirstPlayer; [SerializeField] private SetActiveScript _setActiveFirstPlayer;
[SerializeField] private SetActiveScript _setActiveSecondPlayer; [SerializeField] private SetActiveScript _setActiveSecondPlayer;
[SerializeField] Camera _CameraFirstPlayer; [SerializeField] Camera _cameraFirstPlayer;
[SerializeField] Camera _CameraSecondPlayer; [SerializeField] Camera _cameraSecondPlayer;
private void Start() private void Start()
{ {
if (StaticDataMap.NumPlayer == 1) if (StaticDataMap.NumPlayer == 1)
{ {
_setActiveFirstPlayer.SetActiveSelected(); _setActiveFirstPlayer.SetActiveSelected();
_CameraFirstPlayer.rect = new Rect(0f, 0f, 1f, 1f); _cameraFirstPlayer.rect = new Rect(0f, 0f, 1f, 1f);
} }
else else

View File

@ -1,31 +1,36 @@
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;
public class TimerOnInactiveScript : MonoBehaviour public class TimerOnInactiveScript : MonoBehaviour
{ {
[SerializeField] float _ValueTargetTime = 30.0f; [SerializeField] float _valueTargetTime = 30.0f;
[SerializeField] private Animator _Animator; [SerializeField] private Animator _animator;
[SerializeField] GameObject _UIActive; [SerializeField] GameObject _UIActive;
[SerializeField] GameObject _UIInactive; [SerializeField] GameObject _UIInactive;
[SerializeField] private float _TargetTime; [SerializeField] GameObject _button;
private bool _CanMoveFrom; [SerializeField] private float _targetTime;
private bool _canMoveFrom;
private void Awake() private void Awake()
{ {
_CanMoveFrom = false; _canMoveFrom = false;
_TargetTime = _ValueTargetTime; _targetTime = _valueTargetTime;
} }
private void Update() private void Update()
{ {
_TargetTime -= Time.deltaTime; _targetTime -= Time.deltaTime;
if (_TargetTime <= 0.0f) if (_targetTime <= 0.0f)
{ {
//Debug.Log("Òàéìåð Çàêîí÷èëñÿ"); //Debug.Log("Òàéìåð Çàêîí÷èëñÿ");
_CanMoveFrom = true; _canMoveFrom = true;
MoveCameraToRound(); MoveCameraToRound();
} }
@ -66,17 +71,32 @@ public class TimerOnInactiveScript : MonoBehaviour
{ {
_UIActive.SetActive(false); _UIActive.SetActive(false);
//Debug.Log("Ïåðåìåñòèëñÿ ê"); //Debug.Log("Ïåðåìåñòèëñÿ ê");
_Animator.Play("MoveCameraToRound"); _animator.Play("MoveCameraToRound");
} }
void MoveCameraFromRound() void MoveCameraFromRound()
{ {
if (_CanMoveFrom) if (_canMoveFrom)
{ {
_UIInactive.SetActive(false); _UIInactive.SetActive(false);
_Animator.Play("MoveCameraFromRound"); _animator.Play("MoveCameraFromRound");
//Debug.Log("Ïåðåìåñòèëñÿ îò"); //Debug.Log("Ïåðåìåñòèëñÿ îò");
ResetTimer(); ResetTimer();
//_button.GetComponent<Button>().Select();
GameObject selectedObject = EventSystem.current.currentSelectedGameObject;
// Ďđîâĺđ˙ĺě, ĺńëč âűáđŕííűé îáúĺęň ńóůĺńňâóĺň
if (selectedObject != null)
{
// Ĺńëč ýňî ęíîďęŕ, ěîćĺě ďîëó÷čňü ęîěďîíĺíň Button
Button selectedButton = selectedObject.GetComponent<Button>();
if (selectedButton != null)
{
selectedButton.GetComponent<Image>().color = Color.white;
}
}
} }
} }
@ -92,6 +112,6 @@ public class TimerOnInactiveScript : MonoBehaviour
void ResetTimer() void ResetTimer()
{ {
_TargetTime = _ValueTargetTime; _targetTime = _valueTargetTime;
} }
} }

BIN
Assets/Track216KIT/KIT.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 3ab38003ad14b024c9b6ec87449c3fb4
ModelImporter:
serializedVersion: 22200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant: