diff --git a/Assets/Manager/GameManager/Script/GameManage.cs b/Assets/Manager/GameManager/Script/GameManage.cs index cabb7520..30b511a7 100644 --- a/Assets/Manager/GameManager/Script/GameManage.cs +++ b/Assets/Manager/GameManager/Script/GameManage.cs @@ -10,7 +10,7 @@ namespace PLATEAU.Samples { - public class GameManage : MonoBehaviour, InputGameManage.IInputGameActions + public class GameManage : MonoBehaviour { public struct GoalInfo { @@ -52,27 +52,30 @@ public struct GoalInfo private int goalNum; private int getHintNum; private bool isSetGMLdata; + + //player + private GameObject player; + //サウンドエフェクト + [SerializeField] private AudioClip saveAudioClip; + private AudioSource saveSound; + + // パーティクルエフェクト + [SerializeField] private GameObject saveParticle; + private GameObject saveParticleInstance; + private float particleDuration = 2f; // ------------------------------------------------------------------------------------------------------------- private void Awake() { + player = GameObject.Find("PlayerArmature"); inputActions = new InputGameManage(); targetParent = GameObject.Find("52385628_bldg_6697_op.gml").transform; + + // 救出時 + saveSound = gameObject.AddComponent(); + saveSound.clip = saveAudioClip; + saveSound.loop = false; } - // InputSystemを有効化させる - // ------------------------------------------------------------------------------------------------------------- - private void OnEnable() - { - inputActions.Enable(); - } - private void OnDisable() - { - inputActions.Disable(); - } - private void OnDestroy() - { - inputActions.Dispose(); - } - // ------------------------------------------------------------------------------------------------------------- + void Start() { @@ -81,7 +84,7 @@ void Start() public void StartGame() { rnd = new System.Random(); - inputActions.InputGame.AddCallbacks(this); + //thirdpersonController = GameObject.Find("PlayerArmature").GetComponent(); @@ -499,6 +502,12 @@ public void AddRescueNum() { rescuedNum++; UIManageScript.DisplayRescuedNum(); + + // パーティクルエフェクト + saveParticleInstance = Instantiate(saveParticle, player.gameObject.transform.position, Quaternion.Euler(-90, 0, 0), player.gameObject.transform); + Destroy(saveParticleInstance, particleDuration); + // サウンドエフェクト + saveSound.Play(); } //現在助けている人数を追加する関数 public void ContactHumanAction() @@ -506,31 +515,7 @@ public void ContactHumanAction() rescuingNum += 1; UIManageScript.DisplayRescuingNum(); } - // InputSystemの入力に対する処理(OnSonar : F) - // ------------------------------------------------------------------------------------------------------------- - /// - /// Sonarを使う時の処理 - /// - public void OnSonar(InputAction.CallbackContext context) - { - if (context.performed) - { - string nearestBuildingName = ""; - float distance = -1f; - if(sonarCount > 0) - { - nearestBuildingName = FindNearestGoal(); - - Vector3 playerPos = GameObject.Find("PlayerArmature").transform.position; - Vector3 buildingPos = GoalAttributeDict[nearestBuildingName].goalPosition; - distance = Cal2DDistance(playerPos,buildingPos); - - sonarCount -= 1; - - } - UIManageScript.DisplayDistance(distance,sonarCount); - } - } + private void ResetGoals() { // 建物の色を初期化 diff --git a/Assets/Manager/Scripts/ActionManager.cs b/Assets/Manager/Scripts/ActionManager.cs index f9f05ff8..c9bd79e1 100644 --- a/Assets/Manager/Scripts/ActionManager.cs +++ b/Assets/Manager/Scripts/ActionManager.cs @@ -24,6 +24,7 @@ public enum State private void Awake() { + animator = GetComponent(); thirdPersonController = GetComponent(); attackHandler = GetComponent(); state = State.Wait; diff --git a/Assets/NPC/Scripts/NPCController.cs b/Assets/NPC/Scripts/NPCController.cs index b77861b6..91901b11 100644 --- a/Assets/NPC/Scripts/NPCController.cs +++ b/Assets/NPC/Scripts/NPCController.cs @@ -65,7 +65,7 @@ void Start() characterController = GetComponent(); gameManage = GameObject.Find("GameManager").GetComponent(); pathManager = GameObject.Find("RoadObjects").GetComponent(); - npcManage = GameObject.Find("NPCManage").GetComponent(); + npcManage = GameObject.Find("NPCManager").GetComponent(); player = GameObject.FindGameObjectWithTag("Player"); animator = GetComponent(); diff --git a/Assets/Player/Script/Contact.cs b/Assets/Player/Script/Contact.cs index 9afc507e..0250babb 100644 --- a/Assets/Player/Script/Contact.cs +++ b/Assets/Player/Script/Contact.cs @@ -1,4 +1,4 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; using StarterAssets; @@ -7,30 +7,23 @@ namespace PLATEAU.Samples { public class Contact : MonoBehaviour { - // パーティクルエフェクト - [SerializeField] private GameObject saveParticle; - [SerializeField] private GameObject getItemParticle; - private GameObject saveParticleInstance; + // パーティクルエフェクト + [SerializeField] private GameObject getItemParticle; private GameObject getItemParticleInstance; private float particleDuration = 2f; + //サウンドエフェクト [SerializeField] private AudioClip getItemAudioClip; private AudioSource getItemSound; - [SerializeField] private AudioClip saveAudioClip; - private AudioSource saveSound; private GameManage GameManageScript; - private GameView GameViewScript; - private UIManage UIManageScript; + private GameView GameViewScript; private ItemManage ItemManageScript; - private ThirdPersonController ThirdPersonControllerScript; private ActionManager ActionManager; void Start() { - ThirdPersonControllerScript = this.GetComponent(); GameManageScript = GameObject.Find("GameManager").GetComponent(); - UIManageScript = GameObject.Find("UIManager").GetComponent(); ItemManageScript = GameObject.Find("ItemManager").GetComponent(); GameViewScript = GameObject.Find("GameView").GetComponent(); ActionManager = GameObject.Find("PlayerArmature").GetComponent(); @@ -40,15 +33,10 @@ void Start() getItemSound = gameObject.AddComponent(); getItemSound.clip = getItemAudioClip; getItemSound.loop = false; - // 救出時 - saveSound = gameObject.AddComponent(); - saveSound.clip = saveAudioClip; - saveSound.loop = false; } public void GameOverFunc() { ActionManager.state = ActionManager.State.Died; - //ThirdPersonControllerScript.DyingMotion(); //一番上の親(GameView)にゲームオーバーを通知 GameViewScript.isGameOver = true ; } @@ -70,11 +58,8 @@ private void OnControllerColliderHit(ControllerColliderHit hit) { //救助する GameManageScript.SelectBuildingAction(hit.transform); - // パーティクルエフェクト - saveParticleInstance = Instantiate(saveParticle,this.gameObject.transform.position,Quaternion.Euler(-90,0,0),this.gameObject.transform); - Destroy(saveParticleInstance,particleDuration); - // サウンドエフェクト - saveSound.Play(); + + } } } diff --git a/Assets/Resources/Prefabs/ViewPrefabs/GameView.prefab b/Assets/Resources/Prefabs/ViewPrefabs/GameView.prefab index 2ab9ecf4..a3e58c45 100644 --- a/Assets/Resources/Prefabs/ViewPrefabs/GameView.prefab +++ b/Assets/Resources/Prefabs/ViewPrefabs/GameView.prefab @@ -6382,6 +6382,8 @@ MonoBehaviour: sonarCount: 0 rescuedNum: 0 rescuingNum: 0 + saveAudioClip: {fileID: 8300000, guid: 52785ce05b92af64a9ec36e40ef3d94c, type: 3} + saveParticle: {fileID: 1837947354677370815, guid: 789b77970a5135140b92a679131ceff2, type: 3} --- !u!1 &7600826448228269314 GameObject: m_ObjectHideFlags: 0