コード例 #1
0
        public override object Create(object instance)
        {
            CreatedObjects.Add(instance);

            switch (instance.GetType().Name)
            {
            case "Project":
                return(555L);

            default:
                return(555);
            }
        }
コード例 #2
0
    public void Add(object obj)
    {
        if (obj == null)
        {
            return;
        }
        var type = obj.GetType();

        if (type.IsValueType || type == typeof(string))
        {
            return;
        }
        CreatedObjects.Add(obj);
    }
コード例 #3
0
        private void CreateObject()
        {
            CurrentState = ObjectManagerState.CREATING;

            // Create the object at midpoint between the two pinches
            Vector3 position = (_rightHandPinchDetector.Position - _leftHandPinchDetector.Position) * 0.5f;

            // Create the object and add to a list of objects
            GameObject newObject = Instantiate(_interactableObjects[_currentObjectTypeIndex].prefab, position, Quaternion.identity, _objectContainer) as GameObject;

            _currentObject = newObject.GetComponent <IInteractableObjectController>();
            CreatedObjects.Add(_currentObject);
            _currentObject.Create(_interactionManager, _leftHandPinchDetector, _rightHandPinchDetector);
        }
コード例 #4
0
    /*
     * Creates a prefab by searching for one with the given name.
     * If prefab with specified name doesn't exist, it throws an error.
     */
    public static GameObject InstantiatePrefab(string prefabName, Vector3 position, Quaternion rotation)
    {
        // Find the prefab. If the prefab doesn't exist, throw an error.
        GameObject prefab = FindPrefabWithName(prefabName);

        if (prefab == null)
        {
            throw new System.Exception("Cannot instantiate prefab: No such prefab exists.");
        }
        // If it doesn't have a UniqueID object, also throw error.
        if (prefab.GetComponent <ES2UniqueID>() == null)
        {
            throw new System.Exception("Can't instantiate a prefab which has no UniqueID attached.");
        }

        // Instantiate our prefab and then add it to the created prefabs list.
        GameObject createdObject = Instantiate(prefab, position, rotation) as GameObject;

        CreatedObjects.Add(createdObject);

        return(createdObject);
    }
コード例 #5
0
 public override object Create(object instance)
 {
     CreatedObjects.Add(instance);
     return(446L);
 }