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
8a4f80ac
Commit
8a4f80ac
authored
Jan 26, 2021
by
wanqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关卡逻辑修改
parent
8a2f5732
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1250 additions
and
336 deletions
+1250
-336
.suo
SteelBall/.vs/SteelBall/v16/.suo
+0
-0
Assembly-CSharp.csproj
SteelBall/Assembly-CSharp.csproj
+1
-0
SixLevelPlayerCollision.cs
...s/0A2_Scripts/Battle/Collision/SixLevelPlayerCollision.cs
+54
-0
SixLevelPlayerCollision.cs.meta
..._Scripts/Battle/Collision/SixLevelPlayerCollision.cs.meta
+11
-0
SixthLevelTrigger.cs
...ll/Assets/0A2_Scripts/Battle/Trigger/SixthLevelTrigger.cs
+34
-34
BattleUI.cs
SteelBall/Assets/0A2_Scripts/Battle/UI/BattleUI.cs
+2
-0
ChainHandle.cs
SteelBall/Assets/0A2_Scripts/Battle/View/ChainHandle.cs
+13
-4
Chain 1.asset
...mples/RopeAndRod/SampleResources/Blueprints/Chain 1.asset
+523
-237
Level06.prefab
SteelBall/Assets/Res/Prefabs/Levels/Level06.prefab
+612
-61
No files found.
SteelBall/.vs/SteelBall/v16/.suo
View file @
8a4f80ac
No preview for this file type
SteelBall/Assembly-CSharp.csproj
View file @
8a4f80ac
...
...
@@ -66,6 +66,7 @@
<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\SixLevelPlayerCollision.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/0A2_Scripts/Battle/Collision/SixLevelPlayerCollision.cs
0 → 100644
View file @
8a4f80ac
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
SixLevelPlayerCollision
:
MonoBehaviour
{
public
Transform
m_topTrans
;
private
bool
m_bCollider
=
true
;
private
bool
m_bControlWin
=
true
;
private
Animator
m_animator
;
private
float
m_moveSpeed
=
1.0f
;
private
float
m_minHeight
=
-
2.0f
;
private
float
m_targetX
=
1.06f
;
private
float
m_tartgetY
=
2.0f
;
private
Rigidbody
m_playerRigid
;
private
void
Awake
()
{
m_animator
=
GetComponent
<
Animator
>();
m_playerRigid
=
GetComponent
<
Rigidbody
>();
}
private
void
OnCollisionEnter
(
Collision
other
)
{
if
(
other
.
collider
.
gameObject
.
CompareTag
(
"Ball"
)
&&
m_bCollider
)
{
m_bCollider
=
false
;
BattleCtrl
.
instance
.
OnBattleFail
();
}
}
private
void
Update
()
{
if
(
BattleCtrl
.
instance
.
isEndBattle
)
{
return
;
}
if
(
m_topTrans
.
localPosition
.
y
<=
2.0f
&&
m_bControlWin
)
{
m_animator
.
Play
(
"Run"
);
if
(
transform
.
position
.
x
<
m_targetX
)
{
transform
.
Translate
(
Vector3
.
right
*
Time
.
deltaTime
*
m_moveSpeed
,
Space
.
World
);
}
else
{
m_playerRigid
.
isKinematic
=
true
;
transform
.
Translate
(-
Vector3
.
up
*
Time
.
deltaTime
*
m_moveSpeed
,
Space
.
World
);
if
(
transform
.
position
.
y
<=
m_tartgetY
)
{
m_bControlWin
=
false
;
BattleCtrl
.
instance
.
OnBattleWin
();
}
}
}
}
}
SteelBall/Assets/0A2_Scripts/Battle/Collision/SixLevelPlayerCollision.cs.meta
0 → 100644
View file @
8a4f80ac
fileFormatVersion: 2
guid: af26f1f0a69f83f4a8c856f8a695a060
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
SteelBall/Assets/0A2_Scripts/Battle/Trigger/SixthLevelTrigger.cs
View file @
8a4f80ac
...
...
@@ -76,19 +76,19 @@ public class SixthLevelTrigger : MonoBehaviour
private
int
m_index
=
0
;
private
void
Awake
()
{
m_rigidArray
=
m_parent
.
GetComponentsInChildren
<
Rigidbody
>();
m_boxCollider
=
m_targetBoxParent
.
GetComponentsInChildren
<
BoxCollider
>();
for
(
int
i
=
0
;
i
<
m_rigidArray
.
Length
;
i
++)
{
if
(
m_rigidArray
[
i
].
gameObject
.
name
==
"Cube (54)"
)
{
m_topTrans
=
m_rigidArray
[
i
].
transform
;
m_topRigidBody
=
m_rigidArray
[
i
];
break
;
}
}
m_playerRigid
=
m_player
.
GetComponent
<
Rigidbody
>();
m_animator
=
m_player
.
GetComponent
<
Animator
>();
//
m_rigidArray = m_parent.GetComponentsInChildren<Rigidbody>();
//
m_boxCollider = m_targetBoxParent.GetComponentsInChildren<BoxCollider>();
//
for (int i = 0; i < m_rigidArray.Length; i++)
//
{
//
if (m_rigidArray[i].gameObject.name == "Cube (54)")
//
{
//
m_topTrans = m_rigidArray[i].transform;
//
m_topRigidBody = m_rigidArray[i];
//
break;
//
}
//
}
//
m_playerRigid = m_player.GetComponent<Rigidbody>();
//
m_animator = m_player.GetComponent<Animator>();
//GameServices.timerServices.Push(this, 5, delegate
//{
// for (int i = 0; i < m_rigidArray.Length; i++)
...
...
@@ -107,38 +107,38 @@ public class SixthLevelTrigger : MonoBehaviour
{
if
(
m_rigidArray
[
i
])
{
m_rigidArray
[
i
].
isKinematic
=
true
;
//
m_rigidArray[i].isKinematic = true;
}
}
}
public
void
SetCollision
()
{
m_index
=
0
;
for
(
int
i
=
0
;
i
<
m_boxCollider
.
Length
;
i
++)
{
if
(!
m_boxCollider
[
i
].
enabled
)
{
m_index
++;
}
}
//
m_index = 0;
//
for (int i = 0; i < m_boxCollider.Length; i++)
//
{
//
if (!m_boxCollider[i].enabled)
//
{
//
m_index++;
//
}
//
}
}
private
void
Update
()
{
if
(
m_bControl
&&
m_index
>=
10
)
{
m_bControl
=
false
;
for
(
int
i
=
0
;
i
<
m_rigidArray
.
Length
;
i
++)
{
if
(
m_rigidArray
[
i
])
{
m_rigidArray
[
i
].
isKinematic
=
false
;
}
}
for
(
int
i
=
0
;
i
<
m_obstract
.
Length
;
i
++)
{
m_obstract
[
i
].
SetActive
(
false
);
}
m_topRigidBody
.
AddForce
(
Vector3
.
down
*
1000
,
ForceMode
.
Impulse
);
//
for (int i = 0; i < m_rigidArray.Length; i++)
//
{
//
if (m_rigidArray[i])
//
{
//
m_rigidArray[i].isKinematic = false;
//
}
//
}
//
for (int i = 0; i < m_obstract.Length; i++)
//
{
//
m_obstract[i].SetActive(false);
//
}
//
m_topRigidBody.AddForce(Vector3.down * 1000, ForceMode.Impulse);
}
if
(
m_topTrans
.
localPosition
.
y
<=
2.0f
&&
m_bControlWin
)
{
...
...
SteelBall/Assets/0A2_Scripts/Battle/UI/BattleUI.cs
View file @
8a4f80ac
...
...
@@ -99,6 +99,7 @@ public class BattleUI : MonoBehaviour
//选择关卡
void
SelectLevel
()
{
SetSymbolPos
(
0
,
0
);
m_selectLevelObj
.
SetActive
(
true
);
}
//开始游戏
...
...
@@ -260,6 +261,7 @@ public class BattleUI : MonoBehaviour
m_recordRayFireList
.
Add
(
varRayFire
.
transform
.
GetChild
(
i
).
gameObject
);
}
}
SetSymbolPos
(
0
,
0
);
}
//设置战斗UI状态
public
void
SetBattleObjState
(
bool
bool_
)
...
...
SteelBall/Assets/0A2_Scripts/Battle/View/ChainHandle.cs
View file @
8a4f80ac
...
...
@@ -2,9 +2,11 @@
using
System.Collections.Generic
;
using
UnityEngine
;
//using UnityEditor;
using
Obi
;
public
class
ChainHandle
:
MonoBehaviour
{
public
ObiSolver
m_solver
;
public
Rigidbody
m_steelBallRigidBody
;
//铁球
public
Transform
SteelBallTrans
=>
m_steelBallRigidBody
.
transform
;
private
RectTransform
m_thumbRT
;
//摇杆
...
...
@@ -14,7 +16,7 @@ public class ChainHandle : MonoBehaviour
private
Vector2
m_DragPos
;
private
Rigidbody
m_rigidBody
;
//自身body
private
float
m_topColliderPosY
;
//Y位置
private
Vector3
m_maxHeightBallPos
=
new
Vector3
(
2.075f
,
3.0f
,
-
3.1
f
);
//铁球最大高度
private
Vector3
m_maxHeightBallPos
=
new
Vector3
(
2.075f
,
3.0f
,
-
6.5
f
);
//铁球最大高度
private
Transform
m_parentTrans
;
//父节点
// Start is called before the first frame update
private
void
Awake
()
...
...
@@ -205,22 +207,29 @@ public class ChainHandle : MonoBehaviour
{
if
(
hit
.
collider
.
gameObject
.
CompareTag
(
"Target"
))
{
//m_solver.simulateWhenInvisible = false;
//十字架位置
float
varX
=
(
Input
.
mousePosition
.
x
-
Screen
.
width
/
2f
)
/
(
Screen
.
width
/
GlobalConfig
.
NormalWidth
);
float
varY
=
(
Input
.
mousePosition
.
y
-
Screen
.
height
/
2f
)
/
(
Screen
.
width
/
GlobalConfig
.
NormalWidth
);
BattleCtrl
.
instance
.
battleUI
.
SetSymbolPos
(
varX
,
varY
);
//设置铁球位置
m_steelBallRigidBody
.
isKinematic
=
true
;
m_steelBallRigidBody
.
Sleep
();
m_steelBallRigidBody
.
transform
.
localPosition
=
m_maxHeightBallPos
;
m_steelBallRigidBody
.
transform
.
localRotation
=
Quaternion
.
identity
;
Vector3
varVec3
=
m_parentTrans
.
position
;
varVec3
.
x
=
hit
.
point
.
x
-
m_maxHeightBallPos
.
x
;
varVec3
.
y
=
hit
.
point
.
y
;
varVec3
.
y
=
hit
.
point
.
y
+
6.5f
;
m_parentTrans
.
position
=
varVec3
;
GameServices
.
timerServices
.
Push
(
this
,
1
,
delegate
{
m_steelBallRigidBody
.
isKinematic
=
false
;
// if(m_solver)
// {
// m_solver.simulateWhenInvisible = true;
// }
if
(
m_steelBallRigidBody
)
{
m_steelBallRigidBody
.
isKinematic
=
false
;
}
});
}
}
...
...
SteelBall/Assets/0E1_Plugins/Obi/Samples/RopeAndRod/SampleResources/Blueprints/Chain 1.asset
View file @
8a4f80ac
This diff is collapsed.
Click to expand it.
SteelBall/Assets/Res/Prefabs/Levels/Level06.prefab
View file @
8a4f80ac
This diff is collapsed.
Click to expand it.
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