-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
213 changed files
with
88,302 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class Ball : MonoBehaviour { | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
var speed = GetComponent<Rigidbody>().velocity; | ||
//Debug.Log("speed: " + speed); | ||
|
||
//如果没有碰到上下边界,操作待扩展 | ||
if (transform.position.z > -6 && transform.position.z < 6) | ||
{ | ||
//transform.Translate(new Vector3(0, 0, speed.z)); | ||
} | ||
//碰到上下边界 | ||
else | ||
{ | ||
//碰到门,更改比分,重置球位置 | ||
if (transform.position.x > -1.5 && transform.position.x < 1.5) | ||
{ | ||
var score = GetComponent<Score>(); | ||
Debug.Log(score); | ||
|
||
if (transform.position.z > 0) | ||
score.HostWin(); | ||
else score.ClientWin(); | ||
|
||
transform.position = Vector3.zero; | ||
GetComponent<Rigidbody>().velocity = Vector3.zero; | ||
} | ||
//z轴速度反向 | ||
else | ||
{ | ||
speed.z = -speed.z; | ||
GetComponent<Rigidbody>().velocity = speed; | ||
Debug.Log("up down bound speed: " + speed); | ||
} | ||
} | ||
|
||
//如果没有碰到左右边界,操作待扩展 | ||
if (transform.position.x > -3.5 && transform.position.x < 3.5) | ||
{ | ||
//transform.Translate(new Vector3(speed.x, 0, 0)); | ||
} | ||
//碰到左右边界,x轴速度反向 | ||
else | ||
{ | ||
speed.x = -speed.x; | ||
GetComponent<Rigidbody>().velocity = speed; | ||
Debug.Log("left right bound speed:" + speed); | ||
} | ||
|
||
//速度衰减 | ||
//speed *= 0.999f; | ||
//GetComponent<Rigidbody>().velocity = speed; | ||
} | ||
|
||
void OnCollisionEnter(Collision collision) | ||
{ | ||
var hit = collision.gameObject; | ||
var hitPlayer = hit.GetComponent<PlayerMove>(); | ||
|
||
if (hitPlayer != null) | ||
{ | ||
var ballRigid = GetComponent<Rigidbody>(); | ||
Debug.Log("velocity: " + ballRigid.velocity); | ||
//适当加速 | ||
//ballRigid.velocity *= 2; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1001 &100100000 | ||
Prefab: | ||
m_ObjectHideFlags: 1 | ||
serializedVersion: 2 | ||
m_Modification: | ||
m_TransformParent: {fileID: 0} | ||
m_Modifications: [] | ||
m_RemovedComponents: [] | ||
m_ParentPrefab: {fileID: 0} | ||
m_RootGameObject: {fileID: 1287886601483940} | ||
m_IsPrefabParent: 1 | ||
--- !u!1 &1287886601483940 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
serializedVersion: 5 | ||
m_Component: | ||
- component: {fileID: 4987034104004498} | ||
- component: {fileID: 33418584989499016} | ||
- component: {fileID: 136493197950249934} | ||
- component: {fileID: 23391060051634234} | ||
- component: {fileID: 54063046954009296} | ||
- component: {fileID: 114689379933858800} | ||
- component: {fileID: 114191491928297890} | ||
- component: {fileID: 114144512500025642} | ||
- component: {fileID: 114073387051976146} | ||
- component: {fileID: 114064703167578504} | ||
m_Layer: 0 | ||
m_Name: Ball | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &4987034104004498 | ||
Transform: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} | ||
m_LocalPosition: {x: 0, y: 0.003, z: -2} | ||
m_LocalScale: {x: 0.6, y: 0.1, z: 0.6} | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!23 &23391060051634234 | ||
MeshRenderer: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Enabled: 1 | ||
m_CastShadows: 1 | ||
m_ReceiveShadows: 1 | ||
m_DynamicOccludee: 1 | ||
m_MotionVectors: 1 | ||
m_LightProbeUsage: 1 | ||
m_ReflectionProbeUsage: 1 | ||
m_Materials: | ||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} | ||
m_StaticBatchInfo: | ||
firstSubMesh: 0 | ||
subMeshCount: 0 | ||
m_StaticBatchRoot: {fileID: 0} | ||
m_ProbeAnchor: {fileID: 0} | ||
m_LightProbeVolumeOverride: {fileID: 0} | ||
m_ScaleInLightmap: 1 | ||
m_PreserveUVs: 1 | ||
m_IgnoreNormalsForChartDetection: 0 | ||
m_ImportantGI: 0 | ||
m_StitchLightmapSeams: 0 | ||
m_SelectedEditorRenderState: 3 | ||
m_MinimumChartSize: 4 | ||
m_AutoUVMaxDistance: 0.5 | ||
m_AutoUVMaxAngle: 89 | ||
m_LightmapParameters: {fileID: 0} | ||
m_SortingLayerID: 0 | ||
m_SortingLayer: 0 | ||
m_SortingOrder: 0 | ||
--- !u!33 &33418584989499016 | ||
MeshFilter: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} | ||
--- !u!54 &54063046954009296 | ||
Rigidbody: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
serializedVersion: 2 | ||
m_Mass: 1 | ||
m_Drag: 0 | ||
m_AngularDrag: 0.05 | ||
m_UseGravity: 0 | ||
m_IsKinematic: 0 | ||
m_Interpolate: 0 | ||
m_Constraints: 116 | ||
m_CollisionDetection: 0 | ||
--- !u!114 &114064703167578504 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 0c18ae29f6a8cea43941bddfd80a10e2, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
--- !u!114 &114073387051976146 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 533eca15eb0fe85478c939bb0c3c459a, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
score1: 0 | ||
score2: 0 | ||
game: 0 | ||
--- !u!114 &114144512500025642 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: db6e9107b23d6b947acd31eec83e8091, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
--- !u!114 &114191491928297890 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: -1768714887, guid: 870353891bb340e2b2a9c8707e7419ba, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
m_TransformSyncMode: 3 | ||
m_SendInterval: 0.1 | ||
m_SyncRotationAxis: 7 | ||
m_RotationSyncCompression: 0 | ||
m_SyncSpin: 0 | ||
m_MovementTheshold: 0.001 | ||
m_VelocityThreshold: 0.0001 | ||
m_SnapThreshold: 5 | ||
m_InterpolateRotation: 1 | ||
m_InterpolateMovement: 1 | ||
--- !u!114 &114689379933858800 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 372142912, guid: 870353891bb340e2b2a9c8707e7419ba, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
m_SceneId: | ||
m_Value: 0 | ||
m_AssetId: | ||
i0: 66 | ||
i1: 50 | ||
i2: 220 | ||
i3: 147 | ||
i4: 5 | ||
i5: 172 | ||
i6: 8 | ||
i7: 244 | ||
i8: 26 | ||
i9: 228 | ||
i10: 48 | ||
i11: 248 | ||
i12: 250 | ||
i13: 211 | ||
i14: 64 | ||
i15: 91 | ||
m_ServerOnly: 0 | ||
m_LocalPlayerAuthority: 0 | ||
--- !u!136 &136493197950249934 | ||
CapsuleCollider: | ||
m_ObjectHideFlags: 1 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 100100000} | ||
m_GameObject: {fileID: 1287886601483940} | ||
m_Material: {fileID: 0} | ||
m_IsTrigger: 0 | ||
m_Enabled: 1 | ||
m_Radius: 0.5 | ||
m_Height: 2 | ||
m_Direction: 1 | ||
m_Center: {x: 0, y: 0, z: 0} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!21 &2100000 | ||
Material: | ||
serializedVersion: 6 | ||
m_ObjectHideFlags: 0 | ||
m_PrefabParentObject: {fileID: 0} | ||
m_PrefabInternal: {fileID: 0} | ||
m_Name: Blue | ||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} | ||
m_ShaderKeywords: | ||
m_LightmapFlags: 4 | ||
m_EnableInstancingVariants: 0 | ||
m_DoubleSidedGI: 0 | ||
m_CustomRenderQueue: -1 | ||
stringTagMap: {} | ||
disabledShaderPasses: [] | ||
m_SavedProperties: | ||
serializedVersion: 3 | ||
m_TexEnvs: | ||
- _BumpMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DetailAlbedoMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DetailMask: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _DetailNormalMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _EmissionMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _MainTex: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _MetallicGlossMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _OcclusionMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
- _ParallaxMap: | ||
m_Texture: {fileID: 0} | ||
m_Scale: {x: 1, y: 1} | ||
m_Offset: {x: 0, y: 0} | ||
m_Floats: | ||
- _BumpScale: 1 | ||
- _Cutoff: 0.5 | ||
- _DetailNormalMapScale: 1 | ||
- _DstBlend: 0 | ||
- _GlossMapScale: 1 | ||
- _Glossiness: 0.5 | ||
- _GlossyReflections: 1 | ||
- _Metallic: 0 | ||
- _Mode: 0 | ||
- _OcclusionStrength: 1 | ||
- _Parallax: 0.02 | ||
- _SmoothnessTextureChannel: 0 | ||
- _SpecularHighlights: 1 | ||
- _SrcBlend: 1 | ||
- _UVSec: 0 | ||
- _ZWrite: 1 | ||
m_Colors: | ||
- _Color: {r: 0, g: 0, b: 1, a: 1} | ||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} |
Oops, something went wrong.