Commit 362a1dd4 authored by czy's avatar czy

修复Bug和优化爆食物效果

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