Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SteelBall
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanqing
SteelBall
Commits
3237868a
Commit
3237868a
authored
Jan 25, 2021
by
wanqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关卡优化
parent
593df03a
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
7681 additions
and
2628 deletions
+7681
-2628
.suo
SteelBall/.vs/SteelBall/v16/.suo
+0
-0
Assembly-CSharp.csproj
SteelBall/Assembly-CSharp.csproj
+1
-0
DemoScenes.unity
SteelBall/Assets/0A1_Scenes/DemoScenes.unity
+7
-0
BattleCtrl.cs
SteelBall/Assets/0A2_Scripts/Battle/BattleCtrl.cs
+66
-32
SixLevelCollision.cs
.../Assets/0A2_Scripts/Battle/Collision/SixLevelCollision.cs
+66
-0
SixLevelCollision.cs.meta
...ts/0A2_Scripts/Battle/Collision/SixLevelCollision.cs.meta
+11
-0
SixthLevelTrigger.cs
...ll/Assets/0A2_Scripts/Battle/Trigger/SixthLevelTrigger.cs
+14
-2
ChainHandle.cs
SteelBall/Assets/0A2_Scripts/Battle/View/ChainHandle.cs
+35
-10
CubeChild.prefab
SteelBall/Assets/0A3_Prefabs/CubeChild.prefab
+7136
-0
CubeChild.prefab.meta
SteelBall/Assets/0A3_Prefabs/CubeChild.prefab.meta
+7
-0
Level06.prefab
SteelBall/Assets/Res/Prefabs/Levels/Level06.prefab
+334
-2580
BattleConfig.asset
SteelBall/Assets/Resources/BattleConfig.asset
+4
-4
No files found.
SteelBall/.vs/SteelBall/v16/.suo
View file @
3237868a
No preview for this file type
SteelBall/Assembly-CSharp.csproj
View file @
3237868a
...
...
@@ -65,6 +65,7 @@
<ItemGroup>
<Compile
Include=
"Assets\0A2_Scripts\Battle\BattleCtrl.cs"
/>
<Compile
Include=
"Assets\0A2_Scripts\Battle\Collision\GroundCollision.cs"
/>
<Compile
Include=
"Assets\0A2_Scripts\Battle\Collision\SixLevelCollision.cs"
/>
<Compile
Include=
"Assets\0A2_Scripts\Battle\Collision\ThirdLevelBoxCollision.cs"
/>
<Compile
Include=
"Assets\0A2_Scripts\Battle\Collision\ThirdLevelBoxTarget.cs"
/>
<Compile
Include=
"Assets\0A2_Scripts\Battle\Collision\WallCollsionX.cs"
/>
...
...
SteelBall/Assets/0A1_Scenes/DemoScenes.unity
View file @
3237868a
...
...
@@ -218,6 +218,8 @@ MonoBehaviour:
m_EditorClassIdentifier
:
battleUI
:
{
fileID
:
6020807041659695165
}
m_levelManager
:
{
fileID
:
186647396
}
m_cubeChildObj
:
{
fileID
:
3999034254530585921
,
guid
:
2fa734ecf3700b14ebb662761f808de2
,
type
:
3
}
---
!u!1
&1139781965
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -453,6 +455,11 @@ PrefabInstance:
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
-
target
:
{
fileID
:
6064464676810081128
,
guid
:
919382978f5e2684ba83e6daf6491458
,
type
:
3
}
propertyPath
:
m_IsActive
value
:
1
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
6064464677632144689
,
guid
:
919382978f5e2684ba83e6daf6491458
,
type
:
3
}
propertyPath
:
m_Name
...
...
SteelBall/Assets/0A2_Scripts/Battle/BattleCtrl.cs
View file @
3237868a
...
...
@@ -41,12 +41,29 @@ public class BattleCtrl : MonoBehaviour
static
BattleCtrl
_Instance
;
public
static
BattleCtrl
instance
=>
_Instance
;
//缓存cube处理
public
GameObject
m_cubeChildObj
;
Stack
<
GameObject
>
m_cubeObjStack
=
new
Stack
<
GameObject
>();
List
<
GameObject
>
m_cubeObjList
=
new
List
<
GameObject
>();
private
List
<
Transform
>
m_cubeChildTransList
=
new
List
<
Transform
>();
private
void
Awake
()
{
_Instance
=
this
;
//Assert.IsNotNull(battleUI, "battleUI is null");
InitServices
();
Init
();
for
(
int
i
=
0
;
i
<
m_cubeChildObj
.
transform
.
childCount
;
i
++)
{
m_cubeChildTransList
.
Add
(
m_cubeChildObj
.
transform
.
GetChild
(
i
));
}
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
GameObject
varGo
=
GameObject
.
Instantiate
(
m_cubeChildObj
);
varGo
.
SetActive
(
false
);
m_cubeObjStack
.
Push
(
varGo
);
m_cubeObjList
.
Add
(
varGo
);
}
//TinySauce.OnGameStarted();
}
...
...
@@ -160,38 +177,48 @@ public class BattleCtrl : MonoBehaviour
{
m_levelManager
.
LoadLevel
(
levelIndex
);
}
/// <summary>
/// 加载回start场景
/// </summary>
//public void LoadStartScene()
//{
// Camera.main.gameObject.SetActive(false);
// sceneLoad.LoadSceneAsync("StartScene");
//}
/// <summary>
/// 显示提示可操作的ui
/// </summary>
//public void ShopTapToPlay()
//{
// battleUI.ShowTapToPlay();
//}
// void Update()
// {
// if (!inited)
// return;
// sceneLoad.OnUpdate();
//#if UNITY_EDITOR
// if (Input.GetKeyDown(KeyCode.S))//停止pien的ai
// {
// GameServices.debugService.stopPienAi = !GameServices.debugService.stopPienAi;
// }
//#endif
// }
public
GameObject
GetFromPool
(
Transform
parent
)
{
GameObject
varGo
=
null
;
if
(
m_cubeObjStack
.
Count
>
0
)
{
varGo
=
m_cubeObjStack
.
Pop
();
}
else
{
varGo
=
GameObject
.
Instantiate
(
m_cubeChildObj
);
m_cubeObjList
.
Add
(
varGo
);
}
if
(
varGo
)
{
varGo
.
transform
.
SetParent
(
parent
,
false
);
varGo
.
transform
.
localPosition
=
Vector3
.
zero
;
for
(
int
i
=
0
;
i
<
varGo
.
transform
.
childCount
;
i
++)
{
varGo
.
transform
.
GetChild
(
i
).
GetComponent
<
Rigidbody
>().
mass
=
0.1f
;
//varGo.transform.GetChild(i).GetComponent<Rigidbody>().AddForce(Vector3.down * 20000000.0f, ForceMode.Force);
}
varGo
.
SetActive
(
true
);
}
return
varGo
;
}
public
void
BackToPool
(
GameObject
go
)
{
if
(
go
)
{
go
.
transform
.
SetParent
(
null
);
for
(
int
i
=
0
;
i
<
go
.
transform
.
childCount
;
i
++)
{
go
.
transform
.
GetChild
(
i
).
localPosition
=
m_cubeChildTransList
[
i
].
localPosition
;
go
.
transform
.
GetChild
(
i
).
localRotation
=
Quaternion
.
identity
;
}
go
.
SetActive
(
false
);
if
(
m_cubeObjStack
!=
null
)
{
m_cubeObjStack
.
Push
(
go
);
}
}
}
private
void
OnDestroy
()
{
...
...
@@ -203,6 +230,13 @@ public class BattleCtrl : MonoBehaviour
//m_levelManager.curLevel.OnDispose();
//m_levelManager = null;
//TinySauce.OnGameFinished(0);
for
(
int
i
=
0
;
i
<
m_cubeObjList
.
Count
;
i
++)
{
GameObject
.
Destroy
(
m_cubeObjList
[
i
]);
}
m_cubeObjList
.
Clear
();
m_cubeObjList
=
null
;
m_cubeObjStack
=
null
;
}
}
SteelBall/Assets/0A2_Scripts/Battle/Collision/SixLevelCollision.cs
0 → 100644
View file @
3237868a
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
SixLevelCollision
:
MonoBehaviour
{
public
SixthLevelTrigger
m_sixLevel
;
private
bool
m_bCollider
=
true
;
private
MeshRenderer
m_render
;
private
BoxCollider
m_collider
;
private
GameObject
m_cacheObj
;
// Start is called before the first frame update
void
Start
()
{
m_render
=
GetComponent
<
MeshRenderer
>();
m_collider
=
GetComponent
<
BoxCollider
>();
//for (int i = 0; i < 4; i++)
//{
// for (int j = 0; j < 4; j++)
// {
// for(int k = 0;k < 4;k++)
// {
// GameObject go = GameObject.Instantiate(m_cube);
// go.transform.localPosition = new Vector3(j * 0.25f - 0.375f, i * 0.25f - 0.375f, k * 0.25f - 0.375f);
// go.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
// go.transform.SetParent(transform, false);
// }
// }
//}
}
private
void
OnCollisionEnter
(
Collision
other
)
{
if
(
other
.
collider
.
gameObject
.
CompareTag
(
"Ball"
)
&&
m_bCollider
)
{
m_bCollider
=
false
;
m_render
.
enabled
=
false
;
m_collider
.
enabled
=
false
;
m_cacheObj
=
BattleCtrl
.
instance
.
GetFromPool
(
transform
);
if
(
m_sixLevel
)
{
m_sixLevel
.
SetCollision
();
}
GameServices
.
timerServices
.
Push
(
this
,
2.0f
,
delegate
{
if
(
m_cacheObj
)
{
BattleCtrl
.
instance
.
BackToPool
(
m_cacheObj
);
}
});
}
}
// Update is called once per frame
void
Update
()
{
}
private
void
OnDestroy
()
{
if
(
m_cacheObj
)
{
BattleCtrl
.
instance
.
BackToPool
(
m_cacheObj
);
}
}
}
SteelBall/Assets/0A2_Scripts/Battle/Collision/SixLevelCollision.cs.meta
0 → 100644
View file @
3237868a
fileFormatVersion: 2
guid: e2dd751f22d3dc941ac55948ef3ef129
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
SteelBall/Assets/0A2_Scripts/Battle/Trigger/SixthLevelTrigger.cs
View file @
3237868a
...
...
@@ -57,7 +57,7 @@ public class SixthLevelTrigger : MonoBehaviour
//}
//第二种方案
public
Transform
m_parent
;
public
Transform
m_cubeParent
;
public
BoxCollider
[]
m_boxCollider
;
public
Transform
m_player
;
public
GameObject
[]
m_obstract
;
private
Rigidbody
[]
m_rigidArray
;
...
...
@@ -71,6 +71,7 @@ public class SixthLevelTrigger : MonoBehaviour
private
Rigidbody
m_playerRigid
;
private
Animator
m_animator
;
private
Transform
m_topTrans
;
private
int
m_index
=
0
;
private
void
Awake
()
{
m_rigidArray
=
m_parent
.
GetComponentsInChildren
<
Rigidbody
>();
...
...
@@ -106,9 +107,20 @@ public class SixthLevelTrigger : MonoBehaviour
}
}
}
public
void
SetCollision
()
{
m_index
=
0
;
for
(
int
i
=
0
;
i
<
m_boxCollider
.
Length
;
i
++)
{
if
(!
m_boxCollider
[
i
].
enabled
)
{
m_index
++;
}
}
}
private
void
Update
()
{
if
(
m_
cubeParent
.
childCount
<=
1
&&
m_bControl
)
if
(
m_
bControl
&&
m_index
>=
3
)
{
m_bControl
=
false
;
for
(
int
i
=
0
;
i
<
m_rigidArray
.
Length
;
i
++)
...
...
SteelBall/Assets/0A2_Scripts/Battle/View/ChainHandle.cs
View file @
3237868a
...
...
@@ -13,22 +13,24 @@ public class ChainHandle : MonoBehaviour
private
Vector2
m_StartPos
;
private
Vector2
m_DragPos
;
private
Rigidbody
m_rigidBody
;
//自身body
private
float
m_topColliderPosY
;
//Y位置
// Start is called before the first frame update
private
void
Awake
()
{
m_rigidBody
=
gameObject
.
GetComponent
<
Rigidbody
>();
m_topColliderPosY
=
transform
.
position
.
y
;
//Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.Legacy;
}
private
void
On
TriggerEnter
(
Collider
other
)
private
void
On
CollisionEnter
(
Collision
other
)
{
if
(
other
.
gameObject
.
CompareTag
(
"Ball"
))
if
(
other
.
collider
.
gameObject
.
CompareTag
(
"Ball"
))
{
m_rigidBody
.
isKinematic
=
true
;
}
}
private
void
On
TriggerExit
(
Collider
other
)
private
void
On
CollisionExit
(
Collision
other
)
{
if
(
other
.
gameObject
.
CompareTag
(
"Ball"
))
if
(
other
.
collider
.
gameObject
.
CompareTag
(
"Ball"
))
{
m_rigidBody
.
isKinematic
=
false
;
}
...
...
@@ -43,6 +45,15 @@ public class ChainHandle : MonoBehaviour
SetJoyStickDirectTrans
(
transform
);
m_thumbRT
=
GameServices
.
inputService
.
joyStick
.
thumb
;
m_steelBallRigidBody
.
mass
=
GameServices
.
configService
.
playerConfig
.
SteelBallMass
;
//第六关特殊处理
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelSixIndex
)
{
GameServices
.
inputService
.
joyStick
.
activated
=
false
;
}
else
{
GameServices
.
inputService
.
joyStick
.
activated
=
true
;
}
}
void
onSteelBallAddMassBtn
()
{
...
...
@@ -88,26 +99,40 @@ public class ChainHandle : MonoBehaviour
//移动
void
OnMove
(
Vector3
dir
)
{
if
(!
BattleCtrl
.
instance
.
isStartBattle
)
{
return
;
}
//第五关特殊处理
//if(BattleCtrl.instance.levelManager.CurLevelIndex != LevelEnum.levelFiveIndex)
{
m_rigidBody
.
drag
=
10
;
m_rigidBody
.
angularDrag
=
10
;
}
float
varParamDis
=
Screen
.
width
*
GameServices
.
configService
.
playerConfig
.
ClawMoveSpeed
/
2
;
//参数距离
Vector3
varPos
=
transform
.
position
;
//向左滑
if
(
dir
.
x
>
0
)
{
m_mouseDir
=
LevelEnum
.
MouseDirEnum
.
Left
;
varPos
.
x
-=
dir
.
x
/
varParamDis
*
GameServices
.
configService
.
playerConfig
.
xDirMaxDis
;
}
//向右滑
if
(
dir
.
x
<
0
)
{
m_mouseDir
=
LevelEnum
.
MouseDirEnum
.
Right
;
varPos
.
x
+=
dir
.
x
/
varParamDis
*
GameServices
.
configService
.
playerConfig
.
xDirMinDis
;
}
//向上滑
if
(
dir
.
y
<
0
)
{
m_mouseDir
=
LevelEnum
.
MouseDirEnum
.
Up
;
varPos
.
z
+=
dir
.
y
/
varParamDis
*
GameServices
.
configService
.
playerConfig
.
yDirMinDis
;
}
//向下滑
if
(
dir
.
y
>
0
)
{
m_mouseDir
=
LevelEnum
.
MouseDirEnum
.
Down
;
varPos
.
z
-=
dir
.
y
/
varParamDis
*
GameServices
.
configService
.
playerConfig
.
yDirMaxDis
;
}
varPos
.
y
=
m_topColliderPosY
;
transform
.
position
=
varPos
;
}
private
void
OnDestroy
()
{
...
...
@@ -153,8 +178,8 @@ public class ChainHandle : MonoBehaviour
float
varMinY
=
GameServices
.
configService
.
playerConfig
.
yDirMinDis
;
float
varMaxY
=
GameServices
.
configService
.
playerConfig
.
yDirMaxDis
;
transform
.
position
=
new
Vector3
(
Mathf
.
Clamp
(
transform
.
position
.
x
,
varMinX
,
varMaxX
),
Mathf
.
Clamp
(
transform
.
position
.
y
,
varMinY
,
varMaxY
)
,
0
);
m_topColliderPosY
,
Mathf
.
Clamp
(
transform
.
position
.
z
,
varMinY
,
varMaxY
)
);
}
}
SteelBall/Assets/0A3_Prefabs/CubeChild.prefab
0 → 100644
View file @
3237868a
This diff is collapsed.
Click to expand it.
SteelBall/Assets/0A3_Prefabs/CubeChild.prefab.meta
0 → 100644
View file @
3237868a
fileFormatVersion: 2
guid: 2fa734ecf3700b14ebb662761f808de2
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
SteelBall/Assets/Res/Prefabs/Levels/Level06.prefab
View file @
3237868a
This diff is collapsed.
Click to expand it.
SteelBall/Assets/Resources/BattleConfig.asset
View file @
3237868a
...
...
@@ -14,10 +14,10 @@ MonoBehaviour:
m_EditorClassIdentifier
:
playerConfig
:
moveSpeed
:
1
xDirMinDis
:
-
3.
5
xDirMaxDis
:
4
yDirMinDis
:
0.5
yDirMaxDis
:
12.
4
xDirMinDis
:
-5
xDirMaxDis
:
3
yDirMinDis
:
-3
yDirMaxDis
:
4
clawMaxAngle
:
34
clawRotateSpeed
:
50
ropeReduceSpeed
:
2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment