Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
to-the-surface
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
GDW-SS-18
to-the-surface
Commits
d074bf89
Commit
d074bf89
authored
Sep 29, 2018
by
Markus Schlösser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cannons can now shoot through enviroment
parent
3629c83f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
Assets/_Game/Prefabs/CannonBarrel.prefab
Assets/_Game/Prefabs/CannonBarrel.prefab
+2
-0
Assets/_Game/Scripts/CannonController.cs
Assets/_Game/Scripts/CannonController.cs
+2
-0
Assets/_Game/Scripts/ProjektilController.cs
Assets/_Game/Scripts/ProjektilController.cs
+5
-0
No files found.
Assets/_Game/Prefabs/CannonBarrel.prefab
View file @
d074bf89
...
...
@@ -103,10 +103,12 @@ MonoBehaviour:
cannonBarrel
:
{
fileID
:
1682295116660206
}
fire
:
{
fileID
:
1087194835788670
,
guid
:
3fd0675fac3d4794aafbb72c8557c635
,
type
:
2
}
fireDelay
:
1
phase
:
0
speed
:
7
anim
:
{
fileID
:
95962382210488100
}
animRadVorne
:
{
fileID
:
0
}
animRadHinten
:
{
fileID
:
0
}
ignoreEnviroment
:
1
---
!u!212
&212468767237705114
SpriteRenderer
:
m_ObjectHideFlags
:
1
...
...
Assets/_Game/Scripts/CannonController.cs
View file @
d074bf89
...
...
@@ -9,6 +9,7 @@ public class CannonController : MonoBehaviour, IResetable {
[
SerializeField
]
private
Animator
anim
;
[
SerializeField
]
private
Animator
animRadVorne
;
[
SerializeField
]
private
Animator
animRadHinten
;
[
SerializeField
]
private
bool
ignoreEnviroment
;
private
Coroutine
co
;
...
...
@@ -36,6 +37,7 @@ public class CannonController : MonoBehaviour, IResetable {
obj
.
transform
.
localScale
=
transform
.
lossyScale
;
// Flugrichtung
obj
.
GetComponent
<
Rigidbody2D
>().
velocity
=
cannonBarrel
.
transform
.
right
*
speed
;
obj
.
GetComponent
<
ProjektilController
>().
ignoreEnviroment
=
ignoreEnviroment
;
}
public
void
ResetToLevelBegin
()
{
...
...
Assets/_Game/Scripts/ProjektilController.cs
View file @
d074bf89
...
...
@@ -2,6 +2,8 @@
public
class
ProjektilController
:
MonoBehaviour
,
IResetable
{
public
bool
ignoreEnviroment
;
private
const
float
MAX_LIFETIME
=
15.0f
;
private
float
lifetime
;
...
...
@@ -15,6 +17,9 @@ public class ProjektilController : MonoBehaviour, IResetable {
}
private
void
OnTriggerEnter2D
(
Collider2D
other
)
{
// Don't destroy on contact with enviroment if set to ignore
if
(
other
.
gameObject
.
layer
==
12
&&
ignoreEnviroment
)
return
;
Destroy
(
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