Skip to content

Commit 184fde7

Browse files
committed
Episode 9
1 parent c007948 commit 184fde7

6 files changed

Lines changed: 73 additions & 2 deletions

File tree

CustomModelTower-Icon.png

85 KB
Loading

CustomModelTower.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using BTD_Mod_Helper.Api.Display;
2+
using BTD_Mod_Helper.Api.Towers;
3+
using BTD_Mod_Helper.Extensions;
4+
using Il2CppAssets.Scripts.Models.Towers;
5+
using Il2CppAssets.Scripts.Models.TowerSets;
6+
using Il2CppAssets.Scripts.Unity.Display;
7+
using System;
8+
using System.Collections.Generic;
9+
using System.Linq;
10+
using System.Text;
11+
using System.Threading.Tasks;
12+
using UnityEngine;
13+
14+
namespace ExampleMod
15+
{
16+
internal class CustomModelTower : ModTower
17+
{
18+
public override TowerSet TowerSet => TowerSet.Primary;
19+
20+
public override string BaseTower => TowerType.DartMonkey;
21+
22+
public override string Description => "A tower with a custom model & animation. Functionally a dart monkey.";
23+
24+
public override int Cost => 200;
25+
26+
public override string Portrait => Icon;
27+
28+
public override void ModifyBaseTowerModel(TowerModel towerModel)
29+
{
30+
}
31+
}
32+
33+
internal class CustomModelDisplay : ModTowerCustomDisplay<CustomModelTower>
34+
{
35+
public override string AssetBundleName => "examplemod";
36+
37+
public override string PrefabName => "CustomTower";
38+
39+
public override bool UseForTower(params int[] tiers)
40+
{
41+
return tiers.Sum() >= 0;
42+
}
43+
44+
public override void ModifyDisplayNode(UnityDisplayNode node)
45+
{
46+
foreach(var meshRenderer in node.GetMeshRenderers())
47+
{
48+
if (!meshRenderer.name.Contains("Cylinder.003"))
49+
{
50+
meshRenderer.ApplyOutlineShader();
51+
}
52+
53+
meshRenderer.SetOutlineColor(Color.cyan);
54+
}
55+
}
56+
}
57+
}

ExampleMod.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
using BTD_Mod_Helper;
33
using ExampleMod;
44
using BTD_Mod_Helper.Api.ModOptions;
5+
using Il2CppAssets.Scripts.Simulation.Towers.Weapons;
6+
using BTD_Mod_Helper.Extensions;
7+
using BTD_Mod_Helper.Api;
8+
using UnityEngine;
59

610
[assembly: MelonInfo(typeof(ExampleMod.ExampleMod), ModHelperData.Name, ModHelperData.Version, ModHelperData.RepoOwner)]
711
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
@@ -51,5 +55,15 @@ public override void OnApplicationStart()
5155
category = Category,
5256
description = "What the attack speed is multiplied by"
5357
};
54-
58+
59+
public override void OnWeaponFire(Weapon weapon)
60+
{
61+
var tower = weapon.attack.tower;
62+
63+
if(tower.towerModel.baseId == ModContent.TowerID<CustomModelTower>())
64+
{
65+
//tower.GetUnityDisplayNode().gameObject.GetComponent<Animator>().SetTrigger("Attack");
66+
tower.GetUnityDisplayNode().animationComponent.SetTrigger("Attack");
67+
}
68+
}
5569
}

Icon.png

21.3 KB
Loading

ModHelperData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace ExampleMod;
33
public static class ModHelperData
44
{
55
public const string WorksOnVersion = "39.0";
6-
public const string Version = "1.8.0";
6+
public const string Version = "1.9.0";
77
public const string Name = "(Unofficial) Example Mod";
88

99
public const string Description = "An Example Mod For my Youtube Series, look at the github for more info. If you have any questions contact me on discord: @lerpmcgerk";

examplemod.bundle

54.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)