コード例 #1
0
        public ScriptedObject DeepCloneWithScriptableObjectType(ScriptableObjectType scriptableObjectType)
        {
            var result = new ScriptedObject(
                this.Name?.DeepClone(),
                scriptableObjectType,
                this.DropScript?.DeepClone(),
                this.CreateScript?.DeepClone());

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptedObject"/> class.
        /// </summary>
        /// <param name="name">Name of the object.</param>
        /// <param name="scriptableObjectType">The type of scripted object.</param>
        /// <param name="dropScript">Script to drop the object.</param>
        /// <param name="createScript">Script to create the object.</param>
        public ScriptedObject(
            string name,
            ScriptableObjectType scriptableObjectType,
            string dropScript,
            string createScript)
        {
            new { name }.AsArg().Must().NotBeNullNorWhiteSpace();
            new { scriptableObjectType }.AsArg().Must().NotBeEqualTo(ScriptableObjectType.Invalid);
            new { dropScript }.AsArg().Must().NotBeNullNorWhiteSpace();
            new { createScript }.AsArg().Must().NotBeNullNorWhiteSpace();

            this.Name = name;
            this.ScriptableObjectType = scriptableObjectType;
            this.DropScript           = dropScript;
            this.CreateScript         = createScript;
        }