Commit 362a1dd4 authored by czy's avatar czy

修复Bug和优化爆食物效果

parent 6388d74e
......@@ -4633,7 +4633,7 @@ Transform:
m_GameObject: {fileID: 326544491}
m_LocalRotation: {x: -0, y: -1, z: -0, w: 0}
m_LocalPosition: {x: 0, y: 2.67, z: 0}
m_LocalScale: {x: 49.5, y: 1, z: 49.5}
m_LocalScale: {x: 49.5, y: 1, z: 48}
m_Children: []
m_Father: {fileID: 557966601}
m_RootOrder: 1
......@@ -4662,8 +4662,8 @@ BoxCollider:
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 34.970665, z: 1}
m_Center: {x: 0, y: 16.985332, z: 0}
m_Size: {x: 1, y: 34.970665, z: 0.9727532}
m_Center: {x: 0, y: 16.985332, z: 0.013623397}
--- !u!114 &326544495
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -7452,7 +7452,7 @@ CharacterController:
m_Enabled: 1
serializedVersion: 2
m_Height: 25.9
m_Radius: 5.63
m_Radius: 5
m_SlopeLimit: 45
m_StepOffset: 0.3
m_SkinWidth: 0.08
......@@ -8487,6 +8487,7 @@ MonoBehaviour:
foodPhysicM: {fileID: 13400000, guid: cdd3c635b87625448950bf1323a8ffd4, type: 2}
topPOS: {fileID: 1074946583}
Count: 0
tempFoodNumber: 0
--- !u!54 &616173311
Rigidbody:
m_ObjectHideFlags: 0
......@@ -11715,6 +11716,7 @@ MonoBehaviour:
foodPhysicM: {fileID: 13400000, guid: cdd3c635b87625448950bf1323a8ffd4, type: 2}
Force: 301
topPOS: {fileID: 658860373}
tempFoodNumber: 0
Count: 0
--- !u!4 &883198006
Transform:
......@@ -17647,6 +17649,7 @@ MonoBehaviour:
foodPhysicM: {fileID: 13400000, guid: cdd3c635b87625448950bf1323a8ffd4, type: 2}
topPOS: {fileID: 861607386}
Count: 0
tempFoodNumber: 0
--- !u!54 &1342203614
Rigidbody:
m_ObjectHideFlags: 0
......@@ -19806,7 +19809,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 88224c51f1a97cf40895dff846d2a5b3, type: 3}
m_Name:
m_EditorClassIdentifier:
foodNumber: 20
foodNumber: 40
timeSpan: 10
foodPoint:
- {fileID: 297527856}
......@@ -24080,7 +24083,7 @@ GameObject:
- component: {fileID: 1846242463}
m_Layer: 0
m_Name: PathEndTrigger
m_TagString: Untagged
m_TagString: PathEndTrigger
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -50,7 +50,7 @@ MeshRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7483224581113721909}
m_Enabled: 0
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
......
......@@ -50,7 +50,7 @@ MeshRenderer:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6039842180593449807}
m_Enabled: 0
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
......
......@@ -60,7 +60,7 @@ public class AIMove : MonoBehaviour
public PhysicMaterial foodPhysicM;
public GameObject topPOS;
public int Count = 0;
public int tempFoodNumber = 0;
// Start is called before the first frame update
void Start()
......@@ -72,6 +72,7 @@ public class AIMove : MonoBehaviour
RandomFoodNumberToPush = Random.Range(1,11);
aiState = AIState.FindFood;
animationManager = GetComponentInChildren<AnimationManager>();
tempFoodNumber = CurrentFood;
}
......@@ -198,23 +199,26 @@ public class AIMove : MonoBehaviour
//Debug.LogError("CurrentFood:" + CurrentFood+"aa:"+aa);
scale -= aa * addScale;
switch (CurrentFood)
if (aa != 0)
{
case 0:
Scale(scale, scale, scale);
break;
case 5:
case 10:
case 15:
case 20:
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
break;
default:
break;
switch (CurrentFood)
{
case 0:
Scale(scale, scale, scale);
break;
case 5:
case 10:
case 15:
case 20:
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
break;
default:
break;
}
}
}
else
{
......@@ -256,32 +260,47 @@ public class AIMove : MonoBehaviour
//进行判断是否播放特效
tempFoodNumber = CurrentFood;
CurrentFood -= hurt;
if (CurrentFood <= 0)
if (CurrentFood < 0)
{
CurrentFood = 0;
scale = 1;
RefreshVertigo(1);
}
else
{
scale = 1 + CurrentFood * addScale;
}
ChangeAnimationscaleState(scale);
switch (CurrentFood)
//switch (CurrentFood)
//{
// case 0:
// Scale(scale, scale, scale);
// break;
// case 5:
// case 10:
// case 15:
// case 20:
// Scale(scale, scale, scale);
// ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
// ps.gameObject.AddComponent<DestroyMySel>();
// GenerateRandomFoodAroundPos(5, transform.position, 5);//生成5个食物距离为5
// break;
// default:
// break;
//}
if (CurrentFood == 0)
{
case 0:
Scale(scale, scale, scale);
break;
case 5:
case 10:
case 15:
case 20:
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
GenerateRandomFoodAroundPos(5, transform.position, 5);//生成5个食物距离为5
break;
default:
break;
Scale(scale, scale, scale);
}
if (CurrentFood <= 5 && 5 < tempFoodNumber || CurrentFood <= 10 && 10 < tempFoodNumber || CurrentFood <= 15 && 15 < tempFoodNumber || CurrentFood < 20 && 20 == tempFoodNumber)
{
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
GenerateRandomFoodAroundPos(5, transform.position, 5);//生成5个食物距离为5
}
}
......@@ -616,7 +635,7 @@ public class AIMove : MonoBehaviour
GameObject obj = foods[UnityEngine.Random.Range(0, foods.Count)];
GameObject go = Instantiate(obj);
go.GetComponent<BoxCollider>().isTrigger = false;
go.GetComponent<BoxCollider>().material = foodPhysicM;
//go.GetComponent<BoxCollider>().material = foodPhysicM;
Rigidbody rig = go.GetComponent<Rigidbody>();
rig.isKinematic = false;
rig.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
......
......@@ -23,7 +23,7 @@ public class BossAttackDamageRange : MonoBehaviour
if (other.tag == "Player")
{
other.gameObject.GetComponentInChildren<PlayerMove>().Hurt(1);
other.gameObject.GetComponentInChildren<PlayerMove>().Hurt(5);
ps = Instantiate(hitEffects, hitPos, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
Handheld.Vibrate();//手机震动
......@@ -31,7 +31,7 @@ public class BossAttackDamageRange : MonoBehaviour
}
else if (other.tag == "Competitor")
{
other.gameObject.GetComponentInChildren<AIMove>().Hurt(1);
other.gameObject.GetComponentInChildren<AIMove>().Hurt(5);
ps = Instantiate(hitEffects, hitPos, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
//Handheld.Vibrate();//手机震动
......
......@@ -18,7 +18,14 @@ public class BossAttackRangeTrigger : MonoBehaviour
}
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player"||other.tag== "Competitor")
if (other.tag == "Player"||other.tag== "Competitor" && bossMove.bossState == BossState.Sleep)
{
bossMove.AwakeBoss(other.gameObject);
}
}
private void OnTriggerStay(Collider other)
{
if ((other.tag == "Player" || other.tag == "Competitor")&& bossMove.bossState==BossState.Sleep)
{
bossMove.AwakeBoss(other.gameObject);
}
......@@ -27,7 +34,7 @@ public class BossAttackRangeTrigger : MonoBehaviour
{
if (other.tag == "Boss")
{
print("boss回去");
print("boss退出Ground2范围回到出生地。");
bossMove.GoSleep();
}
}
......
using System.Collections.Generic;
using UnityEngine;
public enum BossState
{
Sleep = 0, //睡着
GotoTarget = 1, //朝着目标点移动
GoBackToSleep = 2, //返回碎觉点
LegSweep = 3,
HurricaneKick = 4,
Attack
}
public class BossMove : MonoBehaviour
{
[Header("控制移动")]
......@@ -66,16 +75,7 @@ public class BossMove : MonoBehaviour
public enum BossState
{
Sleep=0, //睡着
GotoTarget=1, //朝着目标点移动
GoBackToSleep=2, //返回碎觉点
LegSweep=3,
HurricaneKick=4,
Attack
}
public BossState bossState= BossState.Sleep;
private BossAnimationManager bossAnimationManager;
......@@ -103,6 +103,11 @@ public class BossMove : MonoBehaviour
//print("加一");
EnemyNumber++;
}
//if (other.tag == "PathEndTrigger")
//{
// print("boss进入PathEndTrigger范围回到出生地。");
// GoSleep();
//}
}
private void OnTriggerExit(Collider other)
......@@ -159,6 +164,8 @@ public class BossMove : MonoBehaviour
{
//print("游戏是否开始:"+ BattleCtrl.instance.isStartBattle);
//print("游戏是否结束:"+ BattleCtrl.instance.isEndBattle);
print(bossState);
//----技能冷却--------------------------------------------------------------
if (isDeltaTime)
{
......@@ -244,9 +251,14 @@ public class BossMove : MonoBehaviour
if (LegSweepIsFinsh && HurricaneKickIsFinsh && dic >= 10)
{
//目标退出攻击范围
print("目标退出攻击范围");
print("攻击动画完成,目标退出攻击范围");
bossState = BossState.GotoTarget;
}
else
{
print("LegSweepIsFinsh:" + LegSweepIsFinsh+ "HurricaneKickIsFinsh:"+ HurricaneKickIsFinsh+ "dic >= 10:" + (dic >= 10)+ "dic:" + dic);
print("攻击动画未完成,或者目标在攻击范围");
}
if (EnemyNumber >= 2)
{
......@@ -282,7 +294,7 @@ public class BossMove : MonoBehaviour
}
else if (dic < 10 && !isDeltaTime2)
{
//print("扫腿");
print("扫腿");
IsCanRotate = true;
//注意的是,技能一开始使用,就进入了冷却计时。所以当前技能释放完成到下一次释放技能时间间隔会小于冷却时间。
isDeltaTime2 = true;
......@@ -292,7 +304,7 @@ public class BossMove : MonoBehaviour
}
else
{
//print("追击目标");
print("追击目标");
bossAnimationManager.ChangeAnimatorState(BossAnimationState.NotAttack);
}
......
......@@ -44,9 +44,10 @@ public class Food : MonoBehaviour
if (isUnNomalFood)
{
timer += Time.deltaTime;
if (timer >= 1)
if (timer >= 0.5f)
{
//1秒钟后检测
rig.AddForce(new Vector3(0, -60, 0));
if (rig.velocity.magnitude <= 0.01f)
{
collider.isTrigger = true;
......
......@@ -53,7 +53,7 @@ public class AttackTrigger : MonoBehaviour
//print(other.name+"受到伤害:");
if (other.tag == "Player")
{
other.gameObject.GetComponentInChildren<PlayerMove>().Hurt(1);
other.gameObject.GetComponentInChildren<PlayerMove>().Hurt(5);
ps= Instantiate(hitEffects, hitPos.transform.position, hitPos.transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
//Handheld.Vibrate();//手机震动
......@@ -61,7 +61,7 @@ public class AttackTrigger : MonoBehaviour
}
else if (other.tag == "Competitor")
{
other.gameObject.GetComponentInChildren<AIMove>().Hurt(1);
other.gameObject.GetComponentInChildren<AIMove>().Hurt(5);
ps=Instantiate(hitEffects, hitPos.transform.position, hitPos.transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
if (Root.tag == "Player")
......
......@@ -53,7 +53,7 @@ public class PlayerMove : MonoBehaviour
public float Force = 300;
public GameObject topPOS;
public int tempFoodNumber=0;
public int Count = 0;
......@@ -69,6 +69,7 @@ public class PlayerMove : MonoBehaviour
animator=GetComponentInChildren<Animator>();
characterController = GetComponentInChildren<CharacterController>();
animationManager = GetComponentInChildren<AnimationManager>();
tempFoodNumber = CurrentFood;
}
private void OnTriggerEnter(Collider other)
......@@ -77,7 +78,11 @@ public class PlayerMove : MonoBehaviour
if (other.tag == "Food")
{
//print("吃到食物。");
Handheld.Vibrate();//手机震动
if (Random.Range(0, 2) == 0)
{
Handheld.Vibrate();//手机震动(震动减半)
}
UpdateScore(1);
if (CurrentFood >= MaxFood)
{
......@@ -129,23 +134,26 @@ public class PlayerMove : MonoBehaviour
//Debug.LogError("CurrentFood:" + CurrentFood+"aa:"+aa);
scale -= aa*addScale;
switch (CurrentFood)
if (aa != 0)
{
case 0:
Scale(scale, scale, scale);
break;
case 5:
case 10:
case 15:
case 20:
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
break;
default:
break;
switch (CurrentFood)
{
case 0:
Scale(scale, scale, scale);
break;
case 5:
case 10:
case 15:
case 20:
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
break;
default:
break;
}
}
}
else
{
......@@ -160,30 +168,46 @@ public class PlayerMove : MonoBehaviour
public void Hurt(int hurt)
{
//进行判断是否播放特效
tempFoodNumber = CurrentFood;
CurrentFood -= hurt;
if (CurrentFood <= 0)
if (CurrentFood < 0)
{
CurrentFood = 0;
scale = 1;
RefreshVertigo(1);
}
else
{
scale = 1 + CurrentFood * addScale;
}
ChangeAnimationscaleState(scale);
switch (CurrentFood)
//switch (CurrentFood)
//{
// case 0:
// Scale(scale, scale, scale);
// break;
// case 5:
// case 10:
// case 15:
// case 20:
// Scale(scale, scale, scale);
// ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
// ps.gameObject.AddComponent<DestroyMySel>();
// GenerateRandomFoodAroundPos(5, transform.position, 5);//生成5个食物距离为5
// break;
// default:
// break;
//}
if (CurrentFood ==0)
{
Scale(scale, scale, scale);
}
if ( CurrentFood <=5&&5<tempFoodNumber || CurrentFood <= 10 && 10 < tempFoodNumber || CurrentFood <= 15 && 15 < tempFoodNumber || CurrentFood < 20 && 20 == tempFoodNumber)
{
case 0:
Scale(scale, scale, scale);
break;
case 5:
case 10:
case 15:
case 20:
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
GenerateRandomFoodAroundPos(5, transform.position, 5);//生成5个食物距离为5
break;
default:
break;
Scale(scale, scale, scale);
ParticleSystem ps = Instantiate(changeModeEffect, transform.position, transform.rotation);
ps.gameObject.AddComponent<DestroyMySel>();
GenerateRandomFoodAroundPos(5, transform.position, 5);//生成5个食物距离为5
}
}
......@@ -454,7 +478,7 @@ public class PlayerMove : MonoBehaviour
GameObject obj = foods[UnityEngine.Random.Range(0, foods.Count)];
GameObject go= Instantiate(obj);
go.GetComponent<BoxCollider>().isTrigger = false;
go.GetComponent<BoxCollider>().material = foodPhysicM;
//go.GetComponent<BoxCollider>().material = foodPhysicM;
Rigidbody rig= go.GetComponent<Rigidbody>();
rig.isKinematic = false;
rig.constraints = RigidbodyConstraints.FreezeRotationX| RigidbodyConstraints.FreezeRotationZ;
......
......@@ -16,6 +16,7 @@ TagManager:
- Enemy_Vertigo
- Food
- Boss
- PathEndTrigger
layers:
- Default
- TransparentFX
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment