Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
man-in-the-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Boards
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
MIM
man-in-the-mirror
Commits
10d469af
Commit
10d469af
authored
Apr 06, 2019
by
15박보승
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
카메라 터렛 껍데기 추가, 사각형 범위 판정 코드 추가
parent
86e9e440
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
152 additions
and
20 deletions
+152
-20
SampleScene.unity
Assets/Scenes/BSDummy/SampleScene.unity
+111
-1
Vector2IntExtensions.cs
Assets/Scripts/Extensions/Vector2IntExtensions.cs
+5
-0
CameraTurret.cs
Assets/Scripts/Interactors/CameraTurret.cs
+12
-5
GameManager.cs
Assets/Scripts/Managers/GameManager.cs
+15
-0
PlayerController.cs
Assets/Scripts/PlayerController.cs
+9
-14
No files found.
Assets/Scenes/BSDummy/SampleScene.unity
View file @
10d469af
...
...
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity
:
1
m_CustomReflection
:
{
fileID
:
0
}
m_Sun
:
{
fileID
:
170076734
}
m_IndirectSpecularColor
:
{
r
:
0.446578
98
,
g
:
0.4964133
,
b
:
0.5748178
,
a
:
1
}
m_IndirectSpecularColor
:
{
r
:
0.446578
44
,
g
:
0.49641222
,
b
:
0.57481694
,
a
:
1
}
m_UseRadianceAmbientProbe
:
0
---
!u!157
&3
LightmapSettings
:
...
...
@@ -276,6 +276,111 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
c7d507df55441f7438f6f059e9d2587c
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!1
&1030735729
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1030735734
}
-
component
:
{
fileID
:
1030735733
}
-
component
:
{
fileID
:
1030735732
}
-
component
:
{
fileID
:
1030735731
}
-
component
:
{
fileID
:
1030735730
}
m_Layer
:
0
m_Name
:
CameraTurret
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1030735730
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1030735729
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
00412ad71b8f0e14c9a23118682ee6f9
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
floor
:
{
fileID
:
0
}
---
!u!65
&1030735731
BoxCollider
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1030735729
}
m_Material
:
{
fileID
:
0
}
m_IsTrigger
:
0
m_Enabled
:
1
serializedVersion
:
2
m_Size
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!23
&1030735732
MeshRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1030735729
}
m_Enabled
:
1
m_CastShadows
:
1
m_ReceiveShadows
:
1
m_DynamicOccludee
:
1
m_MotionVectors
:
1
m_LightProbeUsage
:
1
m_ReflectionProbeUsage
:
1
m_RenderingLayerMask
:
1
m_RendererPriority
:
0
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
:
0
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
&1030735733
MeshFilter
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1030735729
}
m_Mesh
:
{
fileID
:
10202
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
---
!u!4
&1030735734
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1030735729
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
5
,
y
:
5
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
8
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&2102809461
stripped
MonoBehaviour
:
m_CorrespondingSourceObject
:
{
fileID
:
7277015661519863741
,
guid
:
20dee07e28273f049a9093ae4453912f
,
...
...
@@ -490,6 +595,11 @@ PrefabInstance:
propertyPath
:
m_LocalEulerAnglesHint.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
1444571407667829093
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
propertyPath
:
m_LocalPosition.z
value
:
0
objectReference
:
{
fileID
:
0
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
0b18400fb62a12d4e9cb5fbb8ecbb53f
,
type
:
3
}
---
!u!1001
&6014610517247297951
...
...
Assets/Scripts/Extensions/Vector2IntExtensions.cs
View file @
10d469af
...
...
@@ -4,6 +4,11 @@ using UnityEngine;
public
static
class
Vector2IntExtensions
{
public
static
bool
IsInSquareArea
(
this
Vector2Int
a
,
Vector2Int
b
,
int
size
)
{
return
Mathf
.
Abs
(
a
.
x
-
b
.
x
)
<=
size
&&
Mathf
.
Abs
(
a
.
y
-
b
.
y
)
<=
size
;
}
public
static
int
ManhattanDistance
(
this
Vector2Int
a
,
Vector2Int
b
)
{
return
Mathf
.
Abs
(
a
.
x
-
b
.
x
)
+
Mathf
.
Abs
(
a
.
y
-
b
.
y
);
...
...
Assets/Scripts/Interactors/CameraTurret.cs
View file @
10d469af
...
...
@@ -4,12 +4,15 @@ using UnityEngine;
public
class
CameraTurret
:
MonoBehaviour
,
IBreakable
,
IPlayerInteractor
{
private
Vector2Int
position
;
[
SerializeField
]
private
Floor
floor
=
null
;
public
Vector2Int
Position
{
get
{
return
floor
!=
null
?
floor
.
mapPos
:
throw
new
UnassignedReferenceException
(
"Floor of Interactor is not assigned"
);
}
}
public
void
Init
(
Vector2Int
pos
)
public
void
Init
(
Floor
floor
)
{
position
=
pos
;
}
this
.
floor
=
floor
;
PlayerController
.
inst
.
OnPlayerMove
+=
Interact
;
}
public
void
Break
()
{
...
...
@@ -18,6 +21,10 @@ public class CameraTurret : MonoBehaviour, IBreakable, IPlayerInteractor
public
void
Interact
(
Vector2Int
pos
)
{
if
(
Position
.
IsInSquareArea
(
pos
,
1
))
{
Debug
.
Log
(
"Stage Restart!"
);
//TODO : Restart Level
}
}
}
Assets/Scripts/Managers/GameManager.cs
View file @
10d469af
...
...
@@ -5,10 +5,25 @@ using System.Linq;
public
class
GameManager
:
SingletonBehaviour
<
GameManager
>
{
/*
private List<IPlayerInteractor> playerInteractors;
public void UpdateInteractorList()
{
playerInteractors = FindObjectsOfType<MonoBehaviour>().OfType<IPlayerInteractor>().ToList();
}
public void AddInteractor()
{
}
public void TriggerPlayerInteractors(Vector2Int pos)
{
foreach (var interactor in playerInteractors)
{
interactor.Interact(pos);
}
}
*/
}
Assets/Scripts/PlayerController.cs
View file @
10d469af
using
System.Collections
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.AI
;
public
class
PlayerController
:
MonoBehaviour
public
class
PlayerController
:
SingletonBehaviour
<
PlayerController
>
{
private
Vector2Int
prePos
;
public
Vector2Int
MapPos
...
...
@@ -17,6 +18,8 @@ public class PlayerController : MonoBehaviour
}
}
public
event
Action
<
Vector2Int
>
OnPlayerMove
;
// Start is called before the first frame update
void
Start
()
{
...
...
@@ -28,8 +31,10 @@ public class PlayerController : MonoBehaviour
{
if
(
prePos
!=
MapPos
)
{
}
Debug
.
Log
(
MapPos
);
OnPlayerMove
?.
Invoke
(
MapPos
);
prePos
=
MapPos
;
}
if
(
Input
.
GetMouseButtonDown
(
0
))
{
...
...
@@ -43,14 +48,4 @@ public class PlayerController : MonoBehaviour
}
}
}
private
void
OnCollisionEnter
(
Collision
collision
)
{
Debug
.
Log
(
collision
.
gameObject
.
name
);
Floor
floor
=
collision
.
transform
.
GetComponent
<
Floor
>();
if
(
floor
!=
null
)
{
Debug
.
Log
(
floor
.
mapPos
);
}
}
}
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