コード例 #1
0
            /// <summary>
            /// Creates a new creature of the specified boardAssetId, at the specified position, and returns it's CreaturedId.
            /// </summary>
            /// <param name="boardAssetId">The board asset to create.</param>
            /// <param name="position">The position to place the new asset.</param>
            /// <returns>The CreatureId as a string.</returns>
            public static string InstantiateCreature(string boardAssetId, Vector3 position)
            {
                CreatureDataV1 creatureDataV1 = new CreatureDataV1(new Bounce.Unmanaged.NGuid(boardAssetId));
                CreatureDataV2 creatureDataV2 = new CreatureDataV2(creatureDataV1);                   // IsCreated is set to true in this call. Seems necessary.

                creatureDataV2.CreatureId = new CreatureGuid(new Bounce.Unmanaged.NGuid(Guid.NewGuid()));
                CreatureManager.CreateAndAddNewCreature(creatureDataV2, position, Quaternion.identity);
                BuildingBoardTool.RecordInBuildHistory(creatureDataV2.GetActiveBoardAssetId());
                return(creatureDataV2.CreatureId.Value.ToString());
            }