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
B
Best Enemies Forever
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GameDevWeek
S
Sommersemester 2019
Unity
Best Enemies Forever
Commits
aba676c0
Commit
aba676c0
authored
Sep 22, 2019
by
Skydiver3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
levers work with checkpoints now:)
parent
6b18b1e3
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1095 additions
and
939 deletions
+1095
-939
Assets/_Game/Data/Variables/LevelEnd/MenuHasBeenLoaded.asset
Assets/_Game/Data/Variables/LevelEnd/MenuHasBeenLoaded.asset
+19
-0
Assets/_Game/Data/Variables/LevelEnd/MenuHasBeenLoaded.asset.meta
...Game/Data/Variables/LevelEnd/MenuHasBeenLoaded.asset.meta
+3
-3
Assets/_Game/Prefabs/Level/Gate/Lever.prefab
Assets/_Game/Prefabs/Level/Gate/Lever.prefab
+16
-0
Assets/_Game/Scenes/MainMenu_Tests/MainMenu.unity
Assets/_Game/Scenes/MainMenu_Tests/MainMenu.unity
+941
-925
Assets/_Game/Scripts/IngameUI/NextLevel.cs
Assets/_Game/Scripts/IngameUI/NextLevel.cs
+1
-0
Assets/_Game/Scripts/IngameUI/StartScreen.cs
Assets/_Game/Scripts/IngameUI/StartScreen.cs
+27
-0
Assets/_Game/Scripts/IngameUI/StartScreen.cs.meta
Assets/_Game/Scripts/IngameUI/StartScreen.cs.meta
+11
-0
Assets/_Game/Scripts/Level/Activator/LeverLogic.cs
Assets/_Game/Scripts/Level/Activator/LeverLogic.cs
+31
-3
Assets/_Game/Scripts/Level/SaveSpot/ActionsToSave.cs
Assets/_Game/Scripts/Level/SaveSpot/ActionsToSave.cs
+4
-0
Assets/_Game/Scripts/Level/SaveSpot/PickedUpItems.cs
Assets/_Game/Scripts/Level/SaveSpot/PickedUpItems.cs
+2
-0
Assets/_Game/Scripts/Level/SaveSpot/SavePoint.cs
Assets/_Game/Scripts/Level/SaveSpot/SavePoint.cs
+14
-2
Assets/_Game/Scripts/Level/SaveSpot/SavedActions.cs
Assets/_Game/Scripts/Level/SaveSpot/SavedActions.cs
+12
-2
Assets/_Game/Scripts/MainMenu/MainMenu.cs
Assets/_Game/Scripts/MainMenu/MainMenu.cs
+12
-1
Assets/_Game/Scripts/PlayerSebas/PlayerTouching.cs
Assets/_Game/Scripts/PlayerSebas/PlayerTouching.cs
+1
-1
Assets/_Game/Scripts/Sound/AudioManager.cs
Assets/_Game/Scripts/Sound/AudioManager.cs
+1
-2
No files found.
Assets/_Game/Data/Variables/LevelEnd/MenuHasBeenLoaded.asset
0 → 100644
View file @
aba676c0
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!114
&11400000
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
0
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
320ccd2dc511d4d1b9d768f703fd3bb8
,
type
:
3
}
m_Name
:
MenuHasBeenLoaded
m_EditorClassIdentifier
:
DeveloperDescription
:
value
:
0
oldValue
:
0
Changed
:
{
fileID
:
0
}
ChangedWithHistory
:
{
fileID
:
0
}
Assets/_Game/Data/
Actions
.meta
→
Assets/_Game/Data/
Variables/LevelEnd/MenuHasBeenLoaded.asset
.meta
View file @
aba676c0
fileFormatVersion: 2
guid: c29aa0de4bb26a945ae50fd6de53f7ec
folderAsset: yes
DefaultImporter:
guid: 4032cf54e5376c241bc6860e23a961c0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
Assets/_Game/Prefabs/Level/Gate/Lever.prefab
View file @
aba676c0
...
...
@@ -13,6 +13,7 @@ GameObject:
-
component
:
{
fileID
:
46179617408924949
}
-
component
:
{
fileID
:
5810170731428422867
}
-
component
:
{
fileID
:
2783878841515753837
}
-
component
:
{
fileID
:
5374147668424276736
}
m_Layer
:
11
m_Name
:
Lever
m_TagString
:
Untagged
...
...
@@ -163,6 +164,8 @@ MonoBehaviour:
m_StringArgument
:
m_BoolArgument
:
0
m_CallState
:
2
pulledLevers
:
{
fileID
:
11400000
,
guid
:
9612907be0f0e574196d911693f5fa81
,
type
:
2
}
checkpointTag
:
{
fileID
:
11400000
,
guid
:
3458fcec955445a4f94e41fc34583bcd
,
type
:
2
}
IsTimed
:
0
AfterTime
:
0
---
!u!114
&2783878841515753837
...
...
@@ -178,3 +181,16 @@ MonoBehaviour:
m_Name
:
m_EditorClassIdentifier
:
_tags
:
[]
---
!u!114
&5374147668424276736
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
46179617408924945
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
559838af38077ab4ab9c5c3d477b0096
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
transfer
:
{
fileID
:
11400000
,
guid
:
7b22bba61d075c64e85adbda114d5db8
,
type
:
2
}
Assets/_Game/Scenes/MainMenu_Tests/MainMenu.unity
View file @
aba676c0
This diff is collapsed.
Click to expand it.
Assets/_Game/Scripts/IngameUI/NextLevel.cs
View file @
aba676c0
...
...
@@ -9,6 +9,7 @@ public class NextLevel : MonoBehaviour
{
public
void
LoadNextLevel
()
{
if
(
SceneManager
.
sceneCountInBuildSettings
>
SceneManager
.
GetActiveScene
().
buildIndex
+
1
)
{
int
sceneIndex
=
SceneManager
.
GetActiveScene
().
buildIndex
;
...
...
Assets/_Game/Scripts/IngameUI/StartScreen.cs
0 → 100644
View file @
aba676c0
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityAtoms
;
using
UnityEngine
;
public
class
StartScreen
:
MonoBehaviour
{
[
SerializeField
]
private
BoolVariable
hasBeenLoaded
;
[
SerializeField
]
private
GameObject
MainMenu
;
private
void
Start
()
{
if
(
hasBeenLoaded
.
Value
)
{
MainMenu
.
SetActive
(
true
);
this
.
gameObject
.
SetActive
(
false
);
}
hasBeenLoaded
.
Value
=
true
;
}
// Update is called once per frame
void
Update
()
{
}
}
Assets/_Game/Scripts/IngameUI/StartScreen.cs.meta
0 → 100644
View file @
aba676c0
fileFormatVersion: 2
guid: 37e360c05330f334aa5e4141e5025142
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/_Game/Scripts/Level/Activator/LeverLogic.cs
View file @
aba676c0
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityAtoms
;
using
UnityEngine
;
using
UnityEngine.Events
;
...
...
@@ -8,23 +9,37 @@ public class LeverLogic : MonoBehaviour
{
[
SerializeField
]
private
UnityEvent
_eventPulled
;
[
SerializeField
]
private
UnityEvent
_eventUnPulled
;
[
SerializeField
]
private
PickedUpItems
pulledLevers
;
private
SavePoint
checkpoint
;
[
SerializeField
]
private
StringConstant
checkpointTag
;
[
SerializeField
]
private
bool
IsTimed
=
false
;
[
SerializeField
]
private
float
AfterTime
=
0
;
private
bool
pulled
=
false
;
private
void
Start
()
{
checkpoint
=
AtomicTags
.
FindByTag
(
checkpointTag
.
Value
).
GetComponent
<
SavePoint
>();
}
void
OnTriggerEnter2D
(
Collider2D
other
)
{
if
(
pulled
)
{
GetComponent
<
ActionsToSave
>()?.
TransferAction
(
UnPull
);
//GetComponent<ActionsToSave>()?.UnTransferAction(Pull);//replace by take this from list
pulledLevers
.
levers
[
0
].
Remove
(
gameObject
);
Debug
.
Log
(
"remove "
+
gameObject
);
Debug
.
Log
(
pulledLevers
.
levers
[
0
].
Count
);
UnPull
();
}
else
{
GetComponent
<
ActionsToSave
>()?.
TransferAction
(
Pull
);
GetComponent
<
ActionsToSave
>()?.
ForceTransferAction
(
UnPullAllLevers
);
pulledLevers
.
levers
[
0
].
Add
(
gameObject
);
Debug
.
Log
(
"add "
+
gameObject
);
Debug
.
Log
(
pulledLevers
.
levers
[
0
].
Count
);
Pull
();
if
(
IsTimed
)
...
...
@@ -43,6 +58,17 @@ public class LeverLogic : MonoBehaviour
FindObjectOfType
<
AudioManager
>().
Play
(
"Lever"
);
}
public
void
UnPullAllLevers
()
{
Debug
.
Log
(
"pulling the levers. "
+
pulledLevers
.
levers
[
0
].
Count
+
" are activated"
);
foreach
(
GameObject
obj
in
pulledLevers
.
levers
[
0
])
{
Debug
.
Log
(
"pulling "
+
obj
);
obj
.
GetComponent
<
LeverLogic
>().
UnPull
();
}
}
public
void
UnPull
()
{
pulled
=
false
;
...
...
@@ -56,6 +82,8 @@ public class LeverLogic : MonoBehaviour
FindObjectOfType
<
AudioManager
>().
StopPlaying
(
"TimerTicks"
);
pulledLevers
.
levers
[
checkpoint
.
numActive
+
1
].
Remove
(
gameObject
);
//GetComponent<ActionsToSave>()?.UnTransferAction(Pull);
UnPull
();
}
}
Assets/_Game/Scripts/Level/SaveSpot/ActionsToSave.cs
View file @
aba676c0
...
...
@@ -14,6 +14,10 @@ public class ActionsToSave : MonoBehaviour
{
transfer
.
AddEvent
(
action
);
}
/*public void UnTransferAction(SavedActions.actions action)
{
transfer.RemoveEvent(action);
}*/
public
void
ForceTransferAction
(
SavedActions
.
actions
action
)
{
transfer
.
ForceAddEvent
(
action
);
...
...
Assets/_Game/Scripts/Level/SaveSpot/PickedUpItems.cs
View file @
aba676c0
...
...
@@ -6,6 +6,8 @@ using UnityEngine;
public
class
PickedUpItems
:
ScriptableObject
{
public
List
<
List
<
GameObject
>>
items
;
public
List
<
List
<
GameObject
>>
levers
;
public
void
ResetItems
()
{
...
...
Assets/_Game/Scripts/Level/SaveSpot/SavePoint.cs
View file @
aba676c0
...
...
@@ -24,6 +24,9 @@ public class SavePoint : MonoBehaviour
{
numActive
=
triggerNum
;
PotionsThatWillDisappear
.
items
[
0
].
Clear
();
Debug
.
Log
(
"clearing levers"
);
PotionsThatWillDisappear
.
levers
[
0
].
Clear
();
Debug
.
Log
(
PotionsThatWillDisappear
.
levers
[
0
].
Count
);
}
//Debug.Log(numActive +1+ " checkpoints are active");
hasBeenActivated
[
numActive
]
=
true
;
...
...
@@ -39,15 +42,20 @@ public class SavePoint : MonoBehaviour
hasBeenActivated
=
new
bool
[
GetComponentsInChildren
<
BoxCollider2D
>().
Length
];
//items.items.Clear();
items
.
items
=
new
List
<
List
<
GameObject
>>();
items
.
levers
=
new
List
<
List
<
GameObject
>>();
foreach
(
var
VARIABLE
in
hasBeenActivated
)
{
items
.
items
.
Add
(
new
List
<
GameObject
>());
items
.
levers
.
Add
(
new
List
<
GameObject
>());
}
items
.
items
.
Add
(
new
List
<
GameObject
>());
items
.
levers
.
Add
(
new
List
<
GameObject
>());
//PotionsThatWillDisappear.items.Clear();
PotionsThatWillDisappear
.
items
=
new
List
<
List
<
GameObject
>>();
PotionsThatWillDisappear
.
items
.
Add
(
new
List
<
GameObject
>());
PotionsThatWillDisappear
.
levers
=
new
List
<
List
<
GameObject
>>();
PotionsThatWillDisappear
.
levers
.
Add
(
new
List
<
GameObject
>());
GameObject
p1
=
AtomicTags
.
FindAllByTag
(
playerTag
.
Value
)[
0
];
GameObject
p2
=
AtomicTags
.
FindAllByTag
(
playerTag
.
Value
)[
1
];
...
...
@@ -61,14 +69,18 @@ public class SavePoint : MonoBehaviour
{
GameObject
p1
=
AtomicTags
.
FindAllByTag
(
playerTag
.
Value
)[
0
];
GameObject
p2
=
AtomicTags
.
FindAllByTag
(
playerTag
.
Value
)[
1
];
//!!!reset all in current cp pulled levers----------------------------------------------------------------------------------
p1
.
GetComponent
<
Player_Movement
>().
ResetBuffs
();
p2
.
GetComponent
<
Player_Movement
>().
ResetBuffs
();
//clear current set!
items
.
items
[
numActive
+
1
].
Clear
();
transfer
.
InvokeEvent
();
transfer
.
InvokeEvent
();
//unpull all levers
//items.levers[numActive+1].Clear(); //reset list with in current cp pulled levers
for
(
int
i
=
0
;
i
<=
numActive
;
i
++)
{
if
(
hasBeenActivated
[
i
])
...
...
Assets/_Game/Scripts/Level/SaveSpot/SavedActions.cs
View file @
aba676c0
...
...
@@ -42,17 +42,24 @@ public class SavedActions : ScriptableObject
}
}*/
//AddEvent to checkpoint(active+1)
if
(
checkpoint
.
numActive
>=
myActions
.
Length
)
{
Debug
.
Log
(
"returning empty"
);
return
;
}
Debug
.
Log
(
action
.
GetMethodInfo
());
myActions
[
checkpoint
.
numActive
+
1
]
-=
action
;
myActions
[
checkpoint
.
numActive
+
1
]
+=
action
;
}
public
void
RemoveEvent
(
actions
action
)
{
myActions
[
checkpoint
.
numActive
+
1
]
-=
action
;
}
public
void
ForceAddEvent
(
actions
action
)
{
eventActivateDestructables
-=
action
;
...
...
@@ -64,10 +71,12 @@ public class SavedActions : ScriptableObject
{
checkpoint
=
AtomicTags
.
FindByTag
(
checkpointTag
.
Value
).
GetComponent
<
SavePoint
>();
//Debug.Log(checkpoint.numActive+1 +" checkpoints are active");
Debug
.
Log
(
"a cockroach"
);
if
(
checkpoint
.
numActive
>=
0
)
{
//Debug.Log("invoke action from set " + checkpoint.numActive );
//Debug.Log(myActions?[checkpoint.numActive]?.GetMethodInfo());
Debug
.
Log
(
"in a bunker"
);
myActions
?[
checkpoint
.
numActive
]?.
Invoke
();
}
}
//on death
...
...
@@ -80,8 +89,9 @@ public class SavedActions : ScriptableObject
public
void
InvokeDestructables
()
{
//
Debug.Log("invoking");
Debug
.
Log
(
"invoking"
);
eventActivateDestructables
?.
Invoke
();
Debug
.
Log
(
eventActivateDestructables
.
GetMethodInfo
());
}
/* public void ResetDestructables()
...
...
Assets/_Game/Scripts/MainMenu/MainMenu.cs
View file @
aba676c0
using
System.Collections
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityAtoms
;
using
UnityEngine
;
...
...
@@ -6,15 +7,25 @@ using UnityEngine.SceneManagement;
public
class
MainMenu
:
MonoBehaviour
{
[
SerializeField
]
private
BoolVariable
hasBeenLoaded
;
private
void
Start
()
{
hasBeenLoaded
.
Value
=
true
;
}
public
void
PlayGame
()
{
Debug
.
Log
(
"Loaded New Scene"
);
SceneManager
.
LoadScene
(
3
,
LoadSceneMode
.
Single
);
}
public
void
QuitGame
()
{
hasBeenLoaded
.
Value
=
false
;
#
if
UNITY_EDITOR
// Application.Quit() does not work in the editor so
// UnityEditor.EditorApplication.isPlaying need to be set to false to end the game
...
...
Assets/_Game/Scripts/PlayerSebas/PlayerTouching.cs
View file @
aba676c0
...
...
@@ -43,7 +43,7 @@ public class PlayerTouching : MonoBehaviour
{
yield
return
new
WaitForSeconds
(
0.05f
);
Debug
.
Log
(
gameObject
.
name
);
//
Debug.Log(gameObject.name);
IsTouching
.
Value
=
false
;
...
...
Assets/_Game/Scripts/Sound/AudioManager.cs
View file @
aba676c0
...
...
@@ -45,7 +45,6 @@ public class AudioManager : MonoBehaviour
{
Debug
.
LogWarning
(
"Sound: "
+
name
+
" not found!"
);
return
;
}
if
(
s
.
randomized
)
...
...
@@ -56,7 +55,7 @@ public class AudioManager : MonoBehaviour
s
.
source
.
Play
();
Debug
.
Log
(
"Sound Played: "
+
s
.
source
.
clip
.
name
);
//
Debug.Log("Sound Played: " + s.source.clip.name);
}
public
void
StopPlaying
(
string
sound
)
...
...
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