public void DefaultDroneDebris() { debrisSprites = new Sprite[] { ModAPI.LoadSprite("Sprites/Debris1Spr.png", 1), ModAPI.LoadSprite("Sprites/Debris2Spr.png", 1), ModAPI.LoadSprite("Sprites/Debris3Spr.png", 1), ModAPI.LoadSprite("Sprites/Debris4Spr.png", 1), }; }
public void setBigBlade(Transform parent, Vector3 rotation, Vector2 position) { GameObject bigBlade = new GameObject(); bigBlade.transform.eulerAngles = rotation; bigBlade.transform.position = position; bigBlade.transform.SetParent(parent); bigBlade.AddComponent<PhysicalBehaviour>(); bigBlade.AddComponent<RotateComponent>(); bigBlade.AddComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/Rotor2.png"); }
public void SuiciderDroneDebris() { debrisSprites = new Sprite[] { ModAPI.LoadSprite("Sprites/SuiciderDebris1.png", 1), ModAPI.LoadSprite("Sprites/SuiciderDebris2.png", 1), ModAPI.LoadSprite("Sprites/SuiciderDebris3.png", 1), ModAPI.LoadSprite("Sprites/SuiciderDebris4.png", 1), }; }
// Start is called before the first frame update void Start() { sentryBehaviour = gameObject.AddComponent <SentryTurretBehaviour>(); gun = new GameObject(); gun.AddComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/Gun.png"); gun.AddComponent <LaserModBehaviour>(); gun.AddComponent <FirearmBehaviour>(); gun.GetComponent <FirearmBehaviour>().Automatic = true; limbs = FindObjectsOfType <LimbBehaviour>(); }
// Start is called before the first frame update void Start() { bomberArms = new GameObject(); bomberArms.transform.SetParent(transform); bomberArms.AddComponent <PhysicalBehaviour>(); bomberArms.AddComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/BomberArms.png"); bomberArms.GetComponent <SpriteRenderer>().sortingOrder = 2; bombPreview = new GameObject(); bombPreview.transform.position = new Vector2(bomberArms.transform.position.x, bomberArms.transform.position.y - .1f); bombPreview.transform.SetParent(bomberArms.transform); bombPreview.AddComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/Bomb.png"); bomberArms.GetComponent <SpriteRenderer>().sortingOrder = 1; GetComponent <SpriteRenderer>().sortingOrder = 3; }
public static void Main() { //Normal Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Flying Drone -DM", // Name. NameToOrderByOverride = "Android 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"), //Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/DroneView.png", 5f), //Thumbnail AfterSpawn = (Instance) => { Instance.AddComponent<DroneModBehaviour>(); //Base script of the drone Instance.AddComponent<SoundSystem>(); //Everyone loves sound Instance.AddComponent<DebrisComponent>().DefaultDroneDebris(); //Set debris for explosion Instance.AddComponent<BladeBehaviour>().setSmallBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x - .3f,Instance.transform.position.y + .35f)); //Set blade type, parent, rotation and position Instance.AddComponent<BladeBehaviour>().setSmallBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x + .3f,Instance.transform.position.y + .35f)); //Set blade type, parent, rotation and position Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/DroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.FixColliders(); } } ); //Suicide Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Suicide Drone -DM", // Name. NameToOrderByOverride = "Android 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "Hoams towards any living object and explodes.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/DroneView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.AddComponent<DebrisComponent>().SuiciderDroneDebris(); Instance.AddComponent<SuiciderBehaviour>(); Instance.AddComponent<BladeBehaviour>().setBigBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x,Instance.transform.position.y + .2f)); Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/SuiciderBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<SoundSystem>(); } } ); //Turret Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Turret Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and shoots.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/TurretView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/DroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<GunBehaviour>(); Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); } } ); //Bomber Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Bomber Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and bombs.\n\nDesign by BombErik#6969. \nCreated by _Kassjak_#4463",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/BomberView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.AddComponent<BladeBehaviour>().setBigBlade(Instance.transform, Instance.transform.eulerAngles, new Vector2(Instance.transform.position.x,Instance.transform.position.y + .2f)); Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/BomberBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<BomberBehaviour>(); } } ); //Speaker Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Speaker Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and speaks",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/SpeakerView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/TransportDroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.FixColliders(); Instance.AddComponent<DebrisComponent>().SuiciderDroneDebris(); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<SoundSystem>(); } } ); //Speakersss Drone ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Brick"), // Searches the ingame catalog and returns with the inputted string if possible. NameOverride = "Speaker Drone -DM", // Name. NameToOrderByOverride = "Brick 2", // How the item is ordered (I didn't want it in the 'G' section, so I renamed it to Brick 2, so it shows up next to the brick.) DescriptionOverride = "It flies and speaks",// Description CategoryOverride = ModAPI.FindCategory("Entities"),//Category ThumbnailOverride = ModAPI.LoadSprite("Sprites/SpeakerView.png", 5f),//Thumbnail AfterSpawn = (Instance) => { Instance.GetComponent<PhysicalBehaviour>().Properties = ModAPI.FindPhysicalProperties("Metal"); Instance.GetComponent<SpriteRenderer>().sprite = ModAPI.LoadSprite("Sprites/MagnetDroneBody.png"); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.FixColliders(); Instance.AddComponent<DebrisComponent>().SuiciderDroneDebris(); Instance.GetComponent<PhysicalBehaviour>().rigidbody.drag = 0.5f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.angularDrag = 0f; Instance.GetComponent<PhysicalBehaviour>().rigidbody.gravityScale = 1f; Instance.AddComponent<DroneModBehaviour>(); Instance.FixColliders(); Instance.AddComponent<SoundSystem>(); } } ); }
// Update is called once per frame void Update() { armExtractPos = new Vector2(transform.position.x, transform.position.y - .2f); armRetractPos = new Vector2(transform.position.x, transform.position.y); if (readyToDropBomb) { bombPreview.SetActive(true); bomberArms.transform.position = armExtractPos; timeTillDrop += Time.deltaTime; if (timeTillDrop > 2) { GameObject bomb = ModAPI.CreatePhysicalObject("BOMB", ModAPI.LoadSprite("Sprites/Bomb.png")); bomb.transform.position = bombPreview.transform.position; if (!bomb.GetComponent <BombComponent>()) { bomb.AddComponent <BombComponent>(); } cooldown = true; cooldownTime = 5; readyToDropBomb = false; bombPreview.SetActive(false); } else { if (timeTillDrop > 1.9) { GetComponent <DroneModBehaviour>().overwriteHover = true; } } } else { bomberArms.transform.position = armRetractPos; timeTillDrop = 0; } if (cooldown) { cooldownTime -= Time.deltaTime; } if (cooldownTime <= 0) { cooldown = false; } Collider2D aliveObjectInRadius = Physics2D.OverlapCircle(transform.position, 10f, LayerMask.GetMask("Objects")); if (aliveObjectInRadius.gameObject.GetComponent <LimbBehaviour>()) { targetObjLoc = aliveObjectInRadius.transform.position - transform.position; if (!cooldown) { readyToDropBomb = true; targetObjLoc.Normalize(); GetComponent <PhysicalBehaviour>().rigidbody.velocity = new Vector2(targetObjLoc.x * movSpeed, GetComponent <PhysicalBehaviour>().rigidbody.velocity.y); } else { GetComponent <PhysicalBehaviour>().rigidbody.velocity = new Vector2(-targetObjLoc.x * movSpeed / 2, GetComponent <PhysicalBehaviour>().rigidbody.velocity.y); } } else { if (cooldown) { if (GetComponent <PhysicalBehaviour>().rigidbody.velocity.magnitude > .3) { GetComponent <PhysicalBehaviour>().rigidbody.velocity = new Vector2(GetComponent <PhysicalBehaviour>().rigidbody.velocity.x / cooldownTime, GetComponent <PhysicalBehaviour>().rigidbody.velocity.y); } } readyToDropBomb = false; } }
public static void Main() { ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Shotgun"), NameOverride = "Doom Shotgun", NameToOrderByOverride = "Doom Shotgun", DescriptionOverride = "This is my boomstick", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("ShotgunIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <FirearmBehaviour>(); firearm.BulletsPerShot = 7; firearm.ShotSounds = new AudioClip[] { ModAPI.LoadSound("DSSHOTGN.wav") }; Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("SHOTA0.png", 1.5f); BoxCollider2D[] colliders = Instance.GetComponents <BoxCollider2D>(); for (int i = 0; i < colliders.Length; i++) { UnityEngine.GameObject.Destroy(colliders[i]); } var barrel = Instance.AddComponent <BoxCollider2D>(); barrel.offset = new Vector2(0.2967865f, 0.08143535f); barrel.size = new Vector2(1.206427f, 0.1799865f); var handle = Instance.AddComponent <BoxCollider2D>(); handle.offset = new Vector2(-0.6044311f, -0.03619349f); handle.size = new Vector2(0.5911378f, 0.2921863f); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Shotgun"), NameOverride = "Doom Super Shotgun", NameToOrderByOverride = "Doom Super Shotgun", DescriptionOverride = "This is my boomstick", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("SuperShotgunIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <FirearmBehaviour>(); firearm.InitialInaccuracy = 0.2f; firearm.BulletsPerShot = 20; firearm.ShotSounds = new AudioClip[] { ModAPI.LoadSound("SSG.wav") }; BoxCollider2D[] colliders = Instance.GetComponents <BoxCollider2D>(); for (int i = 0; i < colliders.Length; i++) { UnityEngine.GameObject.Destroy(colliders[i]); } Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("SGN2A0.png", 1f); var barrel = Instance.AddComponent <BoxCollider2D>(); barrel.offset = new Vector2(0.3513924f, 0.1270209f); barrel.size = new Vector2(0.8375123f, 0.139269f); var handle = Instance.AddComponent <BoxCollider2D>(); handle.offset = new Vector2(-0.5533118f, -0.02573015f); handle.size = new Vector2(0.4336729f, 0.3489566f); var middleHandle = Instance.AddComponent <BoxCollider2D>(); middleHandle.offset = new Vector2(-0.2005489f, 0.05699047f); middleHandle.size = new Vector2(0.2645392f, 0.1792521f); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Red Barrel"), NameOverride = "Doom Explosive Barrel", NameToOrderByOverride = "Doom Explosive Barrel", DescriptionOverride = "haha barrel go boom", CategoryOverride = ModAPI.FindCategory("Explosives"), ThumbnailOverride = ModAPI.LoadSprite("BarrelIcon.png", 5f), AfterSpawn = (Instance) => { /*todo: figure out explosion sounds*/ Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("BAR1A0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Light Machine Gun"), NameOverride = "Doom Chaingun", NameToOrderByOverride = "Doom Chaingun", DescriptionOverride = "makes the pistol useless", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("ChaingunIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <FirearmBehaviour>(); firearm.ShotSounds = new AudioClip[] { ModAPI.LoadSound("DSPISTOL.wav") }; Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("MGUNA0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Machine Blaster"), NameOverride = "Doom Plasma Rifle", NameToOrderByOverride = "Doom Plasma Rifle", DescriptionOverride = "it's not a Plasma Gun it's a Plasma RIFLE", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("PlasmaIcon.png", 5f), AfterSpawn = (Instance) => { /**/ //get rid of yellow light thingys UnityEngine.Object.Destroy(Instance.transform.GetChild(0).gameObject); UnityEngine.Object.Destroy(Instance.transform.GetChild(1).gameObject); UnityEngine.Object.Destroy(Instance.transform.GetChild(2).gameObject); var firearm = Instance.GetComponent <BlasterBehaviour>(); var Bolt = firearm.Bolt; Color c1 = new Color(0, 0, 1, 1); Color c2 = new Color(0, 0, 1, 1); Bolt.GetComponent <BlasterboltBehaviour>().lineRenderer.SetColors(c1, c2); firearm.Clips = new AudioClip[] { ModAPI.LoadSound("DSPLASMA.wav") }; Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("PLASA0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Rocket Launcher"), NameOverride = "Doom Rocket Launcher", NameToOrderByOverride = "Doom Rocket Launcher", DescriptionOverride = "makes badguys go boom", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("RocketLauncherIcon.png", 5f), AfterSpawn = (Instance) => { var firearm = Instance.GetComponent <RocketLauncherBehaviour>(); //have to do this to prevent it from being replaced by BFG ball // UnityEngine.GameObject.Destroy(Projectile.GetComponent<BFGProjectile>()); // Projectile.AddComponent<LaunchedRocketBehaviour>(); firearm.AudioSource.clip = ModAPI.LoadSound("DSRLAUNC.wav"); Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("LAUNA0.png", 1f); Instance.FixColliders(); } } ); ModAPI.Register( new Modification() { OriginalItem = ModAPI.FindSpawnable("Rocket Launcher"), NameOverride = "Doom BFG 9000", NameToOrderByOverride = "Doom BFG 9000", DescriptionOverride = "Big F*****g Gun 9000", CategoryOverride = ModAPI.FindCategory("Firearms"), ThumbnailOverride = ModAPI.LoadSprite("BFGIcon.png", 5f), AfterSpawn = (Instance) => { // UnityEngine.GameObject.Destroy(Instance.GetComponent<RocketLauncherBehaviour>()); //Instance.AddComponent<BFG9000Behaviour>(); var firearm = Instance.GetComponent <RocketLauncherBehaviour>(); GameObject bfgball = UnityEngine.GameObject.Instantiate(firearm.Projectile); //Resources.Load("Assets/PrefabInstance/LaunchedRocket.prefab") as GameObject; //UnityEngine.GameObject.Instantiate(firearm.Projectile); firearm.Projectile = bfgball; bfgball.AddComponent <BFGProjectile>(); firearm.AudioSource.clip = ModAPI.LoadSound("DSBFG.wav"); Instance.GetComponent <SpriteRenderer>().sprite = ModAPI.LoadSprite("BFUGA0.png", 1f); Instance.FixColliders(); UnityEngine.GameObject.Destroy(bfgball.GetComponent <LaunchedRocketBehaviour>()); } } ); }