Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StockRunning
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
czy
StockRunning
Commits
07371ab7
Commit
07371ab7
authored
Apr 23, 2021
by
czy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
控制摄像机旋转角度
parent
bbe48dd0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
7 deletions
+22
-7
DemoScenes.unity
StockRunning/Assets/#A1_Scenes/DemoScenes.unity
+1
-0
FollowTarget.cs
StockRunning/Assets/#A2_Scripts/Camera/FollowTarget.cs
+9
-2
ConfigurationFile.cs
StockRunning/Assets/My/Scripts/ConfigurationFile.cs
+6
-3
PlayerMove.cs
StockRunning/Assets/My/Scripts/Player/PlayerMove.cs
+4
-1
Enemy_Vertigo.cs
StockRunning/Assets/My/Scripts/Prop/Enemy_Vertigo.cs
+1
-1
Level2My.prefab
StockRunning/Assets/Prefabs/Level2My.prefab
+1
-0
No files found.
StockRunning/Assets/#A1_Scenes/DemoScenes.unity
View file @
07371ab7
...
...
@@ -3217,6 +3217,7 @@ MonoBehaviour:
HSpeedAI
:
10
backDis
:
7.02
upDis
:
5.61
rotationVector3MainCamera
:
{
x
:
20
,
y
:
0
,
z
:
0
}
VSpeedEnemy_V
:
10
SpeedLevelEnemy_V
:
1
AddSpeedEnemy_V
:
10
...
...
StockRunning/Assets/#A2_Scripts/Camera/FollowTarget.cs
View file @
07371ab7
...
...
@@ -34,6 +34,8 @@ public class FollowTarget : MonoBehaviour
public
float
backDis
=
5.51f
;
public
float
upDis
=
8.77f
;
[
Tooltip
(
"控制摄像机的旋转角度"
)]
public
Vector3
rotationVector3
;
//public float smood=10;
public
Transform
target
;
...
...
@@ -47,7 +49,8 @@ public class FollowTarget : MonoBehaviour
}
private
void
LateUpdate
()
{
rotationVector3
=
ConfigurationFile
.
instance
.
rotationVector3MainCamera
;
//读取配置文件数据
backDis
=
ConfigurationFile
.
instance
.
backDis
;
upDis
=
ConfigurationFile
.
instance
.
upDis
;
...
...
@@ -59,7 +62,11 @@ public class FollowTarget : MonoBehaviour
Vector3
followPoint
=
new
Vector3
(
0
,
0
,
target
.
position
.
z
)
+
Vector3
.
up
*
upDis
-
target
.
forward
*
backDis
;
//照相机不左右移动
transform
.
position
=
followPoint
;
transform
.
position
=
followPoint
;
//选择
//transform.Rotate(RotateVector3); //在update中将会一直旋转
transform
.
rotation
=
Quaternion
.
Euler
(
rotationVector3
.
x
,
rotationVector3
.
y
,
rotationVector3
.
z
);
}
}
StockRunning/Assets/My/Scripts/ConfigurationFile.cs
View file @
07371ab7
...
...
@@ -13,7 +13,7 @@ public class ConfigurationFile : MonoBehaviour
public
float
AddSpeed
=
10.0f
;
[
Tooltip
(
"控制左右移动的速度。"
)]
public
float
HSpeed
=
10.0f
;
//########################################
[
Header
(
"AI"
)]
[
Tooltip
(
"控制向前的速度。"
)]
public
float
VSpeedAI
=
20.0f
;
...
...
@@ -22,12 +22,15 @@ public class ConfigurationFile : MonoBehaviour
public
float
AddSpeedAI
=
10.0f
;
[
Tooltip
(
"控制左右移动的速度。"
)]
public
float
HSpeedAI
=
10.0f
;
//########################################
[
Header
(
"摄像机"
)]
[
Tooltip
(
"相对主角 向后的距离"
)]
public
float
backDis
=
5.51f
;
[
Tooltip
(
"相对主角 向上的距离"
)]
public
float
upDis
=
8.77f
;
[
Tooltip
(
"控制摄像机的旋转角度"
)]
public
Vector3
rotationVector3MainCamera
;
//########################################
[
Header
(
"打手"
)]
[
Tooltip
(
"基础速度"
)]
public
float
VSpeedEnemy_V
=
20.0f
;
...
...
@@ -39,7 +42,7 @@ public class ConfigurationFile : MonoBehaviour
public
float
VertigoTimeEnemy_V
=
3.0f
;
[
Tooltip
(
"小人出现的位置在目标的前方的距离"
)]
public
float
disZ
=
50
;
//########################################
[
Header
(
"巨石"
)]
[
Tooltip
(
"眩晕时长"
)]
public
float
VertigoTimeGianRock
=
3
;
...
...
StockRunning/Assets/My/Scripts/Player/PlayerMove.cs
View file @
07371ab7
...
...
@@ -276,6 +276,7 @@ public class PlayerMove : MonoBehaviour
if
(
m_bIsCanMove
&&
!
BattleCtrl
.
instance
.
isEndBattle
)
{
xDelta
=
0
;
//避免眩晕期间不会执行UpdateJoystick();造成偏移现象。
if
(
timerVertigo
<=
0
)
{
timerVertigo
=
0
;
...
...
@@ -286,6 +287,7 @@ public class PlayerMove : MonoBehaviour
{
//眩晕
timerVertigo
-=
Time
.
deltaTime
;
}
}
...
...
@@ -382,11 +384,12 @@ public class PlayerMove : MonoBehaviour
}
else
if
(
currentGesture
.
type
==
EasyTouch
.
EvtType
.
On_TouchUp
)
{
//print("鼠标抬起");//眩晕期间不会进来,也会发生飘移现象
xDelta
=
0
;
}
}
}
//else if (currentGesture != null && (currentGesture.type == EasyTouch.EvtType.On_DragEnd))
//{
// addXTemp = 0;
...
...
StockRunning/Assets/My/Scripts/Prop/Enemy_Vertigo.cs
View file @
07371ab7
...
...
@@ -67,7 +67,7 @@ public class Enemy_Vertigo : MonoBehaviour
{
hit
.
gameObject
.
GetComponent
<
PlayerMove
>().
Vertigo
(
VertigoTime
);
//眩晕1秒
hit
.
gameObject
.
GetComponent
<
PlayerMove
>().
ChangeSpeedLevel
(-
1
);
//等级降低一级
print
(
"------------"
+
transform
.
name
);
//
print("------------"+transform.name);
Destroy
(
gameObject
);
}
}
...
...
StockRunning/Assets/Prefabs/Level2My.prefab
View file @
07371ab7
...
...
@@ -2104,6 +2104,7 @@ MonoBehaviour:
m_EditorClassIdentifier
:
backDis
:
6.390015
upDis
:
6.64
RotateVector3
:
{
x
:
20
,
y
:
0
,
z
:
0
}
target
:
{
fileID
:
9066730885846526947
}
---
!u!1
&3837569216639476273
GameObject
:
...
...
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