Beispiel #1
0
    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);
    }
Beispiel #2
0
    private CheckpointBoundary FindObjectIdCheckpointBoundary()
    {
        GameObject foundCheckPointBoundaryGameObject = ObjectId.Find(checkPointBoundaryId);

        if (foundCheckPointBoundaryGameObject == null)
        {
            return(null);
        }

        CheckpointBoundary checkpointBoundary = foundCheckPointBoundaryGameObject.GetComponent <CheckpointBoundary>();

        return(checkpointBoundary);
    }
Beispiel #3
0
    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;
    }
Beispiel #4
0
    private CheckpointBoundary GetCheckpointBoundary()
    {
        if (!string.IsNullOrEmpty(checkPointBoundaryId))
        {
            CheckpointBoundary foundCheckpointBounadry = FindObjectIdCheckpointBoundary();

            if (foundCheckpointBounadry != null)
            {
                return(foundCheckpointBounadry);
            }
        }
        CheckpointBoundary generatedCheckpointBoundary = GenerateCheckpointBoundary(ref checkPointBoundaryId);

        return(generatedCheckpointBoundary);
    }
Beispiel #5
0
    protected override void OnDestroy()
    {
        CheckpointBoundary checkpointBoundary = FindObjectIdCheckpointBoundary();

        if (checkpointBoundary == null)
        {
            return;
        }
        if (Application.isPlaying)
        {
            Destroy(checkpointBoundary.gameObject);
        }
        else
        {
            DestroyImmediate(checkpointBoundary.gameObject);
        }
    }
Beispiel #6
0
    private void GenerateBoundary()
    {
        CheckpointBoundary checkpointBoundary = GetCheckpointBoundary();

        checkpointBoundary.UpdateBoundary(transform, GetRaycastHitUp(), GetRaycastHitDown());
    }