//treat it like any other component void Update() { if (Input.GetKey(KeyCode.P)) { ModAPI.Notify("gamer is holding the P key"); } }
public static void Main() { // listen for the event that is fired when wires are created ModAPI.OnWireCreated += (sender, wire) => { // check if it is a spring cable if (wire is SpringCableBehaviour) { // make it red wire.SetColor(Color.red); // make it thinner wire.SetThickness(0.05f); } }; // listen for the event that is fired when something is killed ModAPI.OnDeath += (sender, being) => { //notify player of their action ModAPI.Notify("this is really immoral"); }; // listen for gunshot event ModAPI.OnGunShot += (sender, gun) => { //notify player what round the gun uses ModAPI.Notify(gun.Cartridge.name); }; }
private void Awake() { this.Seed = 0; this.mask = (LayerMask)LayerMask.GetMask("Objects", "Bounds"); if (Mathf.Approximately((float)this.gameObject.transform.position.x, (float)170.9647)) { glitched = true; } else { ModAPI.Notify("nice"); } }
// Update is called once per frame void Update() { Collider2D aliveObjectInRadius = Physics2D.OverlapCircle(transform.position, 5f, LayerMask.GetMask("Objects")); //gun.GetComponent<FirearmBehaviour>().barrelPosition = transform.position; //gun.GetComponent<FirearmBehaviour>().barrelDirection = -transform.up; if (aliveObjectInRadius) { /*canFire = true; * if (canFire) * { * firearmBehaviour.Shoot(); * ModAPI.Notify("OPEN FIRE OPEN FIRE"); * }*/ if (Input.anyKeyDown) { buttonPressed = true; } if (buttonPressed) { limbs = FindObjectsOfType <LimbBehaviour>(); ModAPI.Notify("Pressed"); buttonPressed = false; } foreach (LimbBehaviour limb in limbs) { float Threshold = 1e-3f; Vector2 dir = gun.transform.InverseTransformPoint(limbs[13].transform.position); float angle = Vector2.Angle(Vector2.right, dir); angle = dir.y < 0 ? -angle : angle; if (Mathf.Abs(angle) > Threshold) { gun.transform.Rotate(0, 0, (angle + 90) * 10 * Time.deltaTime); } //gun.GetComponent<FirearmBehaviour>().ShootContinuous(); } } }
void Start() { string modPath = Application.dataPath + "/../" + ModAPI.Metadata.MetaLocation; Debug.Log("Path is " + modPath); if (File.Exists(Path.Combine(modPath, "JFramework.dll"))) { string path = Path.Combine(modPath, "JFramework.dll"); Debug.Log("Main DLL found at " + path); ModAPI.Notify("Main DLL found at " + path); Assembly mainAssembly = Assembly.LoadFile(path); mainAssembly.GetType("JFramework.Main").GetField("modPath", BindingFlags.Static | BindingFlags.Public).SetValue(null, modPath); mainAssembly.GetType("JFramework.Main").GetMethod("Entry").Invoke(null, new object[0]); } else { Debug.LogError("Main DLL could not be found in mod folder, please try to reinstall the mod"); ModAPI.Notify("Main DLL could not be found in mod folder, please try to reinstall the mod"); } }