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
90cbbd48
Commit
90cbbd48
authored
Jan 14, 2021
by
wanqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
第五关逻辑优化
parent
8ae614a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
163 additions
and
61 deletions
+163
-61
FifthLevelTrigger.cs
...ll/Assets/0A2_Scripts/Battle/Trigger/FifthLevelTrigger.cs
+80
-53
TargetTrigger.cs
SteelBall/Assets/0A2_Scripts/Battle/Trigger/TargetTrigger.cs
+9
-1
Level05.prefab
SteelBall/Assets/Res/Prefabs/Levels/Level05.prefab
+74
-7
No files found.
SteelBall/Assets/0A2_Scripts/Battle/Trigger/FifthLevelTrigger.cs
View file @
90cbbd48
...
...
@@ -5,65 +5,92 @@ using Obi;
public
class
FifthLevelTrigger
:
MonoBehaviour
{
//public Transform m_topTrans;
//private Rigidbody[] m_rigidBody;
//private bool m_bControl = true;
public
Transform
m_mousePosTrans
;
public
float
m_speed
=
1.0f
;
private
bool
m_bEnterGround
=
true
;
private
bool
m_bEnterSuccessTarget
=
false
;
private
Rigidbody
m_mouseRigidBody
;
private
Vector3
m_DefaultPos
=
new
Vector3
(
2.18f
,
1.61f
,-
1.13f
);
private
Vector3
m_dirPos
=
new
Vector3
(
1.19f
,
0
,
-
2.11f
);
//
//
public Transform m_topTrans;
//
//
private Rigidbody[] m_rigidBody;
//
//
private bool m_bControl = true;
//
public Transform m_mousePosTrans;
//
public float m_speed = 1.0f;
//
private bool m_bEnterGround = true;
//
private bool m_bEnterSuccessTarget = false;
//
private Rigidbody m_mouseRigidBody;
//
private Vector3 m_DefaultPos = new Vector3(2.18f,1.61f,-1.13f);
//
private Vector3 m_dirPos = new Vector3(1.19f, 0, -2.11f);
private
void
Start
()
{
m_mouseRigidBody
=
m_mousePosTrans
.
gameObject
.
GetComponent
<
Rigidbody
>();
BattleCtrl
.
instance
.
levelManager
.
curLevel
.
chainRopeView
.
onBalloonEnterTarget
+=
onBalloonEnterTarget
;
BattleCtrl
.
instance
.
levelManager
.
curLevel
.
chainRopeView
.
onBalloonEnterGround
+=
onBalloonEnterGround
;
BattleCtrl
.
instance
.
levelManager
.
curLevel
.
chainRopeView
.
onBalloonEnterSuccessTarget
+=
onBalloonEnterSuccessTarget
;
//m_rigidBody = gameObject.GetComponentsInChildren<Rigidbody>();
}
void
onBalloonEnterTarget
()
{
m_bEnterGround
=
false
;
}
void
onBalloonEnterGround
()
{
m_bEnterGround
=
true
;
}
void
onBalloonEnterSuccessTarget
()
{
m_bEnterSuccessTarget
=
true
;
}
// Update is called once per frame
void
Update
()
//private void Start()
//{
// m_mouseRigidBody = m_mousePosTrans.gameObject.GetComponent<Rigidbody>();
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterTarget += onBalloonEnterTarget;
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterGround += onBalloonEnterGround;
// BattleCtrl.instance.levelManager.curLevel.chainRopeView.onBalloonEnterSuccessTarget += onBalloonEnterSuccessTarget;
// //m_rigidBody = gameObject.GetComponentsInChildren<Rigidbody>();
//}
//void onBalloonEnterTarget()
//{
// m_bEnterGround = false;
//}
//void onBalloonEnterGround()
//{
// m_bEnterGround = true;
//}
//void onBalloonEnterSuccessTarget()
//{
// m_bEnterSuccessTarget = true;
//}
//// Update is called once per frame
//void Update()
//{
// //if(m_bControl)
// //{
// // if(m_topTrans.position.y < 6)
// // {
// // m_bControl = false;
// // BattleCtrl.instance.OnBattleWin();
// // }
// //}
// if(m_bEnterGround)
// {
// transform.Translate(Vector3.up * Time.deltaTime * m_speed, Space.World);
// }
// if(m_bEnterSuccessTarget)
// {
// m_bEnterSuccessTarget = false;
// m_mouseRigidBody.isKinematic = true;
// m_mousePosTrans.localPosition = m_DefaultPos;
// }
// else
// {
// if(m_mouseRigidBody.isKinematic)
// {
// //transform.Translate(Vector3.up * Time.deltaTime * m_speed, Space.World);
// transform.localPosition = Vector3.Lerp(transform.localPosition, m_dirPos, 0.03f);
// transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.identity, 0.03f);
// }
// }
//}
public
Transform
m_targetTrans
;
public
Transform
m_buildTrans
;
public
Transform
m_buttonTrans
;
public
float
m_speed
=
1.0f
;
private
bool
m_bControl
=
true
;
protected
virtual
void
OnTriggerEnter
(
Collider
collider
)
{
//if(m_bControl)
//{
// if(m_topTrans.position.y < 6)
// {
// m_bControl = false;
// BattleCtrl.instance.OnBattleWin();
// }
//}
if
(
m_bEnterGround
)
{
transform
.
Translate
(
Vector3
.
up
*
Time
.
deltaTime
*
m_speed
,
Space
.
World
);
}
if
(
m_bEnterSuccessTarget
)
if
(
collider
.
gameObject
.
CompareTag
(
"Player"
)
&&
m_bControl
)
{
m_bEnterSuccessTarget
=
false
;
m_mouseRigidBody
.
isKinematic
=
true
;
m_mousePosTrans
.
localPosition
=
m_DefaultPos
;
m_bControl
=
false
;
}
else
}
private
void
Update
()
{
if
(
m_buildTrans
&&
m_targetTrans
&&
m_buttonTrans
&&
!
m_bControl
)
{
if
(
m_mouseRigidBody
.
isKinematic
)
if
(
m_buttonTrans
.
localPosition
.
y
>=
0.0f
)
{
m_buttonTrans
.
Translate
(-
Vector3
.
up
*
Time
.
deltaTime
*
m_speed
,
Space
.
World
);
}
if
(
m_buildTrans
.
localPosition
.
y
<=
10.1f
)
{
//transform.Translate(Vector3.up * Time.deltaTime * m_speed, Space.World);
transform
.
localPosition
=
Vector3
.
Lerp
(
transform
.
localPosition
,
m_dirPos
,
0.03f
);
transform
.
rotation
=
Quaternion
.
Slerp
(
transform
.
rotation
,
Quaternion
.
identity
,
0.03f
);
m_buildTrans
.
Translate
(
Vector3
.
up
*
Time
.
deltaTime
*
m_speed
,
Space
.
World
);
m_targetTrans
.
Translate
(
Vector3
.
up
*
Time
.
deltaTime
*
m_speed
,
Space
.
World
);
}
}
}
...
...
SteelBall/Assets/0A2_Scripts/Battle/Trigger/TargetTrigger.cs
View file @
90cbbd48
...
...
@@ -5,6 +5,7 @@ using UnityEngine;
public
class
TargetTrigger
:
MonoBehaviour
{
private
Vector3
m_pos
=
new
Vector3
(-
1.61f
,
0.22f
,
0
);
private
Vector3
m_posLevelFive
=
new
Vector3
(-
1.61f
,
10.24f
,
0
);
private
Quaternion
m_rotation
=
Quaternion
.
identity
;
private
bool
m_bControl
=
true
;
private
Transform
m_targetTrans
;
...
...
@@ -33,7 +34,14 @@ public class TargetTrigger : MonoBehaviour
{
if
(!
m_bControl
&&
m_targetTrans
)
{
m_targetTrans
.
localPosition
=
Vector3
.
Lerp
(
m_targetTrans
.
localPosition
,
m_pos
,
0.03f
);
if
(
BattleCtrl
.
instance
.
levelManager
.
CurLevelIndex
==
LevelEnum
.
levelFiveIndex
)
{
m_targetTrans
.
localPosition
=
Vector3
.
Lerp
(
m_targetTrans
.
localPosition
,
m_posLevelFive
,
0.03f
);
}
else
{
m_targetTrans
.
localPosition
=
Vector3
.
Lerp
(
m_targetTrans
.
localPosition
,
m_pos
,
0.03f
);
}
}
}
}
SteelBall/Assets/Res/Prefabs/Levels/Level05.prefab
View file @
90cbbd48
...
...
@@ -4349,6 +4349,7 @@ Transform:
m_Children
:
-
{
fileID
:
6757988877416697573
}
-
{
fileID
:
1871549070046122665
}
-
{
fileID
:
7319091445216978047
}
m_Father
:
{
fileID
:
4040573735186831815
}
m_RootOrder
:
4
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
...
@@ -4628,7 +4629,7 @@ MeshRenderer:
m_RenderingLayerMask
:
1
m_RendererPriority
:
0
m_Materials
:
-
{
fileID
:
2100000
,
guid
:
7b4263242b2c89f45b7088968eac46e
f
,
type
:
2
}
-
{
fileID
:
2100000
,
guid
:
51a49656bff65b3488577fead51b83d
f
,
type
:
2
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
...
...
@@ -4842,6 +4843,67 @@ MonoBehaviour:
m_chainHandle
:
{
fileID
:
3963560938386471807
}
m_camera
:
{
fileID
:
0
}
curLevelIndex
:
4
---
!u!1
&7603134056601248193
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
7319091445216978047
}
-
component
:
{
fileID
:
8547343705252056802
}
-
component
:
{
fileID
:
4607332715907448271
}
m_Layer
:
0
m_Name
:
buttonTrigger
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&7319091445216978047
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7603134056601248193
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
-1.46
,
y
:
0.07
,
z
:
-0.1314039
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
4040573734231294485
}
m_RootOrder
:
2
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!65
&8547343705252056802
BoxCollider
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7603134056601248193
}
m_Material
:
{
fileID
:
0
}
m_IsTrigger
:
1
m_Enabled
:
1
serializedVersion
:
2
m_Size
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&4607332715907448271
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
7603134056601248193
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
622119790b3ecdf479dd087fef5e6923
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_targetTrans
:
{
fileID
:
23140263829358294
}
m_buildTrans
:
{
fileID
:
4035800303001616775
}
m_buttonTrans
:
{
fileID
:
1871549070046122665
}
m_speed
:
1
---
!u!1001
&1871120857418378013
PrefabInstance
:
m_ObjectHideFlags
:
0
...
...
@@ -5150,6 +5212,11 @@ PrefabInstance:
value
:
objectReference
:
{
fileID
:
5932101836730060332
,
guid
:
b9343f2adfbad3d45910efa7d0677584
,
type
:
3
}
-
target
:
{
fileID
:
5063288112137550278
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
propertyPath
:
m_TagString
value
:
Player
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
5063288112137550297
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
propertyPath
:
m_Mass
...
...
@@ -5729,15 +5796,15 @@ PrefabInstance:
-
{
fileID
:
5063288112813874807
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
-
{
fileID
:
5063288112813874806
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
---
!u!4
&4566462821820411514
stripped
Transform
:
m_CorrespondingSourceObject
:
{
fileID
:
4686061859939579677
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
9103861518316231015
}
m_PrefabAsset
:
{
fileID
:
0
}
---
!u!1
&4040573734206883611
stripped
GameObject
:
m_CorrespondingSourceObject
:
{
fileID
:
5063288112813874812
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
9103861518316231015
}
m_PrefabAsset
:
{
fileID
:
0
}
---
!u!4
&4566462821820411514
stripped
Transform
:
m_CorrespondingSourceObject
:
{
fileID
:
4686061859939579677
,
guid
:
026b5780346325e4b98d62d9430fe8e1
,
type
:
3
}
m_PrefabInstance
:
{
fileID
:
9103861518316231015
}
m_PrefabAsset
:
{
fileID
:
0
}
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