Skip to content

Instantly share code, notes, and snippets.

@gamesbyangelina
Created August 28, 2025 20:19
Show Gist options
  • Select an option

  • Save gamesbyangelina/0e20e0a4e9a1c027ed35083f561b1f61 to your computer and use it in GitHub Desktop.

Select an option

Save gamesbyangelina/0e20e0a4e9a1c027ed35083f561b1f61 to your computer and use it in GitHub Desktop.
Root File: Dodgeball
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using GameFeelDescriptions.Examples;
public class DodgeballRoot : MonoBehaviour
{
[Header("Prefabs")]
public List<PixiePrefab> pixiePrefabs;
public static List<PixiePrefab> _pixiePrefabs;
object[] args;
Type[] types;
Dictionary<string, Action<object[]>> hookDictionary;
Dictionary<string, int> hookCalls;
// Start is called before the first frame update
void Start()
{
hookDictionary = new Dictionary<string, Action<object[]>>();
hookCalls = new Dictionary<string, int>();
_pixiePrefabs = new List<PixiePrefab>();
foreach(PixiePrefab p in pixiePrefabs){
p.GenerateBaseSettingsTemplate();
_pixiePrefabs.Add(p);
}
//Search for any statically referenced methods that we can use
GameGeneration.RefreshStaticReferences();
GameGeneration.AddPixiePrefab(_pixiePrefabs[0], "DodgeballRoot._pixiePrefabs[0]");
GameGeneration.AddPixiePrefab(_pixiePrefabs[1], "DodgeballRoot._pixiePrefabs[1]");
GameGeneration.AddPixiePrefab(_pixiePrefabs[2], "DodgeballRoot._pixiePrefabs[2]");
//Add an external method that cannot be annotated because we don't have source access
GameGeneration.AddExternalMethod("UnityEngine.Vector2, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "Reflect");
GameGeneration.ForceAddField("GameFeelDescriptions.Examples.NormalBall, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"transform.localScale",
"UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
GameGeneration.ForceAddField("GameFeelDescriptions.Examples.NormalBall, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"transform.position",
"UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
AssemblyEvolution.instance.Setup(
new DodgeballRunSpec()
);
AssemblyEvolution.instance.EvolveViaSimpleMutation(
new HookSpec("onBounce", typeof(NormalBall), typeof(BallController)),
new HookSpec("onStart", typeof(BallController))
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment