//static void DoUnoQuattro() //{ // Cane cane = new Cane(); // cane.Stampa(); // Mammifero mammifero = cane; // mammifero.Stampa(); // Animale animale1 = mammifero; // animale1.Stampa(); // Animale animale2 = cane; // animale2.Stampa(); // Console.ReadLine(); // List<Animale> animali = new List<Animale>(); // animali.Add(new Cane()); // animali.Add(new Orso()); // animali.Add(new Mammifero()); // animali.Add(new Animale()); // animali.ForEach(animale => animale.Stampa()); // Console.ReadLine(); //} //static void DoCinque() //{ // Mammifero mammifero = new Mammifero(5); // mammifero.Stampa(); // Cane cane = new Cane(6); // cane.Stampa(); // Orso orso = new Orso("mangia miele"); // orso.Stampa(); // Console.ReadLine(); //} static void DoSei() { Cane cane = new Cane(6, 4); cane.Stampa(); Mammifero mammifero = cane; mammifero.Stampa(); Cane cane2 = (Cane)mammifero; cane2.Stampa(); Console.ReadLine(); Orso orso = new Orso("mangia miele", 2); orso.Stampa(); mammifero = orso; mammifero.Stampa(); Console.ReadLine(); List <Mammifero> animali = new List <Mammifero> { new Cane(6, 4), new Orso("mangia miele", 2) }; animali.ForEach(animale => animale.Stampa()); Console.ReadLine(); }
protected static bool OnTestCane(IGameObject obj, object customData) { Cane cane = obj as Cane; if ((cane != null) && (cane.UsingCane)) { return(false); } return(true); }
public void LoadContent(ContentManager Content) { // load content for items // JUST FOR TESTING// willbe given items from loadout in full game. defaultItems[0] = new Cane(Content.Load<Texture2D>("LoadOut/cane_icon")); defaultItems[1] = new Revolver(Content.Load<Texture2D>("LoadOut/revolver_icon")); defaultItems[2] = new Bowler_Hat(Content.Load<Texture2D>("LoadOut/bowlerhat_icon")); defaultItems[3] = new Cape(Content.Load<Texture2D>("LoadOut/cape_icon")); // Load sounds! soundEffects.Add("Block", Content.Load<SoundEffect>("Sounds/Block")); soundEffects.Add("Hit", Content.Load<SoundEffect>("Sounds/BowlerHat_Hit")); soundEffects.Add("BowlerThrow", Content.Load<SoundEffect>("Sounds/BowlerHat_Throw")); soundEffects.Add("RevolverHit", Content.Load<SoundEffect>("Sounds/Bullet_Hit")); soundEffects.Add("CaneHit", Content.Load<SoundEffect>("Sounds/Cane_Hit")); soundEffects.Add("Cape", Content.Load<SoundEffect>("Sounds/Cape")); soundEffects.Add("Jump", Content.Load<SoundEffect>("Sounds/Jump")); soundEffects.Add("RevolverShoot", Content.Load<SoundEffect>("Sounds/Revolver_Fire")); soundEffects.Add("Footstep", Content.Load<SoundEffect>("Sounds/FootStep")); soundEffects.Add("CapeTug", Content.Load<SoundEffect>("Sounds/CapeTug")); soundEffects.Add("CaneWindUp", Content.Load<SoundEffect>("Sounds/CaneWindUp")); soundEffects.Add("GunClick", Content.Load<SoundEffect>("Sounds/Gun_Click")); soundEffects.Add("KnockedDown", Content.Load<SoundEffect>("Sounds/KnockedDown")); soundEffects.Add("CapeDraw", Content.Load<SoundEffect>("Sounds/CapeDraw")); //Change to using a text file!! // Create animation library to pass to players. animKeys = new string[] { "Idle", "Walk", "Run", "Jump", "Land", "Punch", "PunchHit", "Dodge", "Block", "Down", "Duck", "CaneBonk", "CaneHit", "CanePull", "CaneBalance", "RevolverShoot", "RevolverHit", "RevolverReload", "BowlerThrow", "BowlerCatch", "BowlerRethrow", "Cape", "CapeStuck"}; #region set frame width animFrameWidths = new int[] { 15, 12, 27, 20, 18, 37, 34, 17, 15, 43, 16, 54, 19, 76, 28, 56, 15, 56, 34, 37, 34, 54, 54 }; // frame widths int wBowlerHat = 6; #endregion #region set frame times animFrameTimes = new float[] { 0.1f, 0.1f, 0.05f, 0.1f, 0.1f, 0.09f, 0.1f, 0.05f, 0.1f, 0.08f, 0.08f, 0.07f, // cane bonk 0.08f, // cane hit 0.07f, // cane pull 0.1f, // cane balance 0.08f, // Revolver shoot 0.05f, // Revolver hit 0.08f, // Revovler reload 0.07f, // Bowler hat 0.05f, // Bowler catch 0.07f, // bowler re throws 0.06f, // cape 0.07f // cape stuck }; #endregion #region load textures /*// Load textures Texture2D idle = Content.Load<Texture2D>("Boxing/Player_Idle_Side"); Texture2D walk = Content.Load<Texture2D>("Boxing/Player_Walking_Side"); Texture2D run = Content.Load<Texture2D>("Boxing/Player_Running_Side"); Texture2D jump = Content.Load<Texture2D>("Boxing/Player_Jump"); Texture2D land = Content.Load<Texture2D>("Boxing/Player_Land"); Texture2D punch = Content.Load<Texture2D>("Boxing/Player_Punch"); Texture2D punchHit = Content.Load<Texture2D>("Boxing/Player_Punch_Hit"); Texture2D dodge = Content.Load<Texture2D>("Boxing/Player_Dodge"); Texture2D block = Content.Load<Texture2D>("Boxing/Player_Block"); Texture2D down = Content.Load<Texture2D>("Boxing/Player_Knocked_Down"); Texture2D duck = Content.Load<Texture2D>("Boxing/Player_Duck"); // player item use textures Texture2D caneBonk = Content.Load<Texture2D>("BoxingItems/Player_Cane"); Texture2D caneHit = Content.Load<Texture2D>("BoxingItems/Player_Cane_Hit"); Texture2D canePull = Content.Load<Texture2D>("BoxingItems/Player_Cane_Pull"); Texture2D caneBalance = Content.Load<Texture2D>("BoxingItems/Player_Cane_Balance"); Texture2D revolverShoot = Content.Load<Texture2D>("BoxingItems/Player_Revolver"); Texture2D revolverHit = Content.Load<Texture2D>("BoxingItems/Player_Revolver_Hit"); Texture2D revolverReload = Content.Load<Texture2D>("BoxingItems/Player_Revolver_Reload"); Texture2D bowlerThrow = Content.Load<Texture2D>("BoxingItems/Player_BowlerHat"); Texture2D bowlerCatch = Content.Load<Texture2D>("BoxingItems/Player_BowlerHat_Catch"); Texture2D bowlerReThrow = Content.Load<Texture2D>("BoxingItems/Player_BowlerHat_ReThrow"); */ #endregion #region initialize animations animLooping = new bool[] { true, true, true, false, true, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false }; Texture2D bowlerHat = Content.Load<Texture2D>("BoxingItems/BowlerHat_Instance"); // Initialize animations; /*animations.Add("Idle", new Animation(idle, fIdle, true, wIdle)); animations.Add("Walk", new Animation(walk, fWalk, true, wWalk)); animations.Add("Run", new Animation(run, fRun, true, wRun)); animations.Add("Jump", new Animation(jump, fJump, false, wJump)); animations.Add("Land", new Animation(land, fLand, true, wLand)); animations.Add("Punch", new Animation(punch, fPunch, false, wPunch)); animations.Add("PunchHit", new Animation(punchHit, fPunchHit, true, wPunchHit)); animations.Add("Dodge", new Animation(dodge, fDodge, true, wDodge)); animations.Add("Block", new Animation(block, fBlock, true, wBlock)); animations.Add("Down", new Animation(down, fDown, false, wDown)); animations.Add("Duck", new Animation(duck, fDuck, false, wDuck)); animations.Add("RevolverShoot", new Animation(revolverShoot, fRevolverShoot, false, wRevolverShoot)); animations.Add("RevolverHit", new Animation(revolverHit, fRevolverHit, false, wRevolverHit)); animations.Add("RevolverReload", new Animation(revolverReload, fRevolverReload, false, wRevolverReload)); animations.Add("bowlerThrow", new Animation(bowlerThrow, fBowlerThrow, false, wBowlerThrow)); animations.Add("bowlerCatch", new Animation(bowlerCatch, fBowlerCatch, false, wBowlerCatch)); animations.Add("bowlerReThrow", new Animation(bowlerReThrow, fBowlerReThrow, false, wBowlerReThrow)); */ // item animations itemAnims.Add("bowlerHat", new Animation(bowlerHat, 1f, true, wBowlerHat)); // Template textures to be used when re-coloring them animTextureTemplates = new Texture2D[] { Content.Load<Texture2D>("Boxing/Player_Idle_Side"), Content.Load<Texture2D>("Boxing/Player_Walking_Side"), Content.Load<Texture2D>("Boxing/Player_Running_Side"), Content.Load<Texture2D>("Boxing/Player_Jump"), Content.Load<Texture2D>("Boxing/Player_Land"), Content.Load<Texture2D>("Boxing/Player_Punch"), Content.Load<Texture2D>("Boxing/Player_Punch_Hit"), Content.Load<Texture2D>("Boxing/Player_Dodge"), Content.Load<Texture2D>("Boxing/Player_Block"), Content.Load<Texture2D>("Boxing/Player_Knocked_Down"), Content.Load<Texture2D>("Boxing/Player_Duck"), Content.Load<Texture2D>("BoxingItems/Player_Cane"), Content.Load<Texture2D>("BoxingItems/Player_Cane_Hit"), Content.Load<Texture2D>("BoxingItems/Player_Cane_Pull"), Content.Load<Texture2D>("BoxingItems/Player_Cane_Balance"), Content.Load<Texture2D>("BoxingItems/Player_Revolver"), Content.Load<Texture2D>("BoxingItems/Player_Revolver_Hit"), Content.Load<Texture2D>("BoxingItems/Player_Revolver_Reload"), Content.Load<Texture2D>("BoxingItems/Player_BowlerHat"), Content.Load<Texture2D>("BoxingItems/Player_BowlerHat_Catch"), Content.Load<Texture2D>("BoxingItems/Player_BowlerHat_ReThrow"), Content.Load<Texture2D>("BoxingItems/Player_Cape"), Content.Load<Texture2D>("BoxingItems/Player_Cape_Stuck") }; #endregion // Initialize bitmaps bitmaps.Add("Punch", new BitMap(Content.Load<Texture2D>("Boxing/Bitmaps/Player_Punch_Bitmap"))); // item animations bitmaps.Add("CaneBonk", new BitMap(Content.Load<Texture2D>("Boxing/Bitmaps/Player_Cane_Bitmap"))); bitmaps.Add("CanePull", new BitMap(Content.Load<Texture2D>("Boxing/Bitmaps/Player_Cane_Pull_Bitmap"))); }
// From OccultManager protected static bool AddOccultType(OccultManager ths, OccultTypes type, bool addOutfit, bool isReward, bool fromRestore, OccultBaseClass overrideOccultToAdd) { OccultBaseClass newOccult = null; OccultBaseClass oldOccult = ths.VerifyOccultList(type); if (overrideOccultToAdd != null) { newOccult = overrideOccultToAdd; } else { switch (type) { case OccultTypes.Mummy: newOccult = new OccultMummy(); break; case OccultTypes.Frankenstein: newOccult = new OccultFrankenstein(); break; case OccultTypes.Vampire: newOccult = new OccultVampire(); break; case OccultTypes.ImaginaryFriend: OccultImaginaryFriend oldImFr = oldOccult as OccultImaginaryFriend; if (oldImFr == null) { newOccult = new OccultImaginaryFriend(); } else { newOccult = new OccultImaginaryFriend(oldImFr); } break; case OccultTypes.Unicorn: newOccult = new OccultUnicorn(); break; case OccultTypes.Fairy: newOccult = new OccultFairy(); break; case OccultTypes.Witch: newOccult = new OccultWitch(); break; case OccultTypes.Genie: newOccult = new OccultGenie(); break; case OccultTypes.Werewolf: newOccult = new OccultWerewolf(); break; case OccultTypes.PlantSim: newOccult = new OccultPlantSim(); break; case OccultTypes.Mermaid: newOccult = new OccultMermaid(); break; case OccultTypes.TimeTraveler: newOccult = new OccultTimeTraveler(); break; case OccultTypes.Robot: newOccult = new OccultRobot(); break; } } if (newOccult == null) { return(false); } OccultTypes originalTypes = ths.mCurrentOccultTypes; Role assignedRole = ths.mOwnerDescription.AssignedRole; float alienDNAPercentage = ths.mOwnerDescription.AlienDNAPercentage; try { ths.mCurrentOccultTypes = OccultTypes.None; ths.mOwnerDescription.AssignedRole = null; ths.mOwnerDescription.mAlienDNAPercentage = 0f; if (!newOccult.CanAdd(ths.mOwnerDescription, fromRestore)) { return(false); } } finally { ths.mCurrentOccultTypes = originalTypes; ths.mOwnerDescription.AssignedRole = assignedRole; ths.mOwnerDescription.mAlienDNAPercentage = alienDNAPercentage; } if ((ths.mOwnerDescription.SupernaturalData == null) || ((type == OccultTypes.Fairy) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Fairy)) || ((type == OccultTypes.Robot) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.Robot)) || ((type == OccultTypes.PlantSim) && (ths.mOwnerDescription.SupernaturalData.OccultType != OccultTypes.PlantSim))) { ths.mOwnerDescription.AddSupernaturalData(type); } ths.mIsLifetimeReward = isReward; if (type == OccultTypes.Genie) { // Corrections for improper handling of the special outfits by OccultGenie if (ths.mOwnerDescription.mSpecialOutfitIndices == null) { ths.mOwnerDescription.mSpecialOutfitIndices = new Dictionary <uint, int>(); } addOutfit = false; } if (type == OccultTypes.Unicorn) { OccultUnicornEx.OnAddition(newOccult as OccultUnicorn, ths.mOwnerDescription, addOutfit); } ApplyTrait(ths.mOwnerDescription, type); MidlifeCrisisManager midlifeCrisisManager = ths.mOwnerDescription.MidlifeCrisisManager; try { // Inactive mummies don't agree with mid-life crisis managers ths.mOwnerDescription.MidlifeCrisisManager = null; newOccult.OnAddition(ths.mOwnerDescription, addOutfit, ths.mIsLifetimeReward, fromRestore); } finally { ths.mOwnerDescription.MidlifeCrisisManager = midlifeCrisisManager; } ths.mOccultList.Add(newOccult); ths.mCurrentOccultTypes |= type; EventTracker.SendEvent(new BeAnOccultEvent(EventTypeId.kBeAnOccult, ths.mOwnerDescription.CreatedSim, (uint)type)); if (ths.mOwnerDescription.CreatedSim != null) { if (!Cane.IsAllowedToUseCane(ths.mOwnerDescription.CreatedSim)) { Cane.StopUsingAnyActiveCanes(ths.mOwnerDescription.CreatedSim); } if (!Backpack.IsAllowedToUseBackpack(ths.mOwnerDescription.CreatedSim)) { Backpack.StopUsingAnyActiveBackpacks(ths.mOwnerDescription.CreatedSim); } if (!Jetpack.IsAllowedToUseJetpack(ths.mOwnerDescription.CreatedSim)) { Jetpack.StopUsingAnyActiveJetpacks(ths.mOwnerDescription.CreatedSim); } } (Responder.Instance.HudModel as Sims3.Gameplay.UI.HudModel).OnSimDaysPerAgingYearChanged(); ths.ClearOneShot(); ths.UpdateOccultUI(); if (!fromRestore) { EventTracker.SendEvent(EventTypeId.kBecameOccult, ths.mOwnerDescription.CreatedSim); } if (oldOccult != null) { newOccult.MergeOccultData(oldOccult); } if (ths.mOwnerDescription.CreatedSim != null) { Sim.StandingPosture standing = ths.mOwnerDescription.CreatedSim.Standing as Sim.StandingPosture; if (standing != null) { standing.SetDefaultIdleAnim(); } } return(true); }