Ejemplo n.º 1
0
        /// <summary>
        /// Registers a CustomFish object into the game
        /// </summary>
        /// <param name="fish">The CustomFish that you are registering</param>
        /// <returns>The TechType created using the info from your CustomFish object</returns>
        TechType IFishHandler.RegisterFish(Fish fish)
        {
            TechType type = TechTypeHandler.AddTechType(fish.id, fish.displayName, fish.tooltip);

            fishTechTypes.Add(type);

            FishPrefab fishPrefab = new FishPrefab(fish.id, $"WorldEntities/Tools/{fish.id}", type)
            {
                modelPrefab     = fish.modelPrefab,
                swimSpeed       = fish.swimSpeed,
                swimRadius      = fish.swimRadius,
                swimInterval    = fish.swimInterval,
                pickupable      = fish.isPickupable,
                isWaterCreature = fish.isWaterCreature
            };

            if (!string.IsNullOrEmpty(fish.spriteFileName))
            {
                SpriteHandler.RegisterSprite(type, Path.Combine(Path.Combine(Environment.CurrentDirectory, "QMods"), fish.spriteFileName));
            }

            PrefabHandler.RegisterPrefab(fishPrefab);

            Logger.Debug($"Successfully registered fish: '{fish.displayName}' with Tech Type: '{fish.id}'");

            return(type);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Registers a CustomFish object into the game
        /// </summary>
        /// <param name="fish">The CustomFish that you are registering</param>
        /// <returns>The TechType created using the info from your CustomFish object</returns>
        public static TechType RegisterFish(CustomFish fish)
        {
            Logger.Log($"[FishFramework] Creating fish: {fish.displayName}");
            TechType type = TechTypeHandler.AddTechType(fish.id, fish.displayName, fish.tooltip);

            fishTechTypes.Add(type);

            CustomFishPrefab fishPrefab = new CustomFishPrefab(fish.id, $"WorldEntities/Tools/{fish.id}", type)
            {
                modelPrefab     = fish.modelPrefab,
                swimSpeed       = fish.swimSpeed,
                swimRadius      = fish.swimRadius,
                swimInterval    = fish.swimInterval,
                pickupable      = fish.isPickupable,
                isWaterCreature = fish.isWaterCreature
            };

            if (!string.IsNullOrEmpty(fish.spriteFileName))
            {
                SpriteHandler.RegisterSprite(type, Path.Combine(Environment.CurrentDirectory + "/QMods/", fish.spriteFileName));
            }

            PrefabHandler.RegisterPrefab(fishPrefab);

            return(type);
        }