修改角色包
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cd21ba4756d406468a37fe882d097ae
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua {
|
||||
public abstract class EffectsLaunch : MonoBehaviour {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36eaafdfeb2c4f44f82504e36afe1cda
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a359f8431aa19b846b623d9dd066bae3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua {
|
||||
/// <summary>
|
||||
/// 运动控制器
|
||||
/// </summary>
|
||||
public abstract class Movement : MonoBehaviour {
|
||||
/// <summary> 当前速度 </summary>
|
||||
public abstract float CurrentSpeed { get; }
|
||||
/// <summary> 当前方向 </summary>
|
||||
public abstract Vector3 Direction { get; }
|
||||
|
||||
/// <summary> 更新移动 </summary>
|
||||
public abstract bool UpdateMove(Vector3 position);
|
||||
/// <summary> 获取随机位置 </summary>
|
||||
public abstract Vector3 RandomTargetPosition();
|
||||
/// <summary> 停止移动 </summary>
|
||||
public abstract void StopMoving();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d034bee659058394d8641aad1f9e7023
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua {
|
||||
public class MovementNavigation : MonoBehaviour {
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9eb06e286a5289a439f220c0a3656568
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua {
|
||||
/// <summary>
|
||||
/// 标准运动实现
|
||||
/// </summary>
|
||||
public class MovementStandard : Movement {
|
||||
public float moveSpeed = 5.0f; // 最大移动速度
|
||||
public float acceleration = 20.0f; // 加速度
|
||||
public float steeringSpeed = 180.0f; // 加速度
|
||||
public float currentSpeed = 0.0f; // 当前速度
|
||||
public Vector3 direction; // 面向
|
||||
|
||||
public override float CurrentSpeed => currentSpeed;
|
||||
|
||||
public override Vector3 Direction => direction;
|
||||
|
||||
public override bool UpdateMove(Vector3 position) {
|
||||
// 计算相对于世界坐标系的移动方向
|
||||
Vector3 moveDirection = (position - transform.position).normalized;
|
||||
float distance = Vector3.Distance(transform.position, position);
|
||||
|
||||
// 平滑加速和减速
|
||||
currentSpeed = distance > 0.2f
|
||||
? Mathf.MoveTowards(currentSpeed, moveSpeed, acceleration * Time.deltaTime)
|
||||
: Mathf.MoveTowards(currentSpeed, 0, acceleration * Time.deltaTime);
|
||||
|
||||
// 移动玩家
|
||||
transform.Translate(moveDirection * currentSpeed * Time.deltaTime, Space.World);
|
||||
|
||||
// 如果有移动输入,则更新玩家的朝向
|
||||
if (distance != 0) {
|
||||
Quaternion toRotation = Quaternion.LookRotation(moveDirection, Vector3.up);
|
||||
transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, moveSpeed * Time.deltaTime * steeringSpeed);
|
||||
}
|
||||
|
||||
// 计算转向向量
|
||||
Vector3 localMoveDirection = transform.InverseTransformDirection(moveDirection * currentSpeed);
|
||||
localMoveDirection = localMoveDirection.normalized;
|
||||
// 对localMoveDirection的x和z进行分类处理
|
||||
float moveX = Convert.ToInt32(localMoveDirection.x);
|
||||
float moveZ = Convert.ToInt32(localMoveDirection.z);
|
||||
direction = new Vector3(moveX, 0, moveZ);
|
||||
|
||||
// 如果到达目标位置,返回 true
|
||||
distance = Vector3.Distance(transform.position, position);
|
||||
|
||||
return distance < 0.05f;
|
||||
}
|
||||
public override Vector3 RandomTargetPosition() {
|
||||
float randomX = UnityEngine.Random.Range(-10.0f, 10.0f);
|
||||
float randomZ = UnityEngine.Random.Range(-10.0f, 10.0f);
|
||||
return transform.position + new Vector3(randomX, 0, randomZ);
|
||||
}
|
||||
public override void StopMoving() {
|
||||
currentSpeed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 699b617ae51a79a4390529e4e03405a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c84ca502025179419c2b8afb29080aa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua {
|
||||
public abstract class VisualField : MonoBehaviour {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4d36e9e525a8a7429e5a7d9edf17cb2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MuHua {
|
||||
public abstract class VisualFieldStandard : VisualField {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3595d54d26ddd5c47b4d4a3025935ecb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user