|
@@ -6,72 +6,79 @@ using UnityEngine;
|
|
|
|
|
|
|
|
public class MoveCharacter : Character
|
|
public class MoveCharacter : Character
|
|
|
{
|
|
{
|
|
|
- public bool canMove = true;
|
|
|
|
|
|
|
+ [Header("材质")]
|
|
|
|
|
+ public float matState = 1;
|
|
|
|
|
+ public GameObject spinee;
|
|
|
|
|
+ public MeshRenderer mesh;
|
|
|
|
|
+ public Material[] mats;
|
|
|
|
|
+ public Material[] outlineMats;
|
|
|
|
|
+ public Material[] outline1Mats;
|
|
|
|
|
+
|
|
|
|
|
+ [Header("组件")]
|
|
|
public Foot foot;
|
|
public Foot foot;
|
|
|
|
|
|
|
|
|
|
+ [Header("额外重力")]
|
|
|
public float extraRiseGravity = 0; //上升时额外重力加速度
|
|
public float extraRiseGravity = 0; //上升时额外重力加速度
|
|
|
public float extraFallGravity = -10; //下落时额外重力加速度
|
|
public float extraFallGravity = -10; //下落时额外重力加速度
|
|
|
|
|
+
|
|
|
|
|
+ [Header("属性")]
|
|
|
|
|
+ public bool canMove = true;
|
|
|
public float moveSpeed = 5;
|
|
public float moveSpeed = 5;
|
|
|
|
|
+
|
|
|
|
|
+ [Header("虚弱状态")]
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float beRepelValue;
|
|
public float beRepelValue;
|
|
|
public float totalBeRepelValue;
|
|
public float totalBeRepelValue;
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float weakTime;
|
|
public float weakTime;
|
|
|
public float totalWeakTime;
|
|
public float totalWeakTime;
|
|
|
|
|
+ public float weakHitRate = 2;
|
|
|
//public float weakUpSpeed = 10f;
|
|
//public float weakUpSpeed = 10f;
|
|
|
- public float decelerationRatio = 1f;
|
|
|
|
|
//public float minHurtKeepTime = 0.2f;
|
|
//public float minHurtKeepTime = 0.2f;
|
|
|
//[HideInInspector]
|
|
//[HideInInspector]
|
|
|
//public float hurtKeepTime = 0;
|
|
//public float hurtKeepTime = 0;
|
|
|
//public float hurtChangeVelocity = 1;
|
|
//public float hurtChangeVelocity = 1;
|
|
|
- public float weakHitRate = 2;
|
|
|
|
|
-
|
|
|
|
|
- [Header("新增眩晕参数")]
|
|
|
|
|
- public float comaTime = 5;
|
|
|
|
|
- public float pastComaTime;
|
|
|
|
|
- public bool isCaughtByCook;
|
|
|
|
|
- public bool isBeDropped;
|
|
|
|
|
-
|
|
|
|
|
- [Header("新增漂浮效果参数")]
|
|
|
|
|
- public float maxTime = 1.5f; //上升最大耗时
|
|
|
|
|
- public float minTime = 0.1f; //上升最小耗时
|
|
|
|
|
- public float maxHeight = 12; //最大上升高度
|
|
|
|
|
- public float minHeight = 7; //最小上升高度
|
|
|
|
|
-
|
|
|
|
|
- public float maxRotateSpeed = 20; //最大旋转速度
|
|
|
|
|
- public float minRotateSpeed = 5; //最小旋转速度
|
|
|
|
|
|
|
|
|
|
- public float floatTime = 20; //漂浮时间
|
|
|
|
|
|
|
+ [Header("易伤减伤")]
|
|
|
|
|
+ public float easyToGetHit = 0.2f;
|
|
|
|
|
+ public bool isDamageReduction;
|
|
|
|
|
+ public float reductionDegree;
|
|
|
|
|
+ public GameObject reductionEffect;
|
|
|
|
|
|
|
|
- private float curTime; //漂浮已进行时长
|
|
|
|
|
- private float height; //漂浮高度
|
|
|
|
|
- private float riseTime; //上升时间
|
|
|
|
|
- private float curHeight; //当前所在高度
|
|
|
|
|
- private float rotateSpeed; //旋转速度
|
|
|
|
|
- private float rotateDir; //旋转方向
|
|
|
|
|
- private float backSpeed; //往后退的速度
|
|
|
|
|
- public bool isFloat; //正在漂浮中
|
|
|
|
|
|
|
+ [Header("被击飞减速度")]
|
|
|
|
|
+ public float decelerationRatio = 1f;
|
|
|
|
|
|
|
|
- public int dropDamage; //漂浮摔落伤害
|
|
|
|
|
|
|
+ [Header("眩晕参数")]
|
|
|
|
|
+ public float comaTime = 5;
|
|
|
|
|
+ public float pastComaTime;
|
|
|
|
|
|
|
|
- public float normalFallSpeed;
|
|
|
|
|
- public float rapidFallSpeed;
|
|
|
|
|
- public float curFallSpeed;
|
|
|
|
|
|
|
+ [Header("漂浮")]
|
|
|
|
|
+ public int floatState; //0:不漂浮;1:漂浮中;2:飘着;3:掉下去
|
|
|
|
|
+ private float rise = 1;
|
|
|
|
|
|
|
|
|
|
+ public float maxTime = 1.5f; //上升最大耗时
|
|
|
|
|
+ public float minTime = 0.1f; //上升最小耗时
|
|
|
|
|
+ public float maxHeight = 12; //最大上升高度
|
|
|
|
|
+ public float minHeight = 7; //最小上升高度
|
|
|
|
|
+ private float curHeight; //当前所在高度
|
|
|
private Vector3 origPos; //初始位置
|
|
private Vector3 origPos; //初始位置
|
|
|
private float origY;
|
|
private float origY;
|
|
|
- private float pastTime; //上升已用时间
|
|
|
|
|
- private float rise = 1;
|
|
|
|
|
|
|
+ private float height; //漂浮高度
|
|
|
|
|
+ public float floatTime = 20; //漂浮时间
|
|
|
|
|
+ private float curTime; //漂浮已进行时长
|
|
|
|
|
+ private float riseTime; //上升时间
|
|
|
|
|
+ private float pastTime; //上升已用时间
|
|
|
|
|
+
|
|
|
|
|
+ public float maxRotateSpeed = 20; //最大旋转速度
|
|
|
|
|
+ public float minRotateSpeed = 5; //最小旋转速度
|
|
|
|
|
+ private float rotateSpeed; //旋转速度
|
|
|
|
|
+ private float rotateDir; //旋转方向
|
|
|
|
|
+ private float backSpeed; //往后退的速度
|
|
|
|
|
+ public bool isFloat; //正在漂浮中
|
|
|
|
|
|
|
|
- public int floatState; //0:不漂浮;1:漂浮中;2:飘着;3:掉下去
|
|
|
|
|
- public float matState = 1;
|
|
|
|
|
-
|
|
|
|
|
- public GameObject spinee;
|
|
|
|
|
- public MeshRenderer mesh;
|
|
|
|
|
- public Material[] mats;
|
|
|
|
|
- public Material[] outlineMats;
|
|
|
|
|
- public Material[] outline1Mats;
|
|
|
|
|
|
|
+ public float normalFallSpeed;
|
|
|
|
|
|
|
|
|
|
+ [Header("变身前记录玩家属性")]
|
|
|
public SkeletonMecanim playerMe;
|
|
public SkeletonMecanim playerMe;
|
|
|
public Animator playerAni;
|
|
public Animator playerAni;
|
|
|
public Animator playerCol;
|
|
public Animator playerCol;
|
|
@@ -85,25 +92,25 @@ public class MoveCharacter : Character
|
|
|
public Material[] playerMats;
|
|
public Material[] playerMats;
|
|
|
public Material[] playerOut;
|
|
public Material[] playerOut;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ [Header("魂")]
|
|
|
public GameObject soulPrefab;
|
|
public GameObject soulPrefab;
|
|
|
public float soulStartSpeed = 1f;
|
|
public float soulStartSpeed = 1f;
|
|
|
public bool isInvisible;
|
|
public bool isInvisible;
|
|
|
public float invisibleTime;
|
|
public float invisibleTime;
|
|
|
public float velocityAddition;
|
|
public float velocityAddition;
|
|
|
|
|
|
|
|
|
|
+ [Header("传送门")]
|
|
|
[HideInInspector]
|
|
[HideInInspector]
|
|
|
public float transmitTime;
|
|
public float transmitTime;
|
|
|
public bool haveTransmit;
|
|
public bool haveTransmit;
|
|
|
public PortalsController portalsController;
|
|
public PortalsController portalsController;
|
|
|
|
|
+
|
|
|
private void Awake()
|
|
private void Awake()
|
|
|
{
|
|
{
|
|
|
spinee = bodyTrans.GetChild(0).gameObject;
|
|
spinee = bodyTrans.GetChild(0).gameObject;
|
|
|
mesh = spinee.GetComponent<MeshRenderer>();
|
|
mesh = spinee.GetComponent<MeshRenderer>();
|
|
|
mats = mesh.materials;
|
|
mats = mesh.materials;
|
|
|
origY = transform.position.y;
|
|
origY = transform.position.y;
|
|
|
- curFallSpeed = normalFallSpeed;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void Start()
|
|
private void Start()
|
|
@@ -120,8 +127,6 @@ public class MoveCharacter : Character
|
|
|
playerMesh = mesh;
|
|
playerMesh = mesh;
|
|
|
playerMats = mats;
|
|
playerMats = mats;
|
|
|
playerOut = outlineMats;
|
|
playerOut = outlineMats;
|
|
|
-
|
|
|
|
|
- curFallSpeed = normalFallSpeed;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//0:漂浮 1:正常 2:无敌
|
|
//0:漂浮 1:正常 2:无敌
|
|
@@ -131,44 +136,10 @@ public class MoveCharacter : Character
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (outline1Mats.Length == 0)
|
|
if (outline1Mats.Length == 0)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
- //Transform particleSystem = bodyTrans.GetChild(1).GetChild(0);
|
|
|
|
|
- //if (particleSystem == null ||
|
|
|
|
|
- // (particleSystem != null && particleSystem.name != "Particle System"))
|
|
|
|
|
- //{
|
|
|
|
|
- // return;
|
|
|
|
|
- //}
|
|
|
|
|
- //ParticleSystem.MainModule mainModule;
|
|
|
|
|
- //switch (state)
|
|
|
|
|
- //{
|
|
|
|
|
- // case 0:
|
|
|
|
|
- // break;
|
|
|
|
|
- // case 1:
|
|
|
|
|
- // //print(particleSystem.name);
|
|
|
|
|
- // //mainModule =
|
|
|
|
|
- // // particleSystem.GetChild(1).GetComponent<ParticleSystem>().main;
|
|
|
|
|
- // //mainModule.startColor = new ParticleSystem.MinMaxGradient(Color.white);
|
|
|
|
|
- // //mainModule =
|
|
|
|
|
- // // particleSystem.GetChild(2).GetComponent<ParticleSystem>().main;
|
|
|
|
|
- // //mainModule.startColor = new ParticleSystem.MinMaxGradient(Color.white);
|
|
|
|
|
- // break;
|
|
|
|
|
- // case 2:
|
|
|
|
|
- // //mainModule =
|
|
|
|
|
- // // particleSystem.GetChild(1).GetComponent<ParticleSystem>().main;
|
|
|
|
|
- // //mainModule.startColor = new ParticleSystem.MinMaxGradient(Color.yellow);
|
|
|
|
|
- // //mainModule =
|
|
|
|
|
- // // particleSystem.GetChild(2).GetComponent<ParticleSystem>().main;
|
|
|
|
|
- // //mainModule.startColor = new ParticleSystem.MinMaxGradient(Color.yellow);
|
|
|
|
|
- // break;
|
|
|
|
|
- // default:
|
|
|
|
|
- // break;
|
|
|
|
|
- //}
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (spinee == null || mesh == null || mats == null)
|
|
if (spinee == null || mesh == null || mats == null)
|
|
|
{
|
|
{
|
|
|
spinee = transform.GetChild(0).GetChild(0).gameObject;
|
|
spinee = transform.GetChild(0).GetChild(0).gameObject;
|
|
@@ -208,10 +179,6 @@ public class MoveCharacter : Character
|
|
|
if (canMove)
|
|
if (canMove)
|
|
|
{
|
|
{
|
|
|
canMove = false;
|
|
canMove = false;
|
|
|
- if (curFallSpeed == 0)
|
|
|
|
|
- {
|
|
|
|
|
- curFallSpeed = normalFallSpeed;
|
|
|
|
|
- }
|
|
|
|
|
isFloat = true;
|
|
isFloat = true;
|
|
|
ChangeMat(0);
|
|
ChangeMat(0);
|
|
|
curTime = 0;
|
|
curTime = 0;
|
|
@@ -245,15 +212,6 @@ public class MoveCharacter : Character
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void FloatDrop()
|
|
|
|
|
- {
|
|
|
|
|
- isBeDropped = true;
|
|
|
|
|
- transform.localEulerAngles = new Vector3(0, 0, 0);
|
|
|
|
|
- ChangeState(CharacterState.Fall);
|
|
|
|
|
- floatState = 3;
|
|
|
|
|
- curFallSpeed = rapidFallSpeed;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private void RotateSelf()
|
|
private void RotateSelf()
|
|
|
{
|
|
{
|
|
|
transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
|
|
transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
|
|
@@ -292,35 +250,18 @@ public class MoveCharacter : Character
|
|
|
else if (floatState == 3)
|
|
else if (floatState == 3)
|
|
|
{
|
|
{
|
|
|
aniCollider.Play("Fall", 0, 0);
|
|
aniCollider.Play("Fall", 0, 0);
|
|
|
- if (!isBeDropped && transform.position.y >= origY + 0.05f || isBeDropped && !foot.TrigGround)
|
|
|
|
|
|
|
+ if (transform.position.y >= origY + 0.05f)
|
|
|
{
|
|
{
|
|
|
- curHeight -= curFallSpeed * Time.deltaTime;
|
|
|
|
|
|
|
+ curHeight -= normalFallSpeed * Time.deltaTime;
|
|
|
transform.position = new Vector3(origPos.x, curHeight, origPos.z);
|
|
transform.position = new Vector3(origPos.x, curHeight, origPos.z);
|
|
|
}
|
|
}
|
|
|
- else if (foot.TrigGround || !isBeDropped && curHeight <= origY + 0.05f)
|
|
|
|
|
|
|
+ else if (foot.TrigGround || curHeight <= origY + 0.05f)
|
|
|
{
|
|
{
|
|
|
- if (!isBeDropped)
|
|
|
|
|
- {
|
|
|
|
|
- //transform.position = origPos;
|
|
|
|
|
- ChangeState(CharacterState.Idle);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- ChangeState(CharacterState.Coma);
|
|
|
|
|
- BeHit(dropDamage, Vector3.zero, false, 0);
|
|
|
|
|
- isBeDropped = false;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
ChangeMat(1);
|
|
ChangeMat(1);
|
|
|
- /*
|
|
|
|
|
- foreach (Material m in mats)
|
|
|
|
|
- {
|
|
|
|
|
- m.SetInt("_Outline", 0);
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
floatState = 0;
|
|
floatState = 0;
|
|
|
isFloat = false;
|
|
isFloat = false;
|
|
|
canMove = true;
|
|
canMove = true;
|
|
|
- curFallSpeed = normalFallSpeed;
|
|
|
|
|
if (gameObject.tag == "Player")
|
|
if (gameObject.tag == "Player")
|
|
|
{
|
|
{
|
|
|
if (pc == null)
|
|
if (pc == null)
|
|
@@ -333,7 +274,6 @@ public class MoveCharacter : Character
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
public void Update()
|
|
public void Update()
|
|
|
{
|
|
{
|
|
|
if (beLarger)
|
|
if (beLarger)
|
|
@@ -344,17 +284,6 @@ public class MoveCharacter : Character
|
|
|
{
|
|
{
|
|
|
CharacterFloat();
|
|
CharacterFloat();
|
|
|
}
|
|
}
|
|
|
- //if (isSoulUnstable)
|
|
|
|
|
- //{
|
|
|
|
|
- // soulUnstableTime -= Time.deltaTime;
|
|
|
|
|
- // ChangeMat(2);
|
|
|
|
|
- // if(soulUnstableTime < 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // isSoulUnstable = false;
|
|
|
|
|
- // ChangeMat(1);
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
-
|
|
|
|
|
if (isInvisible)
|
|
if (isInvisible)
|
|
|
{
|
|
{
|
|
|
invisibleTime -= Time.deltaTime;
|
|
invisibleTime -= Time.deltaTime;
|
|
@@ -375,11 +304,6 @@ public class MoveCharacter : Character
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public float easyToGetHit = 0.2f;
|
|
|
|
|
- public bool isDamageReduction;
|
|
|
|
|
- public float reductionDegree;
|
|
|
|
|
- public GameObject reductionEffect;
|
|
|
|
|
-
|
|
|
|
|
//伤害减免状态开启(减免程度,减免时长)
|
|
//伤害减免状态开启(减免程度,减免时长)
|
|
|
public void DamageReductionStateOn(float degree, GameObject effect)
|
|
public void DamageReductionStateOn(float degree, GameObject effect)
|
|
|
{
|
|
{
|
|
@@ -439,14 +363,6 @@ public class MoveCharacter : Character
|
|
|
rb.AddForce(force);
|
|
rb.AddForce(force);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- //if (isSoulUnstable)
|
|
|
|
|
- //{
|
|
|
|
|
- // isSoulUnstable = false;
|
|
|
|
|
- // ChangeMat(1);
|
|
|
|
|
- // GameObject soulObj = PoolManager.Instantiate(soulPrefab, transform.position);
|
|
|
|
|
- // Vector3 dir = Vector3.up;
|
|
|
|
|
- // soulObj.GetComponent<Soul>().Burst(dir * soulStartSpeed);
|
|
|
|
|
- //}
|
|
|
|
|
if (canNotChangeHurt)
|
|
if (canNotChangeHurt)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
@@ -466,8 +382,6 @@ public class MoveCharacter : Character
|
|
|
rb.AddForce(force);
|
|
rb.AddForce(force);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|