ExecuteCommand Is it possible to organize any additional checks so that the method works correctly
Options
Ruslan
✭
Hello, sorry for the trouble, but I can not understand.
For archery I use the method
public override void ExecuteCommand
I also use
IsFirstExecution
But still shooting does not work correctly, at the client instead of one arrow several
Is it possible to organize any additional checks so that the method works correctly?
//Code
For archery I use the method
public override void ExecuteCommand
I also use
IsFirstExecution
But still shooting does not work correctly, at the client instead of one arrow several
Is it possible to organize any additional checks so that the method works correctly?
//Code
public override void ExecuteCommand (Bolt.Command c, bool resetState) { if (state.Dead) { return; } PlayerCommand cmd = (PlayerCommand)c; if (resetState) { _motor.SetState (cmd.Result.position, cmd.Result.velocity, cmd.Result.isGrounded, cmd.Result.jumpFrames); } else { // move and save the resulting state var result = _motor.Move (cmd.Input.forward, cmd.Input.backward, cmd.Input.left, cmd.Input.right, cmd.Input.jump, cmd.Input.yaw); cmd.Result.position = result.position; cmd.Result.velocity = result.velocity; cmd.Result.jumpFrames = result.jumpFrames; cmd.Result.isGrounded = result.isGrounded; if (cmd.IsFirstExecution) { // animation AnimatePlayer (cmd); // set state pitch state.pitch = cmd.Input.pitch; state.weapon = cmd.Input.weapon; //Выключили прицеливание класическое //state.Aiming = cmd.Input.aiming; //Calling the method of shooting if (cmd.Input.fire) { //ArrowFire (); } } if (entity.isOwner) { cmd.Result.Token = new TestToken (); } } } //Shooting Method void ArrowFire(){ if (Timer <= 0) { //нажатия ЛКМ var Arrov = BoltNetwork.Instantiate (BoltPrefabs.Arrow, ArrowPos.transform.position,ArrowPos.transform.rotation); Arrov.GetComponent<Rigidbody>().AddForce(transform.forward* ForceScale); Timer = Reload; //устанавливаем таймер например на 2 сек } }
0
Comments
-
Go step by step through the advanced tutorial, it will explain things. https://doc.photonengine.com/en-us/bolt/current/advanced-tutorials/chapter-10
-
I use it as a basis in my project, I just changed the shooting sistem, I made a spawn of an arrow with a rigid body component, but the principle remained the samestanchion said:Go step by step through the advanced tutorial, it will explain things. https://doc.photonengine.com/en-us/bolt/current/advanced-tutorials/chapter-1
Here it is written that the method BoltEntity.ExecuteCommand can work not coherently
https://doc.photonengine.com/en-us/bolt/current/reference/boltentity
Is it possible to make additional checks so that everything works the same for the client and the server?0