Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mr BigSock
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Gard Aleksander Furre
Mr BigSock
Commits
370edade
Commit
370edade
authored
2 years ago
by
Robin Ruud Kristensen
Browse files
Options
Downloads
Patches
Plain Diff
added logic for operating chests
parent
ba1b9bee
No related branches found
Branches containing commit
No related tags found
1 merge request
!79
Ruud1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MrBigsock/Assets/Code/FollowPlayer.cs
+49
-6
49 additions, 6 deletions
MrBigsock/Assets/Code/FollowPlayer.cs
with
49 additions
and
6 deletions
MrBigsock/Assets/Code/FollowPlayer.cs
+
49
−
6
View file @
370edade
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Cinemachine
;
using
UnityEngine
;
using
UnityEngine.Tilemaps
;
...
...
@@ -23,35 +24,77 @@ namespace Bigsock
GameObject
[]
boss
;
GameObject
player
;
GameObject
door
;
GameObject
stairs
;
GameObject
[]
enemies
;
GameObject
[]
Chest
;
List
<
GameObject
>
chests
;
private
int
roomNr
=
0
;
void
Start
()
{
chests
=
new
List
<
GameObject
>();
neighborMapGenerator
.
RunProceduralGeneration
();
player
=
GameObject
.
Find
(
"BigSock"
);
Chest
=
GameObject
.
FindGameObjectsWithTag
(
"Chest"
);
foreach
(
GameObject
c
in
Chest
)
{
chests
.
Add
(
c
);
c
.
SetActive
(
false
);
}
}
void
LateUpdate
()
{
boss
=
GameObject
.
FindGameObjectsWithTag
(
"Boss"
);
stair
s
=
GameObject
.
Find
(
"stairs(clone)"
);
enemie
s
=
GameObject
.
Find
GameObjectsWithTag
((
roomNr
).
ToString
()
);
if
(
boss
.
Length
==
0
&&
levels
<=
1
&&
Input
.
GetKey
(
KeyCode
.
Return
))
{
neighborMapGenerator
.
RunProceduralGeneration
();
player
.
transform
.
position
=
new
Vector3
(
9
,
5
,
0
);
levels
++;
roomNr
=
0
;
foreach
(
GameObject
c
in
chests
)
{
Destroy
(
c
);
}
chests
.
Clear
();
TilemapGenerator
.
resetMaps
();
TilemapGenerator
.
SetRoomIDZero
();
neighborMapGenerator
.
RunProceduralGeneration
();
Chest
=
GameObject
.
FindGameObjectsWithTag
(
"Chest"
);
Debug
.
Log
(
"Size: "
+
Chest
.
Length
);
foreach
(
GameObject
c
in
Chest
)
{
if
(
c
!=
null
)
{
c
.
SetActive
(
false
);
chests
.
Add
(
c
);
}
}
player
.
transform
.
position
=
new
Vector3
(
9
,
5
,
0
);
levels
++;
}
int
i
=
0
;
if
(
i
==
0
)
{
cameraMap
.
InvalidateCache
();
i
++;
}
if
(
enemies
.
Length
==
0
)
{
chests
[
roomNr
+
(
6
*(
levels
-
1
))].
SetActive
(
true
);
if
(
roomNr
+
1
<
NeighbourMapGenerator
.
GetRoomListCount
()
-
1
)
{
roomNr
++;
}
}
}
private
void
OnDestroy
()
{
roomNr
=
0
;
foreach
(
GameObject
c
in
chests
)
{
Destroy
(
c
);
}
NeighbourMapGenerator
.
ClearRoomList
();
TilemapGenerator
.
SetRoomIDZero
();
TilemapGenerator
.
resetMaps
();
...
...
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