Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Multiplayer-arena-game
/
Multiplayer-arena-game-GameObjects
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f89e3fc7
authored
Jan 19, 2025
by
alsunj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary calls
parent
486d51bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
58 deletions
Assets/_Game/Code/Interactables/Doors/Door.cs
Assets/_Game/Code/Player/PlayerController.cs
Assets/_Game/Code/Interactables/Doors/Door.cs
View file @
f89e3fc7
...
...
@@ -17,56 +17,17 @@ public class Door : NetworkBehaviour, IInteractable
}
}
[
ServerRpc
(
RequireOwnership
=
false
)]
private
void
CmdOpenDoorForEveryoneServerRpc
()
{
RpcOpenDoorForEveryoneClientRpc
();
}
[
ClientRpc
]
private
void
RpcOpenDoorForEveryoneClientRpc
()
{
Interacted
();
}
[
ServerRpc
(
RequireOwnership
=
false
)]
private
void
CmdCloseDoorForEveryoneServerRpc
()
{
RpcCloseDoorForEveryoneClientRpc
();
}
[
ClientRpc
]
private
void
RpcCloseDoorForEveryoneClientRpc
()
{
Interacted
();
}
private
void
DoorOpened
()
{
_door
.
transform
.
DORotate
(
new
Vector3
(
0
,
90
,
0
),
1f
)
.
SetEase
(
Ease
.
OutBounce
);
CmdOpenDoorForEveryoneServerRpc
();
}
private
void
DoorOpenedForOtherClients
()
private
void
DoorOpenClientRpc
()
{
_door
.
transform
.
DORotate
(
new
Vector3
(
0
,
90
,
0
),
1f
)
.
SetEase
(
Ease
.
OutBounce
);
}
private
void
DoorClosed
()
{
_door
.
transform
.
DORotate
(
new
Vector3
(
0
,
0
,
0
),
1f
)
.
SetEase
(
Ease
.
OutBounce
);
CmdCloseDoorForEveryoneServerRpc
();
}
private
void
DoorClosedForOtherClients
()
[
ClientRpc
]
private
void
DoorCloseClientRpc
()
{
_door
.
transform
.
DORotate
(
new
Vector3
(
0
,
0
,
0
),
1f
)
...
...
@@ -83,25 +44,13 @@ public class Door : NetworkBehaviour, IInteractable
{
if
(!
_doorOpened
.
Value
)
{
DoorOpen
ed
();
DoorOpen
ClientRpc
();
_doorOpened
.
Value
=
true
;
}
else
{
DoorClose
d
();
DoorClose
ClientRpc
();
_doorOpened
.
Value
=
false
;
}
}
public
void
Interacted
()
{
if
(!
_doorOpened
.
Value
)
{
DoorOpenedForOtherClients
();
}
else
{
DoorClosedForOtherClients
();
}
}
}
\ No newline at end of file
Assets/_Game/Code/Player/PlayerController.cs
View file @
f89e3fc7
...
...
@@ -363,7 +363,6 @@ public class PlayerController : NetworkBehaviour
case
Key
key
:
if
(!
isRightHandFull
)
{
//Attempt to pick up the key.
key
.
RequestPickupObject
(
new
NetworkObjectReference
(
gameObject
.
GetComponent
<
NetworkObject
>()));
isRightHandFull
=
!
isRightHandFull
;
...
...
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