Commit 860fc557 authored by czy's avatar czy

爆食物效果优化

parent cc11110e
This diff is collapsed.
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!134 &13400000
PhysicMaterial:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FoodUP
dynamicFriction: 0.6
staticFriction: 0.6
bounciness: 1
frictionCombine: 0
bounceCombine: 0
fileFormatVersion: 2
guid: cdd3c635b87625448950bf1323a8ffd4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
......@@ -29,8 +29,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6039842180593449807}
m_LocalRotation: {x: -0.31653008, y: -0.019398104, z: 0.021550622, w: 0.9481393}
m_LocalPosition: {x: -0.014041255, y: 0.25684795, z: -0.050959602}
m_LocalScale: {x: 0.15305078, y: 1, z: 0.23619002}
m_LocalPosition: {x: 0.1324, y: 0.2646, z: -0.0476}
m_LocalScale: {x: 0.4465608, y: 1, z: 0.23619002}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
......
......@@ -54,9 +54,11 @@ public class AIMove : MonoBehaviour
public int Score=0;
public bool isMyWin = false;
public GameObject DancingPlace;
[Header("食物")]
public List<GameObject> foods;
public float Force = 100;
public float Force = 300;
public PhysicMaterial foodPhysicM;
public GameObject topPOS;
// Start is called before the first frame update
void Start()
......@@ -483,15 +485,18 @@ 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;
Rigidbody rig = go.GetComponent<Rigidbody>();
rig.isKinematic = false;
rig.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
rig.useGravity = true;
Vector3 randomPos = targetPos + new Vector3(0, 2, 0);// + Quaternion.Euler(new Vector3(0, UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * radius;
//Vector3 randomPos = topPOS.transform.position; //targetPos+new Vector3(0,2,0);// + Quaternion.Euler(new Vector3(0, UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * radius;
//Vector3 randomPos = targetPos;
go.transform.position = randomPos;
go.transform.position = topPOS.transform.position;
go.tag = "Untagged";
go.GetComponent<Food>().isUnNomalFood = true;
rig.AddForce(Quaternion.Euler(new Vector3(UnityEngine.Random.Range(-80, -20), UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * Force);
//rig.AddForce(Quaternion.Euler(new Vector3(UnityEngine.Random.Range(-80, -20), UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * Force);
rig.AddForce(Quaternion.Euler(new Vector3(-45, i*360.0f / number, 0)) * Vector3.forward * Force);
}
}
......
......@@ -46,18 +46,19 @@ public class Food : MonoBehaviour
timer += Time.deltaTime;
if (timer >= 1)
{
if (rig.velocity.magnitude <= 0.1f)
//1秒钟后检测
if (rig.velocity.magnitude <= 0.01f)
{
rig.velocity = Vector3.zero;
//rig.useGravity = true;
rig.isKinematic = true;
collider.isTrigger = true;
collider.material = null;
rig.isKinematic = true;
rig.constraints = RigidbodyConstraints.None;
rig.useGravity = false;
gameObject.tag = "Food";
isUnNomalFood = false;
}
}
}
else
{
......
......@@ -42,6 +42,11 @@ public class AttackTrigger : MonoBehaviour
}
private void OnTriggerStay(Collider other)
{
if (OtherTagList.Contains(other.tag))//if (other.tag == "Competitor")
{
//ChangeAnimationPunchState(true);
animationManager.ChangeAnimatorState(AnimationState.Punch);
}
ParticleSystem ps;
if (OtherTagList.Contains(other.tag) && isCauseDamage)
{
......
......@@ -53,9 +53,12 @@ public class PlayerMove : MonoBehaviour
public int Score = 0;
public bool isMyWin=false;
public GameObject DancingPlace;
[Header("食物")]
public List<GameObject> foods;
public PhysicMaterial foodPhysicM;
public float Force = 100;
public float Force = 300;
public GameObject topPOS;
......@@ -438,15 +441,18 @@ 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;
Rigidbody rig= go.GetComponent<Rigidbody>();
rig.isKinematic = false;
rig.constraints = RigidbodyConstraints.FreezeRotationX| RigidbodyConstraints.FreezeRotationZ;
rig.useGravity = true;
Vector3 randomPos = targetPos+new Vector3(0,2,0);// + Quaternion.Euler(new Vector3(0, UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * radius;
//Vector3 randomPos = topPOS.transform.position; //targetPos+new Vector3(0,2,0);// + Quaternion.Euler(new Vector3(0, UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * radius;
//Vector3 randomPos = targetPos;
go.transform.position = randomPos;
go.transform.position = topPOS.transform.position;
go.tag = "Untagged";
go.GetComponent<Food>().isUnNomalFood = true;
rig.AddForce(Quaternion.Euler(new Vector3(UnityEngine.Random.Range(-80, -20), UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * Force);
//rig.AddForce(Quaternion.Euler(new Vector3(UnityEngine.Random.Range(-80, -20), UnityEngine.Random.Range(0, 360), 0)) * Vector3.forward * Force);
rig.AddForce(Quaternion.Euler(new Vector3(-45, i*360.0f/number,0)) * Vector3.forward * Force);
}
}
......
......@@ -43,6 +43,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &7119276381201012477
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -58,6 +59,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1846160755511594, guid: 5f3499b7ccca7438db0396f05573acae, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4606863368001060, guid: 5f3499b7ccca7438db0396f05573acae, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -16,6 +16,19 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &8037287731998634036
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4201393565975677940}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.28066528, y: 0.15644814, z: 0.05805028}
m_Center: {x: 0.00033928454, y: 0.041200146, z: -0.0000009201467}
--- !u!114 &-5035227146725020887
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -30,19 +43,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
--- !u!65 &8037287731998634036
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4201393565975677940}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.28066528, y: 0.15644814, z: 0.05805028}
m_Center: {x: 0.00033928454, y: 0.041200146, z: -0.0000009201467}
isUnNomalFood: 0
--- !u!1001 &4199887864893652916
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -58,6 +59,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1872412180362304, guid: 5d3dafc3b20484eb1971092f27cac145, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4652719131505646, guid: 5d3dafc3b20484eb1971092f27cac145, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -30,6 +30,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &8860821113255329337
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -117,6 +118,11 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1942829353459336460, guid: 267ea1819cefbf64193527830effafe3,
type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 7521616483769655469, guid: 267ea1819cefbf64193527830effafe3,
type: 3}
propertyPath: m_IsTrigger
......
......@@ -30,6 +30,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &3273679166802016114
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -45,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1006965567620430, guid: 8990abd47ad784f378160d3745607c8e, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4685772824695182, guid: 8990abd47ad784f378160d3745607c8e, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -16,6 +16,19 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &3424539357758085125
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4488542462492886108}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.12390807, y: 0.34718618, z: 0.123094276}
m_Center: {x: 0.0004448779, y: 0.14200105, z: -0.0003015045}
--- !u!114 &-5302266906743468271
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -30,19 +43,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
--- !u!65 &3424539357758085125
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4488542462492886108}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.12390807, y: 0.34718618, z: 0.123094276}
m_Center: {x: 0.0004448779, y: 0.14200105, z: -0.0003015045}
isUnNomalFood: 0
--- !u!1001 &4489775756594035602
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -58,6 +59,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1234570512433102, guid: 5b6062007637241e0b729ae8d458864b, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4586654444378030, guid: 5b6062007637241e0b729ae8d458864b, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -30,6 +30,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &1001740225628074146
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -45,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1991905838947792, guid: a91fd09f6a11341b0828e7359c4c53be, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4615231148747240, guid: a91fd09f6a11341b0828e7359c4c53be, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -30,6 +30,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &1384353932353747032
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -45,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1740084184627098, guid: 8a096f0786e6346258491fdc1beb592f, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4933202043644702, guid: 8a096f0786e6346258491fdc1beb592f, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -16,6 +16,19 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &3943766374620641027
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8308488070836470441}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.10713473, y: 0.07358828, z: 0.2171973}
m_Center: {x: 0.00047181733, y: 0.02690774, z: 0}
--- !u!114 &5042966936480931666
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -30,19 +43,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
--- !u!65 &3943766374620641027
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8308488070836470441}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.10713473, y: 0.07358828, z: 0.2171973}
m_Center: {x: 0.00047181733, y: 0.02690774, z: 0}
isUnNomalFood: 0
--- !u!1001 &2242307830803790759
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -140,6 +141,11 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 7805840925051435278, guid: e8fe085ad223d6d4a91a90ace7502cf8,
type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e8fe085ad223d6d4a91a90ace7502cf8, type: 3}
--- !u!1 &8308488070836470441 stripped
......
......@@ -16,6 +16,19 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &4032240151389544320
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7441636673628327258}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.07430576, y: 0.1936519, z: 0.07483297}
m_Center: {x: 0.00042974018, y: 0.08309094, z: 0.0013698749}
--- !u!114 &-906029668451107164
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -30,19 +43,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
--- !u!65 &4032240151389544320
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7441636673628327258}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.07430576, y: 0.1936519, z: 0.07483297}
m_Center: {x: 0.00042974018, y: 0.08309094, z: 0.0013698749}
isUnNomalFood: 0
--- !u!1001 &6580752451347437921
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -60,6 +61,11 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 4329514348469457979, guid: 13b6c374cc44590419d9532924576e3c,
type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4329514348469618715, guid: 13b6c374cc44590419d9532924576e3c,
type: 3}
propertyPath: m_LocalPosition.x
......
......@@ -46,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1388479604726704, guid: 5bb6b4f8ded274f819001be2cefca495, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4005676039006812, guid: 5bb6b4f8ded274f819001be2cefca495, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -46,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1503591459201002, guid: da3e1ddc94dfc431b8d3039c6c1db3f9, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4794331110638168, guid: da3e1ddc94dfc431b8d3039c6c1db3f9, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -46,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1672780226623516, guid: 7dbdd11837d8b494e8ef6ae74e7a62dd, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4474868445254868, guid: 7dbdd11837d8b494e8ef6ae74e7a62dd, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -46,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1558335970620438, guid: 9a33cf4e45bbf4d7a876bb8606c3ada2, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4478522751094052, guid: 9a33cf4e45bbf4d7a876bb8606c3ada2, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -30,6 +30,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &6114486012904365850
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -45,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1959857656465376, guid: bd70d6deae3cc4c4b9001bc0c41c32cc, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4656935614033394, guid: bd70d6deae3cc4c4b9001bc0c41c32cc, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -30,6 +30,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
VSpeed: 5
targetObj: {fileID: 0}
isUnNomalFood: 0
--- !u!1001 &323269023538972204
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -45,6 +46,10 @@ PrefabInstance:
propertyPath: m_TagString
value: Food
objectReference: {fileID: 0}
- target: {fileID: 1831729214724556, guid: 381e2888b079e4421a0e68dc701f62c8, type: 3}
propertyPath: m_Layer
value: 10
objectReference: {fileID: 0}
- target: {fileID: 4044909898802952, guid: 381e2888b079e4421a0e68dc701f62c8, type: 3}
propertyPath: m_LocalPosition.x
value: 0
......
......@@ -17,7 +17,7 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3fffffffbfffffffbfffffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 0
......
......@@ -26,11 +26,11 @@ TagManager:
-
-
- Wall
-
-
-
-
-
- Ground
- Food
- Player
- Competitor
- Boss
-
-
-
......
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