Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Spieleentwicklung
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adrian Paschkowski
Spieleentwicklung
Commits
64069903
Verified
Commit
64069903
authored
3 years ago
by
Adrian Paschkowski
Browse files
Options
Downloads
Patches
Plain Diff
Deactivate enemy dragging with open store
parent
27afe738
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assets/Scripts/Store/StoreStateHandler.cs
+3
-0
3 additions, 0 deletions
Assets/Scripts/Store/StoreStateHandler.cs
Assets/Scripts/UI/DragDestroyController.cs
+21
-3
21 additions, 3 deletions
Assets/Scripts/UI/DragDestroyController.cs
with
24 additions
and
3 deletions
Assets/Scripts/Store/StoreStateHandler.cs
+
3
−
0
View file @
64069903
...
@@ -23,6 +23,7 @@ public class StoreStateHandler : MonoBehaviour, IRoundCallback
...
@@ -23,6 +23,7 @@ public class StoreStateHandler : MonoBehaviour, IRoundCallback
storeContainer
.
SetActive
(
true
);
storeContainer
.
SetActive
(
true
);
storeButton
.
SetActive
(
false
);
storeButton
.
SetActive
(
false
);
objectsToHideOnOpenStore
.
ForEach
(
o
=>
o
.
SetActive
(
false
));
objectsToHideOnOpenStore
.
ForEach
(
o
=>
o
.
SetActive
(
false
));
DragDestroyController
.
instance
.
SetDraggingEnabled
(
false
);
}
}
public
void
CloseStore
()
public
void
CloseStore
()
...
@@ -31,10 +32,12 @@ public class StoreStateHandler : MonoBehaviour, IRoundCallback
...
@@ -31,10 +32,12 @@ public class StoreStateHandler : MonoBehaviour, IRoundCallback
storeContainer
.
SetActive
(
false
);
storeContainer
.
SetActive
(
false
);
storeButton
.
SetActive
(
true
);
storeButton
.
SetActive
(
true
);
objectsToHideOnOpenStore
.
ForEach
(
o
=>
o
.
SetActive
(
true
));
objectsToHideOnOpenStore
.
ForEach
(
o
=>
o
.
SetActive
(
true
));
DragDestroyController
.
instance
.
SetDraggingEnabled
(
true
);
}
}
public
void
OnRoundStart
()
public
void
OnRoundStart
()
{
{
CloseStore
();
storeButton
.
SetActive
(
false
);
storeButton
.
SetActive
(
false
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/UI/DragDestroyController.cs
+
21
−
3
View file @
64069903
...
@@ -5,10 +5,13 @@ using UnityEngine;
...
@@ -5,10 +5,13 @@ using UnityEngine;
public
class
DragDestroyController
:
MonoBehaviour
public
class
DragDestroyController
:
MonoBehaviour
{
{
public
static
DragDestroyController
instance
{
get
;
private
set
;
}
[
SerializeField
]
Color
disabledColor
;
[
SerializeField
]
Color
disabledColor
;
[
SerializeField
]
LayerMask
fighterRaycastLayer
;
[
SerializeField
]
LayerMask
fighterRaycastLayer
;
[
SerializeField
]
float
fighterRaycastLength
=
20f
;
[
SerializeField
]
float
fighterRaycastLength
=
20f
;
bool
draggingEnabled
=
true
;
GameObject
selectedEnemy
;
GameObject
selectedEnemy
;
SpriteRenderer
selectedEnemySprite
;
SpriteRenderer
selectedEnemySprite
;
Vector3
originalEnemyPosition
;
Vector3
originalEnemyPosition
;
...
@@ -16,14 +19,14 @@ public class DragDestroyController : MonoBehaviour
...
@@ -16,14 +19,14 @@ public class DragDestroyController : MonoBehaviour
int
noCollisionLayer
;
int
noCollisionLayer
;
void
Awake
(
)
public
void
SetDraggingEnabled
(
bool
enabled
)
{
{
noCollisionLayer
=
LayerMask
.
NameToLayer
(
"No Collision"
)
;
draggingEnabled
=
enabled
;
}
}
void
Update
()
void
Update
()
{
{
if
(!
RoundController
.
instance
.
roundRunning
)
if
(!
RoundController
.
instance
.
roundRunning
&&
draggingEnabled
)
{
{
if
(
Input
.
GetButtonUp
(
"Fire2"
)
&&
selectedEnemy
==
null
)
if
(
Input
.
GetButtonUp
(
"Fire2"
)
&&
selectedEnemy
==
null
)
{
{
...
@@ -113,4 +116,19 @@ public class DragDestroyController : MonoBehaviour
...
@@ -113,4 +116,19 @@ public class DragDestroyController : MonoBehaviour
pos
.
z
=
selectedEnemy
.
transform
.
position
.
z
;
pos
.
z
=
selectedEnemy
.
transform
.
position
.
z
;
return
pos
;
return
pos
;
}
}
void
Awake
()
{
if
(
instance
==
null
)
{
instance
=
this
;
}
else
if
(
instance
!=
this
)
{
Destroy
(
gameObject
);
}
DontDestroyOnLoad
(
gameObject
);
noCollisionLayer
=
LayerMask
.
NameToLayer
(
"No Collision"
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment