private bool Shoot() { if (f_availableFeathers.Count == 0) { //TODO; this isn't nice since the animation still got played return(false); } Feather chosenFeather = null; for (int i = 0; i < f_allFeathers.Count; ++i) { if (chosenFeather != null) { break; } if (f_availableFeathers.Contains(f_allFeathers[m_nextFeather])) { chosenFeather = f_allFeathers[m_nextFeather]; } m_nextFeather = (m_nextFeather + 1) % f_allFeathers.Count; } f_availableFeathers.Remove(chosenFeather); // the point will be ignored in the Featehr script anyway chosenFeather.Shoot(Consts.Instance.Player.transform.position); return(true); }
private void createFeather(Vector3 _offset) { // instantiate GameObject _newFeather = Instantiate(FeatherPrefabs) as GameObject; // set new parent _newFeather.transform.parent = this.transform.parent; // set position _newFeather.transform.position = this.transform.position + _offset; // set scale _newFeather.transform.localScale = FeatherPrefabs.transform.localScale; // get Rigidbody component Rigidbody _rig = _newFeather.GetComponent <Rigidbody>(); if (m_player != null) { Feather f = new Feather(); f.m_feather = _rig; f.m_direction = m_player.position - _newFeather.transform.position; f.m_direction = f.m_direction.normalized; f.m_timeTillTurningPoint = 2f; _rig.AddForce(GameConfig.BS_FEATHER_VELOCITY * f.m_direction); _rig.AddTorque(Vector3.up * 10); m_flyingFeather.AddLast(f); } }
public static Feather New(float xpos, float ypos, DuckPersona who) { if (who == null) { who = Persona.Duck1; } Feather feather; if (Feather._objects[Feather._lastActiveObject] == null) { feather = new Feather(); Feather._objects[Feather._lastActiveObject] = feather; } else { feather = Feather._objects[Feather._lastActiveObject]; } Level.Remove((Thing)feather); Feather._lastActiveObject = (Feather._lastActiveObject + 1) % Feather.kMaxObjects; feather.Init(xpos, ypos, who); feather.ResetProperties(); feather._sprite.globalIndex = (int)Thing.GetGlobalIndex(); feather.globalIndex = Thing.GetGlobalIndex(); return(feather); }
public override void DoAiLogic() { foreach (Entity go in gameObjects.Values) { // Removes spinning from collisions go.SetAngularVelocity(Vector3.Zero); if (go is EnemyFighter) { //FighterController.Update(go as EnemyFighter, c, null); } else if (go is EnemyCruiser) { //CruiserController.Update(go as EnemyCruiser); } else if (go is Feather) { Feather f = go as Feather; f.Update(); } else if (go is Beam) { Beam b = go as Beam; if (Vector3.Distance(b.Position, Vector3.Zero) > 500) { physicsManager.RemoveObject(b.ID); } } } }
private void SpawnFeather() { feather = (Feather)GetFeather(new Vector3(0, 0, 0)); //feather = (Feather)assetManager.GetNewInstance(AssetTypes.Feather); feather.Init(new Vector3(0, 0, 0), feather.Orientation); physicsManager.AddNewObject(feather); }
public void MagentFeather(Feather feather) { if (!IsFull()) { featherSlots[numSlottedFeathers].AttractFeather(feather.transform); numSlottedFeathers++; } else { print("cancel magnet Feather"); feather.Detatch(); } }
public void MagentFeather(Feather feather) { if( !IsFull()) { featherSlots[numSlottedFeathers].AttractFeather(feather.transform); numSlottedFeathers++; } else { print("cancel magnet Feather"); feather.Detatch(); } }
public override void ExitHit(Bullet bullet, Vec2 exitPos) { Gun owner = bullet.owner as Gun; if (bullet.owner != null && (bullet.owner == this._duckOwner || owner != null && owner.owner == this._duckOwner)) { return; } Feather feather = Feather.New(0.0f, 0.0f, this._duckOwner.persona); feather.hSpeed = (float)(-(double)bullet.travelDirNormalized.x * (1.0 + (double)Rando.Float(1f))); feather.vSpeed = -Rando.Float(2f); feather.position = exitPos; Level.Add((Thing)feather); }
private void updateFlyingFeather() { if (m_flyingFeather.Count == 0) { return; } LinkedListNode <Feather> node = m_flyingFeather.First; LinkedListNode <Feather> nextNode; do { Feather f = node.Value; nextNode = node.Next; if (!f.update(Time.deltaTime)) { m_flyingFeather.Remove(node); } node = nextNode; }while (node != null); }
public static void DamageCorpse(Point3D location, Map map, bool largeExplosion) { int projectiles = 5; int particleSpeed = 8; int minRadius = 1; int maxRadius = 5; List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(location, true, false, location, map, projectiles, 20, minRadius, maxRadius, false); if (m_ValidLocations.Count == 0) { return; } for (int b = 0; b < projectiles; b++) { Point3D newLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 2), map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 20), map); newLocation.Z += 5; Effects.SendMovingEffect(effectStartLocation, effectEndLocation, Utility.RandomList(4651, 4652, 4653, 4654, 5701), particleSpeed, 0, false, false, 0, 0); } for (int a = 0; a < 4; a++) { Point3D newPoint = new Point3D(location.X + Utility.RandomList(-2, -1, 1, 2), location.Y + Utility.RandomList(-2, -1, 1, 2), location.Z); SpellHelper.AdjustField(ref newPoint, map, 12, false); new Blood().MoveToWorld(newPoint, map); } int radius = 2; int explosionSound = Utility.RandomList(0x5DA, 0x580); if (largeExplosion) { explosionSound = 0x309; radius = 4; List <int> m_ExtraParts = new List <int>(); m_ExtraParts.Add(Utility.RandomList(7407)); //Entrail m_ExtraParts.Add(Utility.RandomList(6929)); //Bones m_ExtraParts.Add(Utility.RandomList(6930)); //Bones m_ExtraParts.Add(Utility.RandomList(6937)); //Bones m_ExtraParts.Add(Utility.RandomList(6938)); //Bones m_ExtraParts.Add(Utility.RandomList(6931)); //Bones m_ExtraParts.Add(Utility.RandomList(6932)); //Bones m_ExtraParts.Add(Utility.RandomList(4650)); //Blood m_ExtraParts.Add(Utility.RandomList(4651)); //Blood m_ExtraParts.Add(Utility.RandomList(4652)); //Blood m_ExtraParts.Add(Utility.RandomList(4653)); //Blood m_ExtraParts.Add(Utility.RandomList(4654)); //Blood m_ExtraParts.Add(Utility.RandomList(5701)); //Blood m_ExtraParts.Add(Utility.RandomList(4655)); //Blood m_ExtraParts.Add(Utility.RandomList(7439)); //Blood m_ExtraParts.Add(Utility.RandomList(7438)); //Blood m_ExtraParts.Add(Utility.RandomList(7436)); //Blood m_ExtraParts.Add(Utility.RandomList(7433)); //Blood m_ExtraParts.Add(Utility.RandomList(7431)); //Blood m_ExtraParts.Add(Utility.RandomList(7428)); //Blood m_ExtraParts.Add(Utility.RandomList(7425)); //Blood m_ExtraParts.Add(Utility.RandomList(7410)); //Blood m_ExtraParts.Add(Utility.RandomList(7415)); //Blood m_ExtraParts.Add(Utility.RandomList(7416)); //Blood m_ExtraParts.Add(Utility.RandomList(7418)); //Blood m_ExtraParts.Add(Utility.RandomList(7420)); //Blood m_ExtraParts.Add(Utility.RandomList(7425)); //Blood double extraPartChance = .5; int minRange = radius * -1; int maxRange = radius; List <Point3D> m_ExplosionPoints = new List <Point3D>(); for (int a = minRange; a < maxRange + 1; a++) { for (int b = minRange; b < maxRange + 1; b++) { Point3D newPoint = new Point3D(location.X + a, location.Y + b, location.Z); SpellHelper.AdjustField(ref newPoint, map, 12, false); if (map.InLOS(location, newPoint)) { m_ExplosionPoints.Add(newPoint); } } } for (int a = 0; a < m_ExplosionPoints.Count; a++) { if (Utility.RandomDouble() <= extraPartChance) { Point3D explosionPoint = m_ExplosionPoints[a]; int itemId = m_ExtraParts[Utility.RandomMinMax(0, m_ExtraParts.Count - 1)]; int distance = Utility.GetDistance(location, explosionPoint); Timer.DelayCall(TimeSpan.FromSeconds(distance * .15), delegate { TimedStatic gore = new TimedStatic(itemId, 10); gore.Name = "gore"; gore.MoveToWorld(explosionPoint, map); if (Utility.RandomDouble() <= .5) { Item item = null; switch (Utility.RandomMinMax(1, 8)) { //case 1: item = new CookedBird(); break; //case 2: item = new ChickenLeg(); break; //case 3: item = new LambLeg(); item.Name = "chicken drumstick"; break; case 4: item = new Feather(); break; case 5: item = new Feather(); break; case 6: item = new Feather(); break; case 7: item = new Feather(); break; case 8: item = new Feather(); break; } if (item != null) { item.MoveToWorld(explosionPoint, map); } } }); } } } Effects.PlaySound(location, map, explosionSound); }
public static InventoryItem CreateInventoryItem(string key, TeamType team, string region, Vector2 location, ContentManager content, GraphicsDevice graphics) { InventoryItem item = null; int amountStacked = 1; switch (key) { case ("tribalTokens"): item = new TribalTokens(team, region, location, content, graphics); break; case ("basePlank"): item = new BasePlank(team, region, location, content, graphics); break; case ("shortSword"): item = new ShortSword(team, region, location, content, graphics); break; case ("softWood"): item = new SoftWood(team, region, location, content, graphics); break; case ("islandGrass"): item = new IslandGrass(team, region, location, content, graphics); break; case ("coal"): item = new Coal(team, region, location, content, graphics); break; case ("ironOre"): item = new IronOre(team, region, location, content, graphics); break; case ("baseSword"): item = new BaseSword(team, region, location, content, graphics); break; case ("anvilItem"): item = new AnvilItem(team, region, location, content, graphics); item.placeableVersion = new CraftingAnvil(team, region, location, content, graphics); break; case ("baseChestItem"): item = new BaseChestItem(team, region, location, content, graphics); item.placeableVersion = new BaseChest(team, region, location, content, graphics); break; case ("nails"): item = new Nails(team, region, location, content, graphics); amountStacked = 5; break; case ("cannonBallItem"): item = new CannonBallItem(team, region, location, content, graphics); amountStacked = 3; break; case ("pistolShotItem"): item = new PistolShotItem(team, region, location, content, graphics); amountStacked = 5; break; case ("ironBar"): item = new IronBar(team, region, location, content, graphics); break; case ("treasureMapItem"): item = new TreasureMapItem(null, team, region, location, content, graphics); break; case ("chiliFish"): item = new ChiliFish(team, region, location, content, graphics); break; case ("chiliPepper"): item = new ChiliPepper(team, region, location, content, graphics); break; case ("cookedFish"): item = new CookedFish(team, region, location, content, graphics); break; case ("cookedMeat"): item = new CookedMeat(team, region, location, content, graphics); break; case ("rawFish"): item = new RawFish(team, region, location, content, graphics); break; case ("rawMeat"): item = new RawMeat(team, region, location, content, graphics); break; case ("spoiledFish"): item = new SpoiledFish(team, region, location, content, graphics); break; case ("spoiledMeat"): item = new SpoiledMeat(team, region, location, content, graphics); break; case ("feather"): item = new Feather(team, region, location, content, graphics); break; case ("scales"): item = new Scales(team, region, location, content, graphics); break; case ("fishOil"): item = new FishOil(team, region, location, content, graphics); break; case ("goldCoins"): item = new GoldCoins(team, region, location, content, graphics); break; } item.itemKey = key; item.amountStacked = amountStacked; return(item); }
private void AltToggle(object sender, RoutedEventArgs e) { // Mimicing radio buttons so you cant toggle a button off if (AltOption.IsChecked == false) { AltOption.IsChecked = true; return; } SimpleOption.IsChecked = false; OrbOption.IsChecked = false; Properties.Settings.Default.Simple = SimpleOption.IsChecked; Properties.Settings.Default.Orb = OrbOption.IsChecked; Properties.Settings.Default.Alt = AltOption.IsChecked; if (AltOption.IsChecked) { Report1.SetResourceReference(ContentProperty, "AnsemReportOld1"); Report2.SetResourceReference(ContentProperty, "AnsemReportOld2"); Report3.SetResourceReference(ContentProperty, "AnsemReportOld3"); Report4.SetResourceReference(ContentProperty, "AnsemReportOld4"); Report5.SetResourceReference(ContentProperty, "AnsemReportOld5"); Report6.SetResourceReference(ContentProperty, "AnsemReportOld6"); Report7.SetResourceReference(ContentProperty, "AnsemReportOld7"); Report8.SetResourceReference(ContentProperty, "AnsemReportOld8"); Report9.SetResourceReference(ContentProperty, "AnsemReportOld9"); Report10.SetResourceReference(ContentProperty, "AnsemReportOld10"); Report11.SetResourceReference(ContentProperty, "AnsemReportOld11"); Report12.SetResourceReference(ContentProperty, "AnsemReportOld12"); Report13.SetResourceReference(ContentProperty, "AnsemReportOld13"); Fire1.SetResourceReference(ContentProperty, "FireOld"); Fire2.SetResourceReference(ContentProperty, "FireOld"); Fire3.SetResourceReference(ContentProperty, "FireOld"); Blizzard1.SetResourceReference(ContentProperty, "BlizzardOld"); Blizzard2.SetResourceReference(ContentProperty, "BlizzardOld"); Blizzard3.SetResourceReference(ContentProperty, "BlizzardOld"); Thunder1.SetResourceReference(ContentProperty, "ThunderOld"); Thunder2.SetResourceReference(ContentProperty, "ThunderOld"); Thunder3.SetResourceReference(ContentProperty, "ThunderOld"); Cure1.SetResourceReference(ContentProperty, "CureOld"); Cure2.SetResourceReference(ContentProperty, "CureOld"); Cure3.SetResourceReference(ContentProperty, "CureOld"); Reflect1.SetResourceReference(ContentProperty, "ReflectOld"); Reflect2.SetResourceReference(ContentProperty, "ReflectOld"); Reflect3.SetResourceReference(ContentProperty, "ReflectOld"); Magnet1.SetResourceReference(ContentProperty, "MagnetOld"); Magnet2.SetResourceReference(ContentProperty, "MagnetOld"); Magnet3.SetResourceReference(ContentProperty, "MagnetOld"); Valor.SetResourceReference(ContentProperty, "ValorOld"); Wisdom.SetResourceReference(ContentProperty, "WisdomOld"); Limit.SetResourceReference(ContentProperty, "LimitOld"); Master.SetResourceReference(ContentProperty, "MasterOld"); Final.SetResourceReference(ContentProperty, "FinalOld"); TornPage1.SetResourceReference(ContentProperty, "TornPageOld"); TornPage2.SetResourceReference(ContentProperty, "TornPageOld"); TornPage3.SetResourceReference(ContentProperty, "TornPageOld"); TornPage4.SetResourceReference(ContentProperty, "TornPageOld"); TornPage5.SetResourceReference(ContentProperty, "TornPageOld"); Lamp.SetResourceReference(ContentProperty, "GenieOld"); Ukulele.SetResourceReference(ContentProperty, "StitchOld"); Baseball.SetResourceReference(ContentProperty, "ChickenLittleOld"); Feather.SetResourceReference(ContentProperty, "PeterPanOld"); Nonexistence.SetResourceReference(ContentProperty, "ProofOfNonexistenceOld"); Connection.SetResourceReference(ContentProperty, "ProofOfConnectionOld"); Peace.SetResourceReference(ContentProperty, "ProofOfPeaceOld"); PromiseCharm.SetResourceReference(ContentProperty, "PromiseCharmOld"); broadcast.Report.SetResourceReference(ContentProperty, "AnsemReportOld"); broadcast.Peace.SetResourceReference(ContentProperty, "ProofOfPeaceOld"); broadcast.Nonexistence.SetResourceReference(ContentProperty, "ProofOfNonexistenceOld"); broadcast.Connection.SetResourceReference(ContentProperty, "ProofOfConnectionOld"); broadcast.PromiseCharm.SetResourceReference(ContentProperty, "PromiseCharmOld"); broadcast.Fire.SetResourceReference(ContentProperty, "FireAlt"); broadcast.Blizzard.SetResourceReference(ContentProperty, "BlizzardAlt"); broadcast.Thunder.SetResourceReference(ContentProperty, "ThunderAlt"); broadcast.Cure.SetResourceReference(ContentProperty, "CureAlt"); broadcast.Reflect.SetResourceReference(ContentProperty, "ReflectAlt"); broadcast.Magnet.SetResourceReference(ContentProperty, "MagnetAlt"); broadcast.Valor.SetResourceReference(ContentProperty, "ValorAlt"); broadcast.Wisdom.SetResourceReference(ContentProperty, "WisdomAlt"); broadcast.Limit.SetResourceReference(ContentProperty, "LimitAlt"); broadcast.Master.SetResourceReference(ContentProperty, "MasterAlt"); broadcast.Final.SetResourceReference(ContentProperty, "FinalAlt"); broadcast.Baseball.SetResourceReference(ContentProperty, "ChickenLittleAlt"); broadcast.Lamp.SetResourceReference(ContentProperty, "GenieAlt"); broadcast.Ukulele.SetResourceReference(ContentProperty, "StitchAlt"); broadcast.Feather.SetResourceReference(ContentProperty, "PeterPanAlt"); ((Grid)((Grid)broadcast.Fire.Parent).Parent).RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star); ((Grid)((Grid)broadcast.Fire.Parent).Parent).RowDefinitions[2].Height = new GridLength(0, GridUnitType.Star); ((Grid)broadcast.Valor.Parent).RowDefinitions[1].Height = new GridLength(5, GridUnitType.Star); ((Grid)broadcast.Valor.Parent).RowDefinitions[2].Height = new GridLength(5, GridUnitType.Star); ((Grid)broadcast.Lamp.Parent).RowDefinitions[1].Height = new GridLength(8, GridUnitType.Star); } }
public FletchingSystem(Feather feather, Shaft shaft) { m_Shafts = shaft; m_Feathers = feather; }
//更新模板内特征点数据 private void UpdataTemplet() { int flag = 0; int Piccount=1; //小图像在拼图中的序列 int Feathercount = 0; Feather tmpfeather = new Feather(); while (flag<10)//模板只有十个数字的特征点 { if (ExistNumber.Contains(flag)) { tmpfeather.featherPoints = new featherRgnstruct[NumberPoints]; foreach (featherRgnstruct tmp in featherRegion) { if ((Piccount - 1) * templetFlag.templetSize.Width < tmp.rec.X && tmp.rec.X < Piccount * templetFlag.templetSize.Width) //会导致横坐标为零或者等于宽度的点不被保存 { if (Feathercount < NumberPoints) { tmpfeather.featherPoints[Feathercount] = tmp; tmpfeather.featherPoints[Feathercount].rec.X = tmp.rec.X - (Piccount - 1) * templetFlag.templetSize.Width; tmpfeather.featherPoints[Feathercount++].Pixel = ((Bitmap)(picturebox.Image)).GetPixel(tmp.rec.X, tmp.rec.Y).R; } } } for (int i = 0; i < NumberPoints; i++) { templetFlag.feathers.featherPoints[flag * NumberPoints + i] = tmpfeather.featherPoints[i]; } Piccount++; } flag++; Feathercount = 0; } }