ASLObjectSendAndSetClaim Method (ASLObjectClaimCallback, Int32, Boolean, GameLiftManagerOpFunctionCallback) |
Namespace: ASL
public void SendAndSetClaim( ASLObjectClaimCallback callback, int claimTimeOut = 1000, bool resetClaimTimeout = true, GameLiftManagerOpFunctionCallback opCallback = null )
void SomeFunction() { //Claim the object gameobject.GetComponent<ASL.ASLObject>().SendAndSetClaim(() => { //Whatever code we want to execute AFTER we have successfully claimed this object, such as: gameobject.GetComponent<ASL.ASLObject>().DeleteObject(); //Delete our object //or gameobject.GetComponent<ASL.ASLObject>().SendAndSetLocalPosition(new Vector3(5, 0, -2)); //Move our object in its local space to 5, 0, -2 }); }
void SomeFunction() { //Claim an object and then execute the ActionToTake function after a successful claim gameobject.GetComponent<ASL.ASLObject>().SendAndSetClaim(ActionToTake); } //The function to call after a successful claim private void ActionToTake() { gameobject.GetComponent<ASL.ASLObject>().DeleteObject(); //Delete our object } void SomeOtherFunction() { //Same as before, but this time specify the time to hold onto our object before releasing back to the server - default time is 1000 (or 1 second) gameobject.GetComponent<ASL.ASLObject>().SendAndSetClaim(ADifferentActionToTake, 2000); //Hold onto this object before releasing it to the server for 2 seconds } //The function to call after a successful claim private void ADifferentActionToTake() { gameobject.GetComponent<ASL.ASLObject>().SendAndSetLocalPosition(new Vector3(5, 0, -2)); //Move our object in its local space to 5, 0, -2 }
void SomeFunction() { //Claim an object and then (notice the 0 after the last curly brace) hang onto this object until someone steals it from us (do not auto-release to the server) gameobject.GetComponent<ASL.ASLObject>().SendAndSetClaim(() => { //Whatever code we want to execute after we have successfully claimed this object, such as: gameobject.GetComponent<ASL.ASLObject>().DeleteObject(); //Delete our object //or gameobject.GetComponent<ASL.ASLObject>().SendAndSetLocalPosition(new Vector3(5, 0, -2)); //Move our object in its local space to 5, 0, -2 }, 0); //Hold onto this object until someone steals it }
void SomeFunction() { //Claim an object for 1 second, but don't reset whatever our current time length of time we have already held on to it for. //Normally if you claim an object, and then claim it again, by default, it will reset the release claim timer - in this case it does not gameobject.GetComponent<ASL.ASLObject>().SendAndSetClaim(SomeActionToTake, 1000, false); } private void SomeActionToTake() { gameobject.GetComponent<ASL.ASLObject>().DeleteObject(); //Delete our object }
void SomeFunction() { gameobject.GetComponent<ASL.ASLObject>().SendAndSetClaim(() => { //Whatever code we want to execute after we have successfully claimed this object, such as: gameobject.GetComponent<ASL.ASLObject>().DeleteObject(); //Delete our object //or gameobject.GetComponent<ASL.ASLObject>().SendAndSetLocalPosition(new Vector3(5, 0, -2)); //Move our object in its local space to 5, 0, -2 }, 0, false); //Hold on to this object until someone steals it, but don't reset whatever our current length of time we have already held on to it for }