Hello,
I have a scripting-problem in my game, where I have a sliding door. The sliding is working by an “Open” animation. Now if the Host opens, it works perfectly for the client. But if the Client tries to open, it doesn’t work. Here are my codes:
Player file:
Code (JavaScript):
function UsingEyeLaseredObject ()
{
if(EyeLaseredObject.tag == "Door")
{
gameObject.Find(EyeLaseredObject.name).GetComponent(Door_Simple).Sum_Opening();
}
}
Door file:
Code (JavaScript):
public function Sum_Opening ()
{
if(isServer)
{
Rpc_Opening();
}
else
{
Cmd_Opening();
}
}
@Command
public function Cmd_Opening ()
{
Rpc_Opening();
}
@ClientRpc
public function Rpc_Opening ()
{
if ( DoorState == DoorPos.IsClosed || DoorState == DoorPos.IsClosing )
{
GetComponent.<Animation>()["Open"].normalizedSpeed = 1.0;
GetComponent(Animation).Play("Open");
DoorState = DoorPos.IsOpening;
}
else if ( DoorState == DoorPos.IsOpened || DoorState == DoorPos.IsOpening )
{
GetComponent.<Animation>()["Open"].normalizedSpeed = -1.0;
GetComponent(Animation).Play("Open");
DoorState = DoorPos.IsClosing;
}
}
If Client wants to Open, it seems it “stops” in the Cmd_Opening function, doesn’t go ahead to Rpc_Opening. No error or warning.
I did everything what I saw in the founded explains, but doesn’t want to work for the Clients. Any Idea?
Thanks