diff --git a/Assets/Enemy Aircrafts/Aircraft/Scripts/Behaviour/EnemyBehaviour.cs b/Assets/Enemy Aircrafts/Aircraft/Scripts/Behaviour/EnemyBehaviour.cs index 0aeb0bc..a416de2 100644 --- a/Assets/Enemy Aircrafts/Aircraft/Scripts/Behaviour/EnemyBehaviour.cs +++ b/Assets/Enemy Aircrafts/Aircraft/Scripts/Behaviour/EnemyBehaviour.cs @@ -8,6 +8,7 @@ public class EnemyAI : MonoBehaviour [SerializeField] Transform player; // Ç÷¹À̾îÀÇ Transform [SerializeField] TargettingSystem targetingSystem; + [SerializeField] WarningController warningController; float distanceToTarget; [Header("movingAI instances")] @@ -209,7 +210,7 @@ private void OnTriggerEnter(Collider other) EnemySTDM missileScript = enemyMsl.GetComponent(); //³ªÁß¿¡ ¹Ì»çÀÏ À̸§ ¹Ù²ã¼­ µû·Î ¸¸µé±â. Debug.Log("missile launch"); - missileScript.Launch(player, 30); + missileScript.Launch(player, 30, warningController); canShoot = false; } @@ -383,7 +384,8 @@ void Start() Move(); } - public void initializeInstance(Transform playerTransform, TargettingSystem targettingSystem, TagController tagController, GameManagement gm, GameObject waypointObj, GameObject enemyMissile) + public void initializeInstance(Transform playerTransform, TargettingSystem targettingSystem, + TagController tagController, GameManagement gm, GameObject waypointObj, GameObject enemyMissile, WarningController warningController) { player = playerTransform; //Çʼö, ¸¸¾à µ¿·á Ãß°¡½Ã initalize ´Ù¿øÈ­ ÇÊ¿ä, this.targetingSystem = targettingSystem; //¹Ýµå½Ã ÇÊ¿äÇÔ. @@ -391,6 +393,7 @@ public void initializeInstance(Transform playerTransform, TargettingSystem targe this.gameManagement = gm; waypointObject = waypointObj; enemyMissilePrefab = enemyMissile; + this.warningController = warningController; } #region target, lock controls diff --git a/Assets/Enemy Aircrafts/Wapons/Script/EnemySTDM.cs b/Assets/Enemy Aircrafts/Wapons/Script/EnemySTDM.cs index 0baddb2..c4940cf 100644 --- a/Assets/Enemy Aircrafts/Wapons/Script/EnemySTDM.cs +++ b/Assets/Enemy Aircrafts/Wapons/Script/EnemySTDM.cs @@ -5,7 +5,7 @@ public class EnemySTDM : MonoBehaviour { - + public WarningController wc; public TagController tagController; public Transform target; // ÃßÀûÇÒ Å¸°Ù @@ -29,13 +29,16 @@ public class EnemySTDM : MonoBehaviour [SerializeField] CapsuleCollider mslCollider; - - public void Launch(Transform target, float launchSpeed) + public void Launch(Transform target, float launchSpeed, WarningController warningController) { + wc = warningController; + // Ÿ°ÙÀÌ Á¸ÀçÇÒ ¶§¸¸ ÇÒ´ç if (target != null) { this.target = target; + + wc.TrackingMissileCount(1); } Debug.Log("Missile instantiated"); @@ -56,9 +59,10 @@ void LookAtTarget() { Debug.Log("evaded"); target = null; - return; - + //°æº¸ ÇØÁ¦ + wc.TrackingMissileCount(-1); + return; } Quaternion lookRotation = Quaternion.LookRotation(targetDir); @@ -100,7 +104,7 @@ void Update() Debug.Log(collision.gameObject.name); if (collision.gameObject.CompareTag("Player")) { - + wc.TrackingMissileCount(-1); // Àû±â¿¡ ºÎµúÇûÀ» ¶§ È¿°ú »ý¼º Instantiate(enemyHitEffect, transform.position, Quaternion.identity); @@ -128,10 +132,4 @@ void Update() // ÃÑ¾Ë Æı« } - - //private void OnTriggerExit(Collider other) //Ç÷¹À̾ °¨Áö¹üÀ§¿¡¼­ Å»Ãâ -> Target lost. Áö±Ý »óȲ¿¡¼­ °¡Àå ÀûÇÕÇÑ Çعý °°À½. - //{ - // Debug.Log("Target (player) escaped!"); - // target = null; - //} } diff --git a/Assets/PlayScript/Plot.cs b/Assets/PlayScript/Plot.cs index 7f761ae..d7c28c2 100644 --- a/Assets/PlayScript/Plot.cs +++ b/Assets/PlayScript/Plot.cs @@ -14,7 +14,7 @@ public class Plot : MonoBehaviour [SerializeField] GameManagement gameManagement; [SerializeField] GameObject waypointObject; [SerializeField] GameObject enemyMissilePrefab; - + [SerializeField] WarningController warningController; #endregion @@ -55,7 +55,7 @@ void Update() if (enemyAI1 != null ) { - enemyAI1.initializeInstance(playerTransform, targettingSystem, tagController, gameManagement, waypointObject, enemyMissilePrefab); + enemyAI1.initializeInstance(playerTransform, targettingSystem, tagController, gameManagement, waypointObject, enemyMissilePrefab, warningController); } else { diff --git a/Assets/Scenes/MissionZero.unity b/Assets/Scenes/MissionZero.unity index c19421d..a685290 100644 --- a/Assets/Scenes/MissionZero.unity +++ b/Assets/Scenes/MissionZero.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 0.971 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 705507994} - m_IndirectSpecularColor: {r: 0.12177536, g: 0.14450268, b: 0.17819491, a: 0.971} + m_IndirectSpecularColor: {r: 0.12177514, g: 0.14450201, b: 0.17819476, a: 0.971} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -15570,13 +15570,13 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1180232555} - m_LocalRotation: {x: 0.25000006, y: -0.06698733, z: 0.25000006, w: 0.9330127} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: -3.4722238} - m_LocalScale: {x: 0.2, y: 5, z: 1} + m_LocalScale: {x: 0.2, y: 1.5, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 8046267458772044279} - m_LocalEulerAnglesHint: {x: 30, y: 0, z: 30} + 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.66986084, y: 35.19998} @@ -15638,6 +15638,7 @@ MonoBehaviour: transparentColor: {r: 0, g: 0, b: 0, a: 0} originalColor: {r: 0, g: 1, b: 0.627451, a: 0.627451} isBeingShown: 0 + radius: 50 --- !u!1 &1197247590 GameObject: m_ObjectHideFlags: 0 @@ -24463,6 +24464,7 @@ MonoBehaviour: gameManagement: {fileID: 468138451} waypointObject: {fileID: 6206487450123874273, guid: 82d9c450415cd0849a601e9a3a956998, type: 3} enemyMissilePrefab: {fileID: 1765958663548051430, guid: 7cf8732bbef4a504b9e424390bf57538, type: 3} + warningController: {fileID: 8046267458772044280} fa26Prefab: {fileID: 6749074832340177947, guid: 504e44d1d3428df47b96d5c7b4df2aa8, type: 3} --- !u!1 &1956822339 GameObject: @@ -47104,6 +47106,10 @@ PrefabInstance: propertyPath: targetingSystem value: objectReference: {fileID: 1693827035} + - target: {fileID: 3032640693232928596, guid: 504e44d1d3428df47b96d5c7b4df2aa8, type: 3} + propertyPath: warningController + value: + objectReference: {fileID: 8046267458772044280} - target: {fileID: 3032640693232928596, guid: 504e44d1d3428df47b96d5c7b4df2aa8, type: 3} propertyPath: enemyMissilePrefab value: @@ -52770,6 +52776,8 @@ GameObject: m_Component: - component: {fileID: 8046267458772044279} - component: {fileID: 7799833088894396460} + - component: {fileID: 8046267458772044280} + - component: {fileID: 8046267458772044281} m_Layer: 8 m_Name: AircraftHUD_Panel m_TagString: Untagged @@ -63163,6 +63171,122 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &8046267458772044280 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5336649975840249360} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9f258b5e78e25d4438d3a76ddb2284f7, type: 3} + m_Name: + m_EditorClassIdentifier: + imageWarningColor: {r: 1, g: 0, b: 0, a: 0.72156864} + imageNormalColor: {r: 0, g: 1, b: 0, a: 0.5882353} + textWarningColor: {r: 1, g: 0, b: 0, a: 1} + textNormalColor: {r: 0, g: 0.7490196, b: 0, a: 1} + isWarningState: 0 + currentEnemyMissile: 0 + textMaterial: {fileID: 4726163729585724971, guid: 5edb44b9d8af0664e9aabe1bd38bbbe8, type: 2} + warningAudioSource: {fileID: 8046267458772044281} +--- !u!82 &8046267458772044281 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5336649975840249360} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: f493784ce365b9043955df8ccf9a01c2, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!23 &8050562013355561990 MeshRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Sources/SoundTracks/SoundEffects/inGameSFX/Ace Combat 7 Missile Alert Sound with Voice Alert.mp3 b/Assets/Sources/SoundTracks/SoundEffects/inGameSFX/Ace Combat 7 Missile Alert Sound with Voice Alert.mp3 new file mode 100644 index 0000000..cc2cce0 Binary files /dev/null and b/Assets/Sources/SoundTracks/SoundEffects/inGameSFX/Ace Combat 7 Missile Alert Sound with Voice Alert.mp3 differ diff --git a/Assets/Sources/SoundTracks/SoundEffects/inGameSFX/Ace Combat 7 Missile Alert Sound with Voice Alert.mp3.meta b/Assets/Sources/SoundTracks/SoundEffects/inGameSFX/Ace Combat 7 Missile Alert Sound with Voice Alert.mp3.meta new file mode 100644 index 0000000..c02b8d0 --- /dev/null +++ b/Assets/Sources/SoundTracks/SoundEffects/inGameSFX/Ace Combat 7 Missile Alert Sound with Voice Alert.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: f493784ce365b9043955df8ccf9a01c2 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sources/UI/Font/ACES07_Regular SDF.asset b/Assets/Sources/UI/Font/ACES07_Regular SDF.asset index 930770a..a317842 100644 --- a/Assets/Sources/UI/Font/ACES07_Regular SDF.asset +++ b/Assets/Sources/UI/Font/ACES07_Regular SDF.asset @@ -1700,7 +1700,7 @@ Material: - _GlowInner: 0.539 - _GlowOffset: 0 - _GlowOuter: 0.333 - - _GlowPower: 0.211 + - _GlowPower: 2.2 - _GradientScale: 10 - _LightAngle: 3.1416 - _MaskSoftnessX: 0 @@ -1737,8 +1737,8 @@ Material: m_Colors: - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} - - _FaceColor: {r: 0.39150947, g: 1.0000001, b: 0.72551787, a: 1} - - _GlowColor: {r: 0, g: 1.8880861, b: 0, a: 1} + - _FaceColor: {r: 0, g: 0, b: 0, a: 0.6745098} + - _GlowColor: {r: 1, g: 0, b: 0, a: 1} - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Sources/UI/Script/EnemyPointer.cs b/Assets/Sources/UI/Script/EnemyPointer.cs index 9bde7ab..f2f2e3b 100644 --- a/Assets/Sources/UI/Script/EnemyPointer.cs +++ b/Assets/Sources/UI/Script/EnemyPointer.cs @@ -14,6 +14,7 @@ public class EnemyPointer : MonoBehaviour [SerializeField] Color originalColor; // È­»ìÇ¥°¡ º¸ÀÏ ¶§ÀÇ »ö»ó [SerializeField] bool isBeingShown; // È­»ìÇ¥°¡ È°¼ºÈ­ »óÅÂÀÎÁö + [SerializeField] float radius = 150f; // È­»ìÇ¥°¡ ¿òÁ÷ÀÏ ¹ÝÁö¸§ void Start() { @@ -38,10 +39,21 @@ void Update() arrowImage.color = originalColor; } - // Ÿ°ÙÀÌ Ä«¸Þ¶ó·ÎºÎÅÍ ¾î´À ¹æÇâ¿¡ ÀÖ´ÂÁö °è»ê - Vector3 targetDirFromCamera = targettingSystem.currentTargetTransform.position - targettingSystem.playerTransform.position; + // Ÿ°Ù ¹æÇâÀ» Ä«¸Þ¶óÀÇ ·ÎÄà ÁÂÇ¥°è·Î º¯È¯ÇÏ¿© °è»ê + Vector3 targetDirFromCamera = (targettingSystem.currentTargetTransform.position - Camera.main.transform.position).normalized; - arrowRectTransform.up = targetDirFromCamera; + // Ä«¸Þ¶óÀÇ ·ÎÄà ÁÂÇ¥¿¡¼­ Ÿ°Ù ¹æÇâÀ» °è»ê (Ä«¸Þ¶óÀÇ ·ÎÄà ¹æÇâÀ» °í·Á) + Vector3 arrowDirection = Camera.main.transform.InverseTransformDirection(targetDirFromCamera); + + // È­»ìÇ¥ÀÇ transform.rotationÀ» Ä«¸Þ¶ó ȸÀüÀ» ¹Ý¿µÇÏ¿© ¼³Á¤ + float angle = Mathf.Atan2(arrowDirection.x, arrowDirection.y) * Mathf.Rad2Deg; + arrowImage.transform.rotation = Quaternion.Euler(0, 0, -angle); + + // È­¸é Áß¾ÓÀ» ±âÁØÀ¸·Î È­»ìÇ¥ À§Ä¡ °è»ê + Vector2 arrowPosition = new Vector2(Mathf.Sin(angle * Mathf.Deg2Rad), Mathf.Cos(angle * Mathf.Deg2Rad)) * radius; + + // È­»ìÇ¥ÀÇ RectTransform À§Ä¡ ¼³Á¤ + arrowRectTransform.anchoredPosition = arrowPosition; } else { diff --git a/Assets/Sources/UI/Script/WarningController.cs b/Assets/Sources/UI/Script/WarningController.cs new file mode 100644 index 0000000..2bc66e6 --- /dev/null +++ b/Assets/Sources/UI/Script/WarningController.cs @@ -0,0 +1,102 @@ +using System.Collections; +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +public class WarningController : MonoBehaviour +{ + GameObject UISet; //ui¸¦ ´ã°íÀÖ´Â gameobject. + + [Header("UI colors")] + [SerializeField] Color imageWarningColor; //°æ°í½Ã »ö±ò -> »¡°£»ö. + [SerializeField] Color imageNormalColor; //±âº» »ö±ò -> À̹ÌÁö ÇÑÁ¤ + [SerializeField] Color textWarningColor; + [SerializeField] Color textNormalColor; + + [Space] + [Header("variables")] + [SerializeField] bool isWarningState; + [SerializeField] int currentEnemyMissile; + + [Space] + [Header("References")] + Image[] images; + RawImage[] rawImages; + [SerializeField] Material textMaterial; + [SerializeField] AudioSource warningAudioSource; + + // Start is called before the first frame update + void Start() + { + currentEnemyMissile = 0; + isWarningState = false; + + rawImages = GetComponentsInChildren(); + images = GetComponentsInChildren(); + + ChangeTextColor(textNormalColor); + } + + // Update is called once per frame + void Update() + { + bool currentWarningState = currentEnemyMissile >= 1; // ÇöÀç °æ°í »óÅ °è»ê + + // »óÅ°¡ º¯°æµÈ °æ¿ì¿¡¸¸ »ö»ó º¯°æ + if (currentWarningState != isWarningState) + { + isWarningState = currentWarningState; // »óÅ ¾÷µ¥ÀÌÆ® + ChangeImageUIColor(isWarningState ? imageWarningColor : imageNormalColor); // »ö»ó º¯°æ + ChangeTextColor(isWarningState ? textWarningColor : textNormalColor); + } + + if(isWarningState && !warningAudioSource.isPlaying) + { + warningAudioSource.Play(); + } + if(!isWarningState && warningAudioSource.isPlaying) + { + warningAudioSource.Stop(); + } + else + { + // + } + } + + public void ChangeImageUIColor(Color color) + { + // ÇöÀç °ÔÀÓ ¿ÀºêÁ§Æ® ¾Æ·¡¿¡ ÀÖ´Â ¸ðµç Image ÄÄÆ÷³ÍÆ® ã±â + + foreach (Image img in images) + { + img.color = color; + } + foreach(RawImage img in rawImages) + { + img.color = color; + } + + } + + public void ChangeTextColor(Color color) + { + textMaterial.SetColor("_GlowColor", color); + textMaterial.SetFloat("_GlowPower", 2.2f); + } + + public void TrackingMissileCount(int mslState) + { + currentEnemyMissile += mslState; + + if(currentEnemyMissile < 0) + { + currentEnemyMissile = 0; + } + + //if (currentEnemyMissile > 0) isWarningState = true; + //else isWarningState = false; + } + +} diff --git a/Assets/Sources/UI/Script/WarningController.cs.meta b/Assets/Sources/UI/Script/WarningController.cs.meta new file mode 100644 index 0000000..4d8846c --- /dev/null +++ b/Assets/Sources/UI/Script/WarningController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9f258b5e78e25d4438d3a76ddb2284f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: