private void LockBase_Changed(LockBase sender) { _opened = sender.isOpened; spriteTop.scale = new Vector3(1f - 0.5f * sender.openingProgress, 1f); spriteTop.GetComponent <Renderer>().enabled = !_opened; }
private void SetLockBase(LockBase lockBase) { if (lockBase != null) { SetOwnerLockBase(lockBase); } }
private bool DoPickUp() { if (_pickedItem != null) { return(false); } MonoBehaviour item = null; IPickable pickable = null; foreach (var it in _availableItems) { pickable = it as IPickable; item = it; if (pickable != null) { break; } } if (item == null && _lockBase != null) { pickable = _lockBase.ExtractPickable(); item = pickable as MonoBehaviour; } if (item != null && pickable != null && pickable.Carrier == null) { pickable.Carrier = this; _prevParent = item.transform.parent; var tr = item.transform; tr.parent = Hands.transform; tr.localEulerAngles = Vector3.zero; tr.localPosition = Vector3.zero; tr.localScale = Vector3.one; _pickedItem = item; Hands.CollidersEnabled = false; _availableItems.Clear(); _lockBase = null; } if (_pickedItem != null) { _availableItems.Remove(_pickedItem); if (Picked != null) { Picked(_pickedItem as IPickable); } return(true); } return(false); }
public void CollideExit(GameObject other) { //Debug.Log("exit: " + other.name); var item = other.GetComponent(typeof(IPickable)) as IPickable; if (item != null) { _availableItems.Remove(item as MonoBehaviour); return; } var lockBase = other.GetComponent <LockBase>(); if (lockBase == _lockBase) { _lockBase = null; } }
public void Collide(GameObject other) { //Debug.Log("enter: " + other.name); var item = other.GetComponent(typeof(IPickable)) as IPickable; if (item != null && !_availableItems.Contains(item as MonoBehaviour)) { _availableItems.Add(item as MonoBehaviour); return; } var lockBase = other.GetComponent <LockBase>(); if (lockBase != null) { _lockBase = lockBase; } }
/// <summary>Creates service definition that can be registered with a server</summary> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static grpc::ServerServiceDefinition BindService(LockBase serviceImpl) { return(grpc::ServerServiceDefinition.CreateBuilder() .AddMethod(__Method_Lock, serviceImpl.Lock) .AddMethod(__Method_Unlock, serviceImpl.Unlock).Build()); }
private void SetOwnerLockBase(LockBase lockBase) { _ownerLockBase = lockBase; TopSprite.color = (_ownerLockBase != null) ? _ownerLockBase.color : Color.white; }
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static void BindService(grpc::ServiceBinderBase serviceBinder, LockBase serviceImpl) { serviceBinder.AddMethod(__Method_Lock, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::V3Lockpb.LockRequest, global::V3Lockpb.LockResponse>(serviceImpl.Lock)); serviceBinder.AddMethod(__Method_Unlock, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::V3Lockpb.UnlockRequest, global::V3Lockpb.UnlockResponse>(serviceImpl.Unlock)); }
/// <summary>Register service method implementations with a service binder. Useful when customizing the service binding logic. /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary> /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param> /// <param name="serviceImpl">An object implementing the server-side handling logic.</param> public static void BindService(grpc::ServiceBinderBase serviceBinder, LockBase serviceImpl) { serviceBinder.AddMethod(__Method_Lock, serviceImpl.Lock); serviceBinder.AddMethod(__Method_Unlock, serviceImpl.Unlock); }