pc 세팅 기본 함수 완료
This commit is contained in:
parent
1b1dd5c045
commit
d20e9e346e
|
|
@ -5,6 +5,8 @@ using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.AI;
|
using UnityEngine.AI;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using static UnityEngine.Rendering.DebugUI;
|
||||||
|
using Button = UnityEngine.UI.Button;
|
||||||
|
|
||||||
public static class MyEditorUtil
|
public static class MyEditorUtil
|
||||||
{
|
{
|
||||||
|
|
@ -189,21 +191,90 @@ public static class MyEditorUtil
|
||||||
|
|
||||||
foreach (var go in selectedObjects)
|
foreach (var go in selectedObjects)
|
||||||
{
|
{
|
||||||
var ma = go.GetComponent<WizardActor>();
|
// 프리팹 에셋 경로 가져오기
|
||||||
if (ma == null) ma = go.AddComponent<WizardActor>();
|
string prefabPath = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(go);
|
||||||
|
|
||||||
|
// Prefab인지 확인
|
||||||
|
if (!string.IsNullOrEmpty(prefabPath))
|
||||||
|
{
|
||||||
|
// Prefab Asset 가져오기
|
||||||
|
var prefabAsset = PrefabUtility.LoadPrefabContents(prefabPath);
|
||||||
|
|
||||||
|
var ma = prefabAsset.GetComponent<WizardActor>();
|
||||||
|
if (ma == null) ma = prefabAsset.AddComponent<WizardActor>();
|
||||||
ma.m_Role = eRole.PC;
|
ma.m_Role = eRole.PC;
|
||||||
|
|
||||||
Set_CommonRigidBody(go);
|
var navmesh = prefabAsset.GetComponent<NavMeshAgent>();
|
||||||
|
if (navmesh == null) navmesh = prefabAsset.AddComponent<NavMeshAgent>();
|
||||||
|
navmesh.speed = 6f;
|
||||||
|
navmesh.angularSpeed = 300f;
|
||||||
|
navmesh.acceleration = 140f;
|
||||||
|
navmesh.stoppingDistance = 4f;
|
||||||
|
navmesh.autoBraking = true;
|
||||||
|
navmesh.radius = 0.4f;
|
||||||
|
navmesh.height = 2f;
|
||||||
|
navmesh.avoidancePriority = 50;
|
||||||
|
navmesh.obstacleAvoidanceType = ObstacleAvoidanceType.LowQualityObstacleAvoidance;
|
||||||
|
|
||||||
var cc = go.GetComponent<CapsuleCollider>();
|
Set_CommonRigidBody(prefabAsset);
|
||||||
if (cc == null) cc = go.AddComponent<CapsuleCollider>();
|
|
||||||
|
var cc = prefabAsset.GetComponent<CapsuleCollider>();
|
||||||
|
if (cc == null) cc = prefabAsset.AddComponent<CapsuleCollider>();
|
||||||
cc.center = Vector3.up * 0.79f;
|
cc.center = Vector3.up * 0.79f;
|
||||||
cc.radius = 0.55f;
|
cc.radius = 0.55f;
|
||||||
cc.height = 1.58f;
|
cc.height = 1.58f;
|
||||||
cc.direction = 1;
|
cc.direction = 1;
|
||||||
|
|
||||||
// 왼손 방패, 오른손 무기 위치 잡기
|
var pcactor = prefabAsset.GetComponent<PCActor>();
|
||||||
|
pcactor.tfs_weapon = new Transform[2];
|
||||||
|
|
||||||
|
// 프리팹 내부 수정
|
||||||
|
var wristL = FindDeepChild(prefabAsset.transform, "Wrist_L");
|
||||||
|
var wristR = FindDeepChild(prefabAsset.transform, "Wrist_R");
|
||||||
|
|
||||||
|
if (wristL != null)
|
||||||
|
{
|
||||||
|
var shield = FindDeepChild(prefabAsset.transform, "w_shield");
|
||||||
|
if (shield == null) shield = new GameObject("w_shield").transform;
|
||||||
|
shield.parent = wristL;
|
||||||
|
shield.localPosition = new Vector3(0.1238701f, -0.02092049f, -0.1054159f);
|
||||||
|
shield.localEulerAngles = new Vector3(32.28088f, 2.733658f, 4.798194f);
|
||||||
|
shield.localScale = Vector3.one * 0.5f;
|
||||||
|
pcactor.tfs_weapon[0] = shield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wristR != null)
|
||||||
|
{
|
||||||
|
var righthand = FindDeepChild(prefabAsset.transform, "w_righthand");
|
||||||
|
if (righthand == null) righthand = new GameObject("w_righthand").transform;
|
||||||
|
righthand.parent = wristR;
|
||||||
|
righthand.localPosition = new Vector3(-0.04300008f, 0.02999998f, -0.01899974f);
|
||||||
|
righthand.localEulerAngles = new Vector3(-85.83548f, -95.7005f, -3.785309f);
|
||||||
|
righthand.localScale = Vector3.one * 0.8958604f;
|
||||||
|
pcactor.tfs_weapon[1] = righthand;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수정한 프리팹 저장
|
||||||
|
PrefabUtility.SaveAsPrefabAsset(prefabAsset, prefabPath);
|
||||||
|
PrefabUtility.UnloadPrefabContents(prefabAsset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError($"{go.name}은(는) 프리팹 인스턴스가 아닙니다!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static Transform FindDeepChild(Transform parent, string name)
|
||||||
|
{
|
||||||
|
foreach (Transform child in parent)
|
||||||
|
{
|
||||||
|
if (child.name == name)
|
||||||
|
return child;
|
||||||
|
var result = FindDeepChild(child, name);
|
||||||
|
if (result != null)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CommonSetting(GameObject go, int avoidancePriority)
|
static void CommonSetting(GameObject go, int avoidancePriority)
|
||||||
|
|
|
||||||
|
|
@ -7901,8 +7901,8 @@ GameObject:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4724027785898422}
|
- component: {fileID: 4724027785898422}
|
||||||
- component: {fileID: 8226558640170742542}
|
|
||||||
- component: {fileID: 95724331183731322}
|
- component: {fileID: 95724331183731322}
|
||||||
|
- component: {fileID: 8226558640170742542}
|
||||||
- component: {fileID: -9095893261625373431}
|
- component: {fileID: -9095893261625373431}
|
||||||
- component: {fileID: 54454140523445614}
|
- component: {fileID: 54454140523445614}
|
||||||
- component: {fileID: 136095561042029578}
|
- component: {fileID: 136095561042029578}
|
||||||
|
|
@ -7932,6 +7932,27 @@ Transform:
|
||||||
- {fileID: 4444742210754694}
|
- {fileID: 4444742210754694}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!95 &95724331183731322
|
||||||
|
Animator:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1996061924472238}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Avatar: {fileID: 9000000, guid: e5326b54f49cc50479cbf8508dc0e805, type: 3}
|
||||||
|
m_Controller: {fileID: 9100000, guid: 1c6db4fa620781947a116d69785fc547, type: 2}
|
||||||
|
m_CullingMode: 1
|
||||||
|
m_UpdateMode: 0
|
||||||
|
m_ApplyRootMotion: 0
|
||||||
|
m_LinearVelocityBlending: 0
|
||||||
|
m_StabilizeFeet: 0
|
||||||
|
m_WarningMessage:
|
||||||
|
m_HasTransformHierarchy: 1
|
||||||
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
|
m_KeepAnimatorStateOnDisable: 0
|
||||||
|
m_WriteDefaultValuesOnDisable: 0
|
||||||
--- !u!114 &8226558640170742542
|
--- !u!114 &8226558640170742542
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -7954,27 +7975,6 @@ MonoBehaviour:
|
||||||
tfs_weapon:
|
tfs_weapon:
|
||||||
- {fileID: 4739352771244427894}
|
- {fileID: 4739352771244427894}
|
||||||
- {fileID: 3617103529663220177}
|
- {fileID: 3617103529663220177}
|
||||||
--- !u!95 &95724331183731322
|
|
||||||
Animator:
|
|
||||||
serializedVersion: 5
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1996061924472238}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Avatar: {fileID: 9000000, guid: e5326b54f49cc50479cbf8508dc0e805, type: 3}
|
|
||||||
m_Controller: {fileID: 9100000, guid: 1c6db4fa620781947a116d69785fc547, type: 2}
|
|
||||||
m_CullingMode: 1
|
|
||||||
m_UpdateMode: 0
|
|
||||||
m_ApplyRootMotion: 0
|
|
||||||
m_LinearVelocityBlending: 0
|
|
||||||
m_StabilizeFeet: 0
|
|
||||||
m_WarningMessage:
|
|
||||||
m_HasTransformHierarchy: 1
|
|
||||||
m_AllowConstantClipSamplingOptimization: 1
|
|
||||||
m_KeepAnimatorStateOnDisable: 0
|
|
||||||
m_WriteDefaultValuesOnDisable: 0
|
|
||||||
--- !u!195 &-9095893261625373431
|
--- !u!195 &-9095893261625373431
|
||||||
NavMeshAgent:
|
NavMeshAgent:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -8120,7 +8120,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 3617103529663220177}
|
- component: {fileID: 3617103529663220177}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: w_r
|
m_Name: w_righthand
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
|
@ -8136,7 +8136,7 @@ Transform:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0.4387824, y: -0.55774254, z: -0.52080554, w: 0.47450492}
|
m_LocalRotation: {x: -0.4387824, y: -0.55774254, z: -0.52080554, w: 0.47450492}
|
||||||
m_LocalPosition: {x: -0.04300008, y: 0.02999998, z: -0.01899974}
|
m_LocalPosition: {x: -0.04300008, y: 0.02999998, z: -0.01899974}
|
||||||
m_LocalScale: {x: 0.8958604, y: 0.8958604, z: 0.8958604}
|
m_LocalScale: {x: 0.9, y: 0.9, z: 0.9}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4676774946024624}
|
m_Father: {fileID: 4676774946024624}
|
||||||
|
|
@ -8151,7 +8151,7 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 4739352771244427894}
|
- component: {fileID: 4739352771244427894}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: w_l
|
m_Name: w_shield
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b4ea8961edf5d1f4d8f14cf5cb591cca
|
||||||
|
timeCreated: 1484408970
|
||||||
|
licenseType: Store
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 925e6ff9e1b39fa42b9a7881ad9e0a2f
|
||||||
|
timeCreated: 1484403935
|
||||||
|
licenseType: Store
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -6,7 +6,7 @@ using UnityEngine.ResourceManagement.AsyncOperations;
|
||||||
|
|
||||||
public class PCActor : MyActor
|
public class PCActor : MyActor
|
||||||
{
|
{
|
||||||
public Transform[] tfs_weapon; // 0 왼손, 1 오른손
|
public Transform[] tfs_weapon; // 0 실드, 1 오른손
|
||||||
|
|
||||||
float t_RecoverHPTime = 10f, t_RecoverMPTime = 10f, t_autoskill = 0.5f;
|
float t_RecoverHPTime = 10f, t_RecoverMPTime = 10f, t_autoskill = 0.5f;
|
||||||
float t_HP = 0f, t_MP = 0f;
|
float t_HP = 0f, t_MP = 0f;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue