public void Respawn(Respawnable respawnable, Vector3 respawnPosition) { // Reset the velocity and place the respawnable at the center of the room. respawnable.GetComponent <Rigidbody>().velocity = Vector3.zero; respawnable.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; respawnable.transform.position = respawnPosition; }
void Awake() { respawnable = GetComponent <Respawnable>(); // Can only respawn when it is not grabbed. respawnable.RespawnCondition += () => !IsGrabbed; }
private void Spawn() { Respawnable instance = Instantiate(item, transform, false); instance.transform.localPosition = position; instance.objectSpawner = gameObject.GetComponent <ObjectSpawner>(); }
private void Awake() { body = GetComponent <Rigidbody>(); respawnable = GetComponent <Respawnable>(); destroyable = GetComponent <Killable>(); destroyable.OnDeath += OnDeath; OnValidate(); }
// Use this for initialization void Start() { controller = GetComponent <CharacterController>(); respawnable = GetComponent <Respawnable>(); pickupPoint = Camera.main.transform.Find("PickupPoint"); normalHeight = controller.height; crouchHeight = normalHeight / 2f; currentSpeed = speed; }
public static void Respawn(Respawnable respawnable, Vector3 respawnPosition) { // Reset the velocity and place the respawnable at the center of the room. if (respawnable.Rigidbody) { respawnable.Rigidbody.velocity = Vector3.zero; respawnable.Rigidbody.angularVelocity = Vector3.zero; } respawnable.transform.position = respawnPosition; }
public void RespawnObjects() { for (int i = 0; i < respawnableObjects.Length; i++) { Respawnable canRespawn = respawnableObjects[i].GetComponent <Respawnable>(); if (canRespawn) { canRespawn.Reset(); } } }
private void OnTriggerExit(Collider other) { // Send a respawn request to an object that leaves the area. Respawnable respawnable = other.GetComponent <Respawnable>(); if (!respawnable) { respawnable = other.GetComponentInParent <Respawnable>(); } respawnable?.ReceiveRespawnRequest(); }
private void OnTriggerEnter(Collider other) { PlayerController playerController = other.GetComponent <PlayerController>(); if (playerController != null) { Respawnable respawnable = other.GetComponent <Respawnable>(); if (respawnable != null) { respawnable.SetRespawnPoint(respawnPoint.position); } } }
public Respawnable getNext() { if (mObjectStore.Count == 0) { Debug.LogError("Not enough objects in manager: " + name); cloningPrefab(); } Respawnable nextObj = mObjectStore.First.Value; mObjectStore.RemoveFirst(); mActiveObjects.Add(nextObj); return(nextObj); }
void Start() { gHook = GetComponent <GrapplingHook> (); if (gHook == null) { Debug.LogWarning("gHook is Null"); } mPick = GetComponent <Pickaxe>(); respawn = GetComponent <Respawnable>(); stun = GetComponent <Stunnable>(); avatar = GetComponent <Avatar>(); if (avatar == null) { Debug.LogError("Avatar is Null"); } playerAssignCR = StartCoroutine(WaitForPlayerAssign()); }
//Когда сработал триггер private void OnTriggerEnter2D(Collider2D other) { //Временная переменная, чтобы запомнить, кто вошел Respawnable respawnable = null; Destroyable destroyable = null; //Запоминаем, кто вошел и, если он имеет скрипт Respawnable if (other.gameObject.TryGetComponent(out respawnable) != false) { //То вызываем его метод Respawn() respawnable.Respawn(); } if (other.gameObject.TryGetComponent(out destroyable) != false) { destroyable.Destroy(); } }
private void OnTriggerExit(Collider other) { // Respawn an object that comes in contact. Respawnable respawnable = other.GetComponent <Respawnable>(); if (!respawnable) { respawnable = other.GetComponentInParent <Respawnable>(); } if (respawnable && !respawnable.WaitingForFirstGrab) { Vector3 directionToCenter = (other.transform.position - PlayerPosition).normalized; Vector3 respawnPosition = other.transform.position - directionToCenter * .5f; if (!respawnable.IsGrabbed) { Respawn(respawnable, respawnPosition); } else { respawnable.plannedRespawnPosition = respawnPosition; } } }
// Use this for initialization void Start() { cameratized = GetComponent <Cameratized> (); respawnable = GetComponent <Respawnable> (); vehicleController = GetComponent <VehicleController> (); }
public void setToStore(Respawnable obj) { mActiveObjects.Remove(obj); mObjectStore.AddLast(obj); }
// Use this for initialization void Start() { // TODO: Requires? respawnable = GetComponent <Respawnable> (); vehicleController = GetComponent <VehicleController> (); }
/// <summary> /// Assigns the Respawnable to this checkpoint /// </summary> /// <param name="listener"></param> public virtual void AssignObjectToCheckPoint(Respawnable listener) { _listeners.Add(listener); }