public static void PlasmaMonkeyFanClub(TowerModel model) { model.GetWeapon().rate *= 0.03f / .475f; model.range += 20; model.GetAttackModels()[0].range += 20; ProjectileModel plasmaModel = Game.instance.model.GetTower(SuperMonkey, 2, 0, 0).GetWeapon().projectile; foreach (var weaponProjectile in model.GetAllProjectiles()) { if (weaponProjectile.display == null) { continue; } weaponProjectile.display = plasmaModel.display; weaponProjectile.GetBehavior <DisplayModel>().display = plasmaModel.display; weaponProjectile.GetDamageModel().damage += 2; weaponProjectile.GetDamageModel().damageTypes = new Il2CppStringArray(new[] { "Plasma" }); weaponProjectile.pierce += 5; weaponProjectile.GetBehavior <TravelStraitModel>().lifespan *= 2f; weaponProjectile.GetBehavior <TravelStraitModel>().lifespanFrames *= 2; } }
public static void SetHitCamo(this ProjectileModel projectileModel, bool canHitCamo) { var projectileFilterModel = projectileModel.GetBehavior <ProjectileFilterModel>(); if (projectileFilterModel == null) { projectileModel.AddBehavior(new ProjectileFilterModel("ProjectileFilterModel_" + projectileModel.name, new Il2CppReferenceArray <FilterModel>(new FilterModel[] { new FilterInvisibleModel("FilterInvisibleModel_", !canHitCamo, false) }))); } else { var filterInvisibleModel = projectileFilterModel.filters.GetItemOfType <FilterModel, FilterInvisibleModel>(); if (filterInvisibleModel == null) { projectileFilterModel.filters = projectileFilterModel.filters.AddTo(new FilterInvisibleModel("FilterInvisibleModel_", !canHitCamo, false)); } else { filterInvisibleModel.isActive = !canHitCamo; } } }
private void Setup() { m_hitSound = GetComponent <AudioSource>(); m_projectileModel = GetComponent <ProjectileModel>(); m_projectileModel.OnCollision += HitEffects; m_projectileModel.OnApplyDamage += OnApplyDamage; }
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); }
void Awake() { this.projectileController = GetComponentInChildren <ProjectileController>(); projectileModel = new ProjectileModel(); projectileController.projectileModel = projectileModel; projectileView = GetComponentInChildren <ProjectileView>(); projectileController.projectileView = projectileView; projectileView.projectileModel = projectileModel; projectileView.projectileController = projectileController; }
public static bool CanHitCamo(this ProjectileModel projectileModel) { var projectileFilterModel = projectileModel.GetBehavior <ProjectileFilterModel>(); var filterInvisibleModel = projectileFilterModel?.filters.GetItemOfType <FilterModel, FilterInvisibleModel>(); if (filterInvisibleModel != null) { return(!filterInvisibleModel.isActive); } return(true); }
/// <summary> /// Get all Projectile Simulations that have this ProjectileModel /// </summary> public static List <Projectile> GetProjectileSims(this ProjectileModel projectileModel) { Il2CppSystem.Collections.Generic.List <Projectile> projectileSims = InGame.instance?.bridge?.GetAllProjectiles(); if (projectileSims is null || !projectileSims.Any()) { return(null); } List <Projectile> results = projectileSims .Where(projectile => projectile.projectileModel.name == projectileModel.name).ToSystemList(); return(results); }
public GattleProjectile(Vector3 pos, Vector3 direction, Game1 game, Turret turret) : base() { this.direction = direction; this.game = game; this.pos = pos; this.rot.Y = (float)Math.Atan2(direction.X, direction.Z); this.turret = turret; speed = 50; life = 300; delete = false; damage = 4f; boundingBox = new OOBB(pos, direction, 0.3f, 1); // Need to be changed to be actual projectile dimensions model = new ProjectileModel(ModelLibrary.projectile, pos, this, Color.Orange, Color.Red, game); game.modelManager.addEffect(model); }
public SentryProjectile(Vector3 pos, Vector3 direction, Game1 game, Sentry enemy) : base() { this.direction = direction; this.game = game; this.pos = pos; this.rot.Y = (float)Math.Atan2(direction.X, direction.Z); this.enemy = enemy; speed = 50; life = 120; delete = false; damage = 20; boundingBox = new OOBB(pos, direction, 0.3f, 1); // Need to be changed to be actual projectile dimensions col = new CircleCollider(pos, 0.2f); model = new ProjectileModel(this, TextureManager.elecRound64, TextureManager.elecRound64, TextureManager.elecTrail64, Color.Red, Color.Orange, game); game.modelManager.addEffect(model); }
public GunnerProjectile(Vector3 pos, Vector3 direction, Game1 game) : base() { this.direction = direction; this.game = game; this.pos = pos; this.rot.Y = (float)Math.Atan2(direction.X, direction.Z); speed = 40; life = 120; delete = false; damage = 20; c1 = new Color(255, 0, 162); c2 = Color.Purple; col = new CircleCollider(pos, 0.2f); model = new ProjectileModel(this, TextureManager.elecRound64, TextureManager.elecRound64, TextureManager.elecTrail64, c1, c2, game); game.modelManager.addEffect(model); }
public static ProjectileModel GetProjectileModel(PowerBehaviorModel powerBehaviorModel) { ProjectileModel projectleModel = null; if (CanBeCast <MoabMineModel>(powerBehaviorModel)) { projectleModel = powerBehaviorModel.Cast <MoabMineModel>().projectileModel; } else if (CanBeCast <GlueTrapModel>(powerBehaviorModel)) { projectleModel = powerBehaviorModel.Cast <GlueTrapModel>().projectileModel; } else if (CanBeCast <CamoTrapModel>(powerBehaviorModel)) { projectleModel = powerBehaviorModel.Cast <CamoTrapModel>().projectileModel; } else if (CanBeCast <RoadSpikesModel>(powerBehaviorModel)) { projectleModel = powerBehaviorModel.Cast <RoadSpikesModel>().projectileModel; } return(projectleModel); }
public LaserProjectile(Vector3 pos, Vector3 direction, Game1 game, WeaponLaser weapons, int type) : base() { this.direction = direction; this.game = game; this.pos = pos; this.rot.Y = (float)Math.Atan2(direction.X, direction.Z); this.wep = weapons; this.type = type; speed = 50; life = 200; damage = 5; col = new CircleCollider(pos, 0.2f); if (type == 1) { c1 = Color.Green; c2 = Color.CornflowerBlue; model = new ProjectileModel(ModelLibrary.projectile, pos, this, c1, c2, game); } else if (type == 2) { c1 = Color.Blue; c2 = Color.Aqua; model = new ProjectileModel(ModelLibrary.projectile, pos, this, c1, c2, game); } else { c1 = Color.Red; c2 = Color.Purple; model = new ProjectileModel(this, TextureManager.elecRound64, TextureManager.elecRound64, TextureManager.elecTrail64, c1, c2, new Color(1, 0.4f, 0), game); } game.modelManager.addEffect(model); }
/// <summary> /// (Cross-Game compatible) Check if this has a specific Behavior /// </summary> /// <typeparam name="T">The Behavior you're checking for</typeparam> /// <param name="model"></param> /// <returns></returns> public static bool HasBehavior <T>(this ProjectileModel model) where T : Model { return(model.behaviors.HasItemsOfType <Model, T>()); }
public void Init(ProjectileModel model) { projectile = this.GetComponent <Projectile>(); projectile.Init(model); }
public RemoveProjectileCommand(ProjectileModel projectile, WorldModel worldModel) { _worldModel = worldModel; _projectile = projectile; }
/// <summary> /// (Cross-Game compatible) Remove the first Behavior of type T /// </summary> /// <typeparam name="T">The Behavior you want to remove</typeparam> /// <param name="model"></param> /// <param name="behavior"></param> public static void RemoveBehavior <T>(this ProjectileModel model, T behavior) where T : Model { model.behaviors = model.behaviors.RemoveItem(behavior); }
/// <summary> /// Get the DamageModel behavior from the list of behaviors /// </summary> public static DamageModel GetDamageModel(this ProjectileModel projectileModel) { return(projectileModel.GetBehavior <DamageModel>()); }
/// <summary> /// Applies a given ModDisplay to this ProjectileModel /// </summary> /// <typeparam name="T">The type of ModDisplay</typeparam> public static void ApplyDisplay <T>(this ProjectileModel projectileModel) where T : ModDisplay { ModContent.GetInstance <T>().Apply(projectileModel); }
/// <summary> /// (Cross-Game compatible) Get all Projectile Simulations that have this ProjectileModel /// </summary> public static List <Projectile> GetProjectileSims(this ProjectileModel projectileModel) { var projectileSims = InGame.instance?.GetProjectiles(); return(projectileSims.Where(projectile => projectile.projectileModel.name == projectileModel.name).ToList()); }
/// <summary> /// (Cross-Game compatible) Return all Behaviors of type T /// </summary> /// <typeparam name="T">The Behavior you want</typeparam> /// <param name="model"></param> /// <returns></returns> public static List <T> GetBehaviors <T>(this ProjectileModel model) where T : Model { return(model.behaviors.GetItemsOfType <Model, T>()); }
/// <summary> /// Applies this ModDisplay to a given ProjectileModel /// </summary> /// <param name="projectileModel"></param> public void Apply(ProjectileModel projectileModel) { projectileModel.display = Id; Apply(projectileModel.GetBehavior <DisplayModel>()); }
/// <summary> /// (Cross-Game compatible) Add a Behavior to this /// </summary> /// <typeparam name="T">The Behavior you want to add</typeparam> /// <param name="model"></param> /// <param name="behavior"></param> public static void AddBehavior <T>(this ProjectileModel model, T behavior) where T : Model { model.behaviors = model.behaviors.AddTo(behavior); }
public void MoveProjectile(ProjectileModel projectile, MyHexPosition newPosition) { Projectiles.MovePawn(projectile.Position, newPosition); }
/// <summary> /// (Cross-Game compatible) Remove all Behaviors of type T /// </summary> /// <typeparam name="T">The Behavior you want to remove</typeparam> /// <param name="model"></param> public static void RemoveBehaviors <T>(this ProjectileModel model) where T : Model { model.behaviors = model.behaviors.RemoveItemsOfType <Model, T>(); }
public static List <UnitModel> GetAllDistProjectile1(this IEnumerable <UnitModel> targets, ProjectileModel me, Fix64 dist) //would prefer to not do it like this if possible { List <UnitModel> unitList = new List <UnitModel> (); foreach (UnitModel unit in targets) { if ((WorldPosition.DistanceSq(me.Position, unit.Position) < dist) && unit.IsAlive && !unit.IsPetrified()) { unitList.Add(unit); } } return(unitList); }
public void DespawnProjectile(ProjectileModel projectileModel) { //_worldModel.Projectiles.Remove (projectileModel); this way actually works. _removeProjectileFactory.Create(projectileModel); //this does not work but is an attempt }
public void Init(ProjectileModel model) { rigidbody = this.GetComponent <Rigidbody2D>(); this.model = model; }