From 22891bf59032ba88262824255a706d652031384b Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 10 Mar 2022 14:07:40 +0800 Subject: * move folder --- Assets/Scripts/Test 1/TestErika.cs | 121 ------------------------------------- 1 file changed, 121 deletions(-) delete mode 100644 Assets/Scripts/Test 1/TestErika.cs (limited to 'Assets/Scripts/Test 1/TestErika.cs') diff --git a/Assets/Scripts/Test 1/TestErika.cs b/Assets/Scripts/Test 1/TestErika.cs deleted file mode 100644 index 4ae41d78..00000000 --- a/Assets/Scripts/Test 1/TestErika.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -[Serializable] -public class UnitSetUp -{ - public UnitActionData actionData; // 动作配置 - - public GameObject unitControllerPrefab; - - public GameObject unitPrefab; - - public RuntimeAnimatorController animController; - - public string unitFolder; - - [HideInInspector] - public GameObject unit; - - [HideInInspector] - public GameObject unitController; - - [HideInInspector] - public UnitController owner; -} - -public class TestErika : SingletonMB -{ - public UnitSetUp erika; - public UnitSetUp monster; - public GameObject unitEffect; - - protected override void Awake() - { - base.Awake(); - SetupErika(); - SetupMonster(); - UnitImageEffect.effectPlane = unitEffect; - } - - private void Update() - { - if (Input.GetKeyDown("r")) - { - erika.unitController.transform.position = Vector3.zero; - erika.unitController.transform.rotation = Quaternion.identity; - - monster.unitController.transform.position = new Vector3(2, 0, 0); - monster.unitController.transform.rotation = Quaternion.Euler(0, 180, 0); - } - } - - void SetupErika() - { - erika.unitController = GameObject.Instantiate(erika.unitControllerPrefab); - erika.unitController.transform.position = Vector3.zero; - erika.unitController.transform.rotation = Quaternion.identity; - - erika.unit = GameObject.Instantiate(erika.unitPrefab); - erika.unit.transform.position = Vector3.zero; - erika.unit.transform.rotation = Quaternion.Euler(0, 90, 0); - erika.unit.transform.SetParent(erika.unitController.transform); - - UnitController unitCtr = erika.unitController.GetOrAddComponent(); - unitCtr.Initialize(erika.unit, erika.unitFolder); - - UnitRootMotion unitRootMotion = unitCtr.unitRootMotion; - - RootMotionProxy rootMotionProxy = erika.unit.GetOrAddComponent(); - - Animator animator = erika.unit.GetComponent(); - //AnimatorOverrideController animCtr = new AnimatorOverrideController(erika.animController); - //animCtr.name = erika.unitPrefab.name + " Override Controller"; - //foreach(var anim in erika.actionData.actions) - //{ - // animCtr[anim.Key] = anim.Value; - //} - animator.runtimeAnimatorController = erika.animController; - - Debug.Assert(animator.runtimeAnimatorController is AnimatorOverrideController); - - unitCtr.pcState.ChangeState(PCState.EUnitState.Idle, new PCState.IdleParam(), true); - - //////////////////////////////// - - UnitManager.Instance.SetPlayerCharacter(unitCtr as PCController); - } - - void SetupMonster() - { - monster.unitController = GameObject.Instantiate(monster.unitControllerPrefab); - monster.unitController.transform.position = Vector3.zero; - monster.unitController.transform.rotation = Quaternion.identity; - - monster.unit = GameObject.Instantiate(monster.unitPrefab); - monster.unit.transform.rotation = Quaternion.Euler(0, 90, 0); - monster.unit.transform.SetParent(monster.unitController.transform); - - UnitController unitCtr = monster.unitController.GetOrAddComponent(); - unitCtr.Initialize(monster.unit, monster.unitFolder); - - UnitRootMotion unitRootMotion = unitCtr.unitRootMotion; - - RootMotionProxy rootMotionProxy = monster.unit.GetOrAddComponent(); - - Animator animator = monster.unit.GetComponent(); - AnimatorOverrideController animCtr = new AnimatorOverrideController(monster.animController); - animCtr.name = monster.unitPrefab.name + " Override Controller"; - animator.runtimeAnimatorController = animCtr; - - unitCtr.monsterState.ChangeState(MonsterState.EUnitState.Idle, new MonsterState.IdleParam(), true); - - monster.unitController.transform.position = new Vector3(2, 0, 0); - monster.unitController.transform.rotation *= Quaternion.Euler(0, 180, 0); - - monster.owner = unitCtr; - } - -} -- cgit v1.1-26-g67d0