Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
fixed for v36.0 + balanced
  • Loading branch information
bennik06 authored Apr 5, 2023
1 parent 6ba4f5f commit 264b1de
Show file tree
Hide file tree
Showing 8 changed files with 974 additions and 0 deletions.
87 changes: 87 additions & 0 deletions Displays.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using BTD_Mod_Helper.Api.Display;
using Il2CppAssets.Scripts.Models.Towers;
using Il2CppAssets.Scripts.Unity.Display;
using System.Linq;
using static marinetower.Main;

namespace marinetower
{
internal class Displays
{
public class MarineBaseDisplay : ModTowerDisplay<Marinetower>
{
public override string BaseDisplay => GetDisplay(TowerType.Marine);

public override bool UseForTower(int[] tiers)
{
return tiers.Sum() == 0;
}

public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, Name);
}
}

public class Top5Display : ModTowerDisplay<Marinetower>
{
public override string BaseDisplay => GetDisplay(TowerType.Marine);

public override bool UseForTower(int[] tiers)
{
return tiers[0] == 5;
}

public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, Name);
}
}

public class Middle5Display : ModTowerDisplay<Marinetower>
{
public override string BaseDisplay => GetDisplay(TowerType.Marine);

public override bool UseForTower(int[] tiers)
{
return tiers[1] == 5;
}

public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, Name);
}
}

public class Bottom4Display : ModTowerDisplay<Marinetower>
{
public override string BaseDisplay => GetDisplay(TowerType.Marine);

public override bool UseForTower(int[] tiers)
{
return tiers[2] == 4;
}

public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, Name);
}
}

public class Bottom5Display : ModTowerDisplay<Marinetower>
{
public override float Scale => 1.05f;
public override string BaseDisplay => GetDisplay(TowerType.Marine);

public override bool UseForTower(int[] tiers)
{
return tiers[2] == 5;
}

public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, Name);
}
}
}
}
70 changes: 70 additions & 0 deletions Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using Il2CppAssets.Scripts.Models;
using Il2CppAssets.Scripts.Models.Towers.Projectiles;
using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors;
using Il2CppSystem.Collections.Generic;
using Il2CppInterop.Runtime.InteropTypes.Arrays;

namespace marinetower
{
static class Extensions
{
public static Il2CppReferenceArray<T> Add<T>(this Il2CppReferenceArray<T> reference, T newPart) where T : Model
{
List<T> list = new();
foreach (T item in reference)
{
list.Add(item);
}
list.Add(newPart);
return new Il2CppReferenceArray<T>(list.ToArray());
}

public static Il2CppReferenceArray<T> Add<T>(this Il2CppReferenceArray<T> reference, List<T> newPart) where T : Model
{
List<T> list = new();
foreach (T item in reference)
{
list.Add(item);
}
foreach (T item2 in newPart)
{
list.Add(item2);
}
return new Il2CppReferenceArray<T>(list.ToArray());
}


public static ProjectileModel SetPierce(this ProjectileModel pm,float pierce,bool infiniteMax=true)
{
pm.pierce = pierce;
pm.maxPierce = infiniteMax?999999:pierce;
pm.CapPierce(infiniteMax ? 999999 : pierce);

return pm;
}

public static DamageModel SetDamage(this DamageModel dm, float damage, bool infiniteMax = true)
{
dm.damage = damage;
dm.maxDamage = infiniteMax ? 999999 : damage;
dm.CapDamage(infiniteMax ? 999999 : damage);

return dm;
}

//public static Transform FindDeepChild(this Transform aParent, string aName)
//{
// System.Collections.Generic.Queue<Transform> queue = new System.Collections.Generic.Queue<Transform>();
// queue.Enqueue(aParent);
// while (queue.Count > 0)
// {
// var c = queue.Dequeue();
// if (c.name == aName)
// return c;
// foreach (Transform t in c)
// queue.Enqueue(t);
// }
// return null;
//}
}
}
Binary file added Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 264b1de

Please sign in to comment.