private CheckpointBoundary GenerateCheckpointBoundary(ref string id) { CheckpointBoundary checkPointBoundaryPrefab = Resources.Load <CheckpointBoundary>(CHECKPOINT_BOUNDARY_PREFAB_PATH); CheckpointBoundary checkpointBoundary = Instantiate(checkPointBoundaryPrefab); ObjectId checkpointBoundaryObjectId = checkpointBoundary.gameObject.GetComponent <ObjectId>(); id = checkpointBoundaryObjectId.GenerateId(); #if UNITY_EDITOR EditorGUIUtility.systemCopyBuffer = checkpointBoundaryObjectId.Id; #endif return(checkpointBoundary); }
private CheckpointBoundary FindObjectIdCheckpointBoundary() { GameObject foundCheckPointBoundaryGameObject = ObjectId.Find(checkPointBoundaryId); if (foundCheckPointBoundaryGameObject == null) { return(null); } CheckpointBoundary checkpointBoundary = foundCheckPointBoundaryGameObject.GetComponent <CheckpointBoundary>(); return(checkpointBoundary); }
private void Awake() { CheckpointBoundary foundCheckpointBoundary = FindObjectIdCheckpointBoundary(); if (foundCheckpointBoundary == null) { Debug.LogWarning(name + " Found no reference to checkpoint boundary", this); } animatedBody = GetComponent <AnimatedBody>(); animatedBody.OriginalScale = transform.localScale; transform.localScale = Vector2.zero; }
private CheckpointBoundary GetCheckpointBoundary() { if (!string.IsNullOrEmpty(checkPointBoundaryId)) { CheckpointBoundary foundCheckpointBounadry = FindObjectIdCheckpointBoundary(); if (foundCheckpointBounadry != null) { return(foundCheckpointBounadry); } } CheckpointBoundary generatedCheckpointBoundary = GenerateCheckpointBoundary(ref checkPointBoundaryId); return(generatedCheckpointBoundary); }
protected override void OnDestroy() { CheckpointBoundary checkpointBoundary = FindObjectIdCheckpointBoundary(); if (checkpointBoundary == null) { return; } if (Application.isPlaying) { Destroy(checkpointBoundary.gameObject); } else { DestroyImmediate(checkpointBoundary.gameObject); } }
private void GenerateBoundary() { CheckpointBoundary checkpointBoundary = GetCheckpointBoundary(); checkpointBoundary.UpdateBoundary(transform, GetRaycastHitUp(), GetRaycastHitDown()); }