public FiniteReleaseEmitter(params ParticleAnim[] anims) : this() { foreach (ParticleAnim anim in anims) { Anims.Add(anim); } }
public void swapAnimation(Anims a) { if(a != Anims.NONE){ current = lookup(a); animArr.CrossFade(lookup(a), 0.5f); } }
public FiniteReleaseEmitter(params AnimData[] anims) : this() { foreach (AnimData anim in anims) { Anims.Add(new ParticleAnim(anim)); } }
public SqueezedAreaEmitter(params AnimData[] anims) : this() { foreach (AnimData anim in anims) { Anims.Add(new ParticleAnim(anim)); } }
public CircleSquareFountainEmitter(params AnimData[] anims) : this() { foreach (AnimData anim in anims) { Anims.Add(new ParticleAnim(anim)); } }
public CircleSquareAreaEmitter(params AnimData[] anims) : this() { foreach (AnimData anim in anims) { Anims.Add(new StaticAnim(anim)); } }
public SqueezedAreaEmitter(params ParticleAnim[] anims) : this() { foreach (ParticleAnim anim in anims) { Anims.Add(anim); } }
/// <summary> /// Get the animation with a specific key. /// </summary> /// <param name="a">The key to search with.</param> /// <returns>The animation found.</returns> public Anim Anim(TAnimType a) { if (!Anims.ContainsKey(a)) { return(null); } return(Anims[a]); }
public void Play(Anims animation) { var currentAnimation = sprite.currentAnimation; if (currentAnimation != animation) { sprite.play(animation); } }
// TODO: permettre un callback lorsque l'animation est terminée public void Play(Anims nextAnimation) { if (currentAnimation == nextAnimation) { return; } currentAnimation = nextAnimation; currentFrameIndex = 0; loopCount = 0; }
// TODO: permettre un callback lorsque l'animation est terminée public void Play(Anims nextAnimation) { if (currentAnimation.name == nextAnimation) { return; } currentAnimation = animations.First(a => a.name == nextAnimation); currentFrameIndex = 0; loopCount = 0; }
public void Play(Anims nextAnimation) { // Si l'animation est déjà jouée, on ne fait rien if (currentAnimation.name == nextAnimation) { return; } // trouve l'animation correspondante dans la liste currentAnimation = animations.First(a => a.name == nextAnimation); // réinitialise à la première image de la séquence currentFrameIndex = 0; loopCount = 0; }
string lookup(Anims a) { switch(a){ // NOT unreachable. ignore warnings case Anims.IDLE : return idle; case Anims.ATTACK : return attack ; case Anims.HURT : return hurt; case Anims.SPATTACK : return spattack; } return ""; }
public void Unpack(BinaryReader reader) { var numAnims = reader.ReadByte(); Bitfield = reader.ReadByte(); Flags = (MotionDataFlags)reader.ReadByte(); reader.AlignBoundary(); Anims.Unpack(reader, numAnims); if ((Flags & MotionDataFlags.HasVelocity) != 0) { Velocity = reader.ReadVector3(); } if ((Flags & MotionDataFlags.HasOmega) != 0) { Omega = reader.ReadVector3(); } }
public void Unpack(BinaryReader reader) { var numAnims = reader.ReadByte(); Bitfield = reader.ReadByte(); Bitfield2 = reader.ReadByte(); reader.AlignBoundary(); Anims.Unpack(reader, numAnims); if ((Bitfield2 & 1) != 0) { Velocity = reader.ReadVector3(); } if ((Bitfield2 & 2) != 0) { Omega = reader.ReadVector3(); } }
/// <summary> /// Unload contents /// </summary> public override void UnloadContent() { Trace.WriteLine("[CharGen] UnloadContent()"); if (Tileset != null) { Tileset.Dispose(); } Tileset = null; if (Heads != null) { Heads.Dispose(); } Heads = null; if (Font != null) { Font.Dispose(); } Font = null; if (NameFont != null) { NameFont.Dispose(); } NameFont = null; if (Anims != null) { Anims.Dispose(); } Anims = null; if (Batch != null) { Batch.Dispose(); } Batch = null; }
public void Load() { if (Loaded) { return; } Loaded = true; var fs = new FileStream("Data/AnimationSets/" + Name + "/" + Name + ".anims", FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); Name = r.ReadString(); int ac = r.ReadInt32(); for (int i = 0; i < ac; i++) { var na = new Animation(); na.Read(r); Anims.Add(na); } fs.Close(); }
/// <summary> /// Updates the animation. The sprite will not animate without this. /// </summary> public override void Update() { base.Update(); if (!Active) { return; } if (!Anims.ContainsKey(CurrentAnim)) { return; } if (Paused) { return; } Anims[CurrentAnim].Update(Speed); UpdateSprite(); }
/// <summary> /// Loads content /// </summary> public override void LoadContent() { Trace.WriteLine("[CharGen] LoadContent()"); Batch = new SpriteBatch(); Tileset = ResourceManager.CreateAsset <TileSet>("CharGen"); Heads = ResourceManager.CreateAsset <TileSet>("Heads"); Font = ResourceManager.CreateAsset <BitmapFont>("intro"); NameFont = ResourceManager.CreateAsset <BitmapFont>("name"); PlayButton = new ScreenButton(string.Empty, new Rectangle(48, 362, 166, 32)); PlayButton.Selected += new EventHandler(PlayButton_Selected); StringTable = ResourceManager.CreateAsset <StringTable>("Chargen"); StringTable.LanguageName = Game.LanguageName; Anims = ResourceManager.CreateAsset <Animation>("Animations"); Anims.Play(); CurrentState = CharGenStates.SelectHero; // Load name list using (Stream stream = ResourceManager.Load("names.xml")) { if (stream != null) { XmlReader xr = XmlReader.Create(stream); Names = XDocument.Load(xr); } } }
// ------------------------------------------------------------------------ // Declarative functional animations // Listing 1.6 Creating functional animation static void FunctionalAnim() { // Create green and blue ellipse var greenCircle = Anims.Cirle( Time.Forever(Brushes.OliveDrab), 100.0f.Forever()); var blueCircle = Anims.Cirle( Time.Forever(Brushes.SteelBlue), 100.0f.Forever()); // Value animated from -100 to +100 var animatedPos = Time.Wiggle * 100.0f.Forever(); // Animate X or Y coordinates of ellipses var greenMove = greenCircle.Translate(animatedPos, 0.0f.Forever()); var blueMove = blueCircle.Translate(0.0f.Forever(), animatedPos); // Compose animation from both ellipses var animation = Anims.Compose(greenMove, blueMove); // Run the animation Application.Run(new AnimationForm() { Animation = animation }); }
void PlayAnimation(Anims state) { AnimController.Play(StateNames[(int)state]); }
public override void Load(BinaryReader reader, int size) { if (ParentType == SectionType.ScriptX) { scriptGameVersion = 1; } else if (ParentType == SectionType.ScriptDemo) { scriptGameVersion = 2; } else { scriptGameVersion = 0; } var sk = reader.BaseStream.Position; UnkBitfield = reader.ReadUInt32(); for (int i = 0; i < 8; ++i) { ScriptSlots[i] = reader.ReadByte(); } //Class1 = reader.ReadUInt32(); //Class2 = reader.ReadUInt32(); //Class3 = reader.ReadUInt32(); var len = reader.ReadInt32(); Name = new string(reader.ReadChars(len)); // Read UInt32 script slots var cnt = reader.ReadInt32(); UI32.Clear(); for (int i = 0; i < cnt; ++i) { UI32.Add(reader.ReadUInt32()); } // Read OGI script slots cnt = reader.ReadInt32(); OGIs.Clear(); for (int i = 0; i < cnt; ++i) { OGIs.Add(reader.ReadUInt16()); } // Read Animation script slots cnt = reader.ReadInt32(); Anims.Clear(); for (int i = 0; i < cnt; ++i) { Anims.Add(reader.ReadUInt16()); } // Read Script script slots cnt = reader.ReadInt32(); Scripts.Clear(); for (int i = 0; i < cnt; ++i) { Scripts.Add(reader.ReadUInt16()); } // Read Object script slots cnt = reader.ReadInt32(); Objects.Clear(); for (int i = 0; i < cnt; ++i) { Objects.Add(reader.ReadUInt16()); } // Read Sound script slots cnt = reader.ReadInt32(); Sounds.Clear(); for (int i = 0; i < cnt; ++i) { Sounds.Add(reader.ReadUInt16()); } // Read instance properties if ((UnkBitfield & 0x20000000) != 0x0) { PHeader = reader.ReadUInt32(); PUI32 = reader.ReadUInt32(); cnt = reader.ReadInt32(); instFlagsList.Clear(); for (int i = 0; i < cnt; ++i) { instFlagsList.Add(reader.ReadUInt32()); } cnt = reader.ReadInt32(); instFloatsList.Clear(); for (int i = 0; i < cnt; ++i) { instFloatsList.Add(reader.ReadSingle()); } cnt = reader.ReadInt32(); instIntegerList.Clear(); for (int i = 0; i < cnt; ++i) { instIntegerList.Add(reader.ReadUInt32()); } } else { PHeader = 0; PUI32 = 0; instFlagsList.Clear(); instFloatsList.Clear(); instIntegerList.Clear(); } // Read IDs needed for instance creation if ((UnkBitfield & 0x40000000) != 0x0) { flag = reader.ReadUInt32(); if ((flag & 0x00000001) != 0) { cnt = reader.ReadInt32(); cObjects.Clear(); for (int i = 0; i < cnt; ++i) { cObjects.Add(reader.ReadUInt16()); } } if ((flag & 0x00000002) != 0) { cnt = reader.ReadInt32(); cOGIs.Clear(); for (int i = 0; i < cnt; ++i) { cOGIs.Add(reader.ReadUInt16()); } } if ((flag & 0x00000004) != 0) { cnt = reader.ReadInt32(); cAnims.Clear(); for (int i = 0; i < cnt; ++i) { cAnims.Add(reader.ReadUInt16()); } } if ((flag & 0x00000008) != 0) { cnt = reader.ReadInt32(); cCM.Clear(); for (int i = 0; i < cnt; ++i) { cCM.Add(reader.ReadUInt16()); } } if ((flag & 0x00000010) != 0) { cnt = reader.ReadInt32(); cScripts.Clear(); for (int i = 0; i < cnt; ++i) { cScripts.Add(reader.ReadUInt16()); } } if ((flag & 0x00000020) != 0) { cnt = reader.ReadInt32(); cUnk.Clear(); for (int i = 0; i < cnt; ++i) { cUnk.Add(reader.ReadUInt16()); } } if ((flag & 0x00000040) != 0) { cnt = reader.ReadInt32(); cSounds.Clear(); for (int i = 0; i < cnt; ++i) { cSounds.Add(reader.ReadUInt16()); } } } scriptCommandsAmount = (int)reader.ReadUInt32(); if (scriptCommandsAmount != 0) { scriptCommand = new Script.MainScript.ScriptCommand(reader, scriptGameVersion); var command = scriptCommand; do { scriptCommands.Add(command); command = command.nextCommand; } while (command != null); } else { scriptCommand = null; } this.size = size; }
// Start is called before the first frame update void Start() { spriteRenderer = GetComponent <SpriteRenderer>(); nextFrameCoolDown = animationFrameDuration; currentAnimation = Anims.Iddle; }
public CircleSquareSprinkleEmitter(AnimData anim, int cycles, int totalTime) : this() { Anims.Add(new ParticleAnim(anim, cycles, totalTime)); }
public bool isAnimating(Anims a) { return (!animArr[lookup(a)] ? false : animArr[lookup(a)].enabled); }
/// <summary> /// Draws the scene /// </summary> public override void Draw() { // Clears the background Display.ClearBuffers(); Batch.Begin(); // Background Batch.DrawTile(Tileset, 0, Point.Empty, Color.White); // Heroes faces and names for (int i = 0; i < 4; i++) { Hero hero = Heroes[i]; if (hero == null) { continue; } Batch.DrawTile(Heads, hero.Head, HeroeBoxes[i].Location); Batch.DrawString(NameFont, NameLocations[i], GameColors.Cyan, hero.Name); } switch (CurrentState) { #region Select hero case CharGenStates.SelectHero: { Batch.DrawString(Font, new Rectangle(304, 160, 300, 64), Color.White, StringTable.GetString(1)); // Team is ready, game can begin... if (IsTeamReadyToPlay) { Batch.DrawTile(Tileset, 1, new Point(48, 362)); } } break; #endregion #region Select race case CharGenStates.SelectRace: { Anims.Draw(Batch, HeroeBoxes[HeroID].Location); Batch.DrawString(Font, new Rectangle(294, 134, 300, 64), GameColors.Cyan, StringTable.GetString(34)); Point point = new Point(300, 140); Color color; for (int i = 0; i < 12; i++) { point.Y += 18; if (new Rectangle(point.X, point.Y, 324, 16).Contains(Mouse.Location)) { color = Color.FromArgb(255, 85, 85); } else { color = Color.White; } Batch.DrawString(Font, point, color, StringTable.GetString(i + 22)); } } break; #endregion #region Select class case CharGenStates.SelectClass: { // Animation Anims.Draw(Batch, HeroeBoxes[HeroID].Location); // "Select class :" Batch.DrawString(Font, new Rectangle(294, 134, 300, 64), GameColors.Cyan, StringTable.GetString(2)); Point point = new Point(302, 0); Color color; var currentAllowedClasses = AllowedClass[CurrentHero.Race]; for (int i = 0; i < currentAllowedClasses.Count(); i++) { point.Y = 160 + i * 18; // On mouse over, paint it in red if (new Rectangle(point.X, point.Y, 324, 16).Contains(Mouse.Location)) { color = GameColors.Red; } else { color = Color.White; } // TODO: Update string table to use localized strings Batch.DrawString(Font, point, color, currentAllowedClasses[i].ToString().ToUpper().Replace(", ", "/")); } // Back Batch.DrawTile(Tileset, 3, BackButton.Location); Batch.DrawTile(Tileset, 12, new Point(BackButton.Location.X + 12, BackButton.Location.Y + 12)); } break; #endregion #region Select alignment case CharGenStates.SelectAlignment: { Anims.Draw(Batch, HeroeBoxes[HeroID].Location); Batch.DrawString(Font, new Rectangle(304, 140, 300, 64), GameColors.Cyan, StringTable.GetString(12)); Point point = new Point(304, 0); Color color; for (int i = 0; i < 9; i++) { point.Y = 176 + i * 18; if (new Rectangle(286, 176 + i * 18, 324, 16).Contains(Mouse.Location)) { color = Color.FromArgb(255, 85, 85); } else { color = Color.White; } Batch.DrawString(Font, point, color, StringTable.GetString(i + 13)); } // Back Batch.DrawTile(Tileset, 3, BackButton.Location); Batch.DrawTile(Tileset, 12, new Point(BackButton.Location.X + 12, BackButton.Location.Y + 12)); } break; #endregion #region Select face case CharGenStates.SelectFace: { Anims.Draw(Batch, HeroeBoxes[HeroID].Location); // Class and professions Batch.DrawString(Font, new Rectangle(300, 210, 300, 64), Color.White, CurrentHero.Race.ToString()); string txt = string.Empty; foreach (Profession prof in CurrentHero.Professions) { txt += prof.Class.ToString() + "/"; } txt = txt.Substring(0, txt.Length - 1); Batch.DrawString(Font, new Rectangle(300, 228, 300, 64), Color.White, txt); DisplayProperties(); // Left/right box Batch.DrawTile(Tileset, 3, new Point(288, 132)); Batch.DrawTile(Tileset, 18, new Point(300, 140)); Batch.DrawTile(Tileset, 3, new Point(288, 164)); Batch.DrawTile(Tileset, 19, new Point(300, 172)); // Faces for (int i = 0; i < 4; i++) { Batch.DrawTile(Heads, i + FaceOffset, new Point(354 + i * 64, 132)); } // Back Batch.DrawTile(Tileset, 3, BackButton.Location); Batch.DrawTile(Tileset, 12, new Point(BackButton.Location.X + 12, BackButton.Location.Y + 12)); } break; #endregion #region Confirm case CharGenStates.Confirm: { // Class and professions Batch.DrawString(Font, new Rectangle(300, 210, 300, 64), Color.White, CurrentHero.Race.ToString()); string txt = string.Empty; foreach (Profession prof in CurrentHero.Professions) { txt += prof.Class.ToString() + "/"; } txt = txt.Substring(0, txt.Length - 1); Batch.DrawString(Font, new Rectangle(300, 228, 300, 64), Color.White, txt); DisplayProperties(); Batch.DrawTile(Heads, CurrentHero.Head, new Point(438, 132)); // Reroll Batch.DrawTile(Tileset, 5, new Point(448, 318)); Batch.DrawTile(Tileset, 11, new Point(462, 330)); // Faces Batch.DrawTile(Tileset, 5, new Point(448, 350)); Batch.DrawTile(Tileset, 20, new Point(466, 362)); // Modify Batch.DrawTile(Tileset, 5, new Point(528, 316)); Batch.DrawTile(Tileset, 14, new Point(540, 328)); // Keep Batch.DrawTile(Tileset, 5, new Point(528, 350)); Batch.DrawTile(Tileset, 13, new Point(550, 360)); } break; #endregion #region Select name case CharGenStates.SelectName: { // Batch.DrawString(Font, new Rectangle(296, 200, 300, 64), GameColors.Cyan, "Name: "); Batch.DrawString(Font, new Rectangle(380, 200, 300, 64), Color.White, CurrentHero.Name); DisplayProperties(); Batch.DrawTile(Heads, CurrentHero.Head, new Point(438, 132)); // Ok Batch.DrawTile(Tileset, 5, new Point(528, 350)); Batch.DrawTile(Tileset, 15, new Point(560, 360)); // Back Batch.DrawTile(Tileset, 5, new Point(448, 350)); Batch.DrawTile(Tileset, 12, new Point(466, 362)); } break; #endregion #region Delete hero case CharGenStates.Delete: { Batch.DrawTile(Heads, CurrentHero.Head, new Point(438, 132)); Batch.DrawString(Font, new Rectangle(292, 190, 300, 64), Color.White, CurrentHero.Name); // Class and professions Batch.DrawString(Font, new Rectangle(300, 214, 300, 64), Color.White, CurrentHero.Race.ToString()); string txt = string.Empty; foreach (Profession prof in CurrentHero.Professions) { txt += prof.Class.ToString() + "/"; } txt = txt.Substring(0, txt.Length - 1); Batch.DrawString(Font, new Rectangle(300, 232, 300, 64), Color.White, txt); DisplayProperties(); // Delete Batch.DrawTile(Tileset, 7, new Point(448, 350)); // OK Batch.DrawTile(Tileset, 5, new Point(528, 350)); Batch.DrawTile(Tileset, 15, new Point(558, 360)); } break; #endregion } Batch.End(); }
public FiniteGatherEmitter(params AnimData[] anims) : this() { Anims.AddRange(anims); }
/// <summary> /// Add an animation to the list of Anims. /// </summary> /// <param name="a">The key to reference this animation.</param> /// <param name="anim">The anim value.</param> public void Add(TAnimType a, Anim anim) { Anims.Add(a, anim); CurrentAnim = a; }
public override void Init() { HitSound = Resources.Load("Sounds/Monsters/squirrel/squirrel-hurt1") as AudioClip; DieSound = Resources.Load("Sounds/Monsters/squirrel/squirrel-die2") as AudioClip; // TODO, when unity material bug is fixed, remove these lines FemaleLayers.Add("TempSprites/Materials/body_f_base"); FemaleLayers.Add("TempSprites/Materials/body_f_base_hat"); FemaleLayers.Add("TempSprites/Materials/body_f_leather"); FemaleLayers.Add("TempSprites/Materials/body_f_leather_hat"); FemaleLayers.Add("TempSprites/Materials/body_f_plate"); FemaleLayers.Add("TempSprites/Materials/body_f_plate_helm"); MaleLayers.Add("TempSprites/Materials/body_m_base"); MaleLayers.Add("TempSprites/Materials/body_m_base_hat"); MaleLayers.Add("TempSprites/Materials/body_m_leather"); MaleLayers.Add("TempSprites/Materials/body_m_leather_hat"); MaleLayers.Add("TempSprites/Materials/body_m_chain"); MaleLayers.Add("TempSprites/Materials/body_m_chain_hat"); BaseLayer = this.Gender == Character.Genders.Female ? "Races/Materials/body_f" : "Races/Materials/body_m"; HairLayer = this.Gender == Character.Genders.Female ? "Races/Hair/Materials/hair0_f" : "Races/Hair/Materials/hair0_m"; EyeLayer = this.Gender == Character.Genders.Female ? "Races/Materials/eyes_f" : "Races/Materials/eyes_m"; if (PlayerPrefs.GetInt("PlayType") == 2) { Name = "Joan"; XP = 5000; Attributes.Add(Attribute.AttributeTypes.Might, new AttributeInstance(SkillFactory.Might, 20)); Attributes.Add(Attribute.AttributeTypes.Smarts, new AttributeInstance(SkillFactory.Smarts, 20)); Attributes.Add(Attribute.AttributeTypes.Agility, new AttributeInstance(SkillFactory.Agility, 10)); AddSkill(SkillFactory.FindSkillByName("Swords"), 10); AddSkill(SkillFactory.FindSkillByName("Tough"), 15); AddSkill(SkillFactory.FindSkillByName("Cleave"), 5); AddSkill(SkillFactory.FindSkillByName("Dodge"), 10); AddSkill(SkillFactory.FindSkillByName("Arcane"), 10); EquipItem(ItemFactory.FindItemByName("Plate Armor") as Equipment, Equipment.EquipmentLocation.Torso); EquipItem(ItemFactory.FindItemByName("Flaming Sword of Fire") as Equipment, Equipment.EquipmentLocation.Weapon); BackpackItem(ItemFactory.FindItemByName("Leather Hat")); BackpackItem(ItemFactory.FindItemByName("Small Health Potion")); BackpackItem(ItemFactory.FindItemByName("Watermelon")); BackpackItem(ItemFactory.FindItemByName("Large XP Potion")); } else { Name = "Tina"; Attributes.Add(Attribute.AttributeTypes.Might, new AttributeInstance(SkillFactory.Might, 2)); Attributes.Add(Attribute.AttributeTypes.Smarts, new AttributeInstance(SkillFactory.Smarts, 1)); Attributes.Add(Attribute.AttributeTypes.Agility, new AttributeInstance(SkillFactory.Agility, 2)); AddSkill(SkillFactory.FindSkillByName("Swords"), 1); AddSkill(SkillFactory.FindSkillByName("Tough"), 1); AddSkill(SkillFactory.FindSkillByName("Cleave"), 1); EquipItem(ItemFactory.FindItemByName("Cloth Shirt") as Equipment, Equipment.EquipmentLocation.Torso); EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon); BackpackItem(ItemFactory.FindItemByName("Leather Hat")); BackpackItem(ItemFactory.FindItemByName("Small Health Potion")); BackpackItem(ItemFactory.FindItemByName("Watermelon")); } base.Init(); Anims.SetSequence("Walk"); }
public void SetAnimation(Anims _Anims) { _PlayerCurrentAnimation = GetBitmap(PlModel + _Anims); _GunCurrentAnimation = GetBitmap(GunModel + _Anims); }
/// <summary> /// Update the scene /// </summary> /// <param name="time"></param> /// <param name="hasFocus"></param> /// <param name="isCovered"></param> public override void Update(GameTime time, bool hasFocus, bool isCovered) { // Go back to the main menu if (Keyboard.IsNewKeyPress(Keys.Escape)) { ScreenManager.AddScreen(new MainMenu()); ExitScreen(); } switch (CurrentState) { #region Select hero case CharGenStates.SelectHero: if (Mouse.IsButtonDown(MouseButtons.Left)) { for (int id = 0; id < 4; id++) { if (HeroeBoxes[id].Contains(Mouse.Location)) { HeroID = id; // Create a new hero or remove it if (Heroes[id] == null) { Heroes[id] = new Hero(); CurrentState = CharGenStates.SelectRace; } else { CurrentState = CharGenStates.Delete; } } } } break; #endregion #region Select race case CharGenStates.SelectRace: { Point point = new Point(302, 160); for (int i = 0; i < 12; i++) { if (new Rectangle(point.X, point.Y, 324, 16).Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { CurrentHero.Race = (HeroRace)Enum.GetValues(typeof(HeroRace)).GetValue(i / 2); CurrentHero.Gender = (HeroGender)(i % 2); CurrentState = CharGenStates.SelectClass; } point.Y += 18; } } break; #endregion #region Select class case CharGenStates.SelectClass: { Point point = new Point(304, 0); var currentAllowedClasses = AllowedClass[CurrentHero.Race]; for (int i = 0; i < currentAllowedClasses.Count(); i++) { point.Y = 160 + i * 18; if (new Rectangle(point.X, point.Y, 324, 16).Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { CurrentHero.Professions.Clear(); foreach (HeroClass cls in Enum.GetValues(typeof(HeroClass))) { if ((currentAllowedClasses[i] & cls) != 0) { CurrentHero.Professions.Add(new Profession(0, currentAllowedClasses[i])); } } CurrentState = CharGenStates.SelectAlignment; } // Back if (BackButton.Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { CurrentState = CharGenStates.SelectRace; } } } break; #endregion #region Select alignment case CharGenStates.SelectAlignment: { Point point = new Point(304, 0); for (int i = 0; i < 9; i++) { point.Y = 176 + i * 18; if (new Rectangle(point.X, point.Y, 324, 16).Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { EntityAlignment[] alignments = new EntityAlignment[] { EntityAlignment.LawfulGood, EntityAlignment.NeutralGood, EntityAlignment.ChaoticGood, EntityAlignment.LawfulNeutral, EntityAlignment.TrueNeutral, EntityAlignment.ChaoticNeutral, EntityAlignment.LawfulEvil, EntityAlignment.NeutralEvil, EntityAlignment.ChaoticEvil, }; CurrentHero.Alignment = alignments[i]; CurrentHero.RollAbilities(); CurrentState = CharGenStates.SelectFace; } } // Back if (BackButton.Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { CurrentState = CharGenStates.SelectClass; } } break; #endregion #region Select face case CharGenStates.SelectFace: { if (Mouse.IsNewButtonDown(MouseButtons.Left)) { if (new Rectangle(288, 132, 64, 32).Contains(Mouse.Location)) { FaceOffset--; } if (new Rectangle(288, 164, 64, 32).Contains(Mouse.Location)) { FaceOffset++; } // Select a face for (int x = 0; x < 4; x++) { if (new Rectangle(352 + x * 64, 132, 64, 64).Contains(Mouse.Location)) { CurrentHero.Head = FaceOffset + x; CurrentState = CharGenStates.Confirm; break; } } } // Limit value if (CurrentHero.Gender == HeroGender.Male) { if (FaceOffset < 0) { FaceOffset = 0; } if (FaceOffset > 25) { FaceOffset = 25; } } else { if (FaceOffset < 29) { FaceOffset = 29; } if (FaceOffset > 40) { FaceOffset = 40; } } // Back if (BackButton.Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { CurrentState = CharGenStates.SelectAlignment; } } break; #endregion #region Confirm case CharGenStates.Confirm: { if (Mouse.IsNewButtonDown(MouseButtons.Left)) { // Reroll if (new Rectangle(448, 318, 76, 32).Contains(Mouse.Location)) { CurrentHero.RollAbilities(); } // Faces if (new Rectangle(448, 350, 76, 32).Contains(Mouse.Location)) { CurrentHero.Head = -1; CurrentState = CharGenStates.SelectFace; } // Modify if (new Rectangle(528, 316, 76, 32).Contains(Mouse.Location)) { } // Keep if (new Rectangle(528, 350, 76, 32).Contains(Mouse.Location)) { CurrentState = CharGenStates.SelectName; CurrentHero.Name = GetRandomName(CurrentHero.Race, CurrentHero.Gender); Keyboard.KeyDown += new EventHandler <PreviewKeyDownEventArgs>(Keyboard_OnKeyDown); } } } break; #endregion #region Select name case CharGenStates.SelectName: { // Back //if (BackButton.Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) if (new Rectangle(448, 350, 80, 32).Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { CurrentState = CharGenStates.Confirm; Keyboard.KeyDown -= Keyboard_OnKeyDown; } // OK if (new Rectangle(528, 350, 80, 32).Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) { Keyboard.KeyDown -= new EventHandler <PreviewKeyDownEventArgs>(Keyboard_OnKeyDown); CurrentState = CharGenStates.SelectHero; } } break; #endregion #region Delete hero case CharGenStates.Delete: { if (Mouse.IsNewButtonDown(MouseButtons.Left)) { // Delete if (new Rectangle(448, 344, 76, 32).Contains(Mouse.Location)) { Heroes[HeroID] = null; CurrentState = CharGenStates.SelectHero; } // Ok if (new Rectangle(528, 344, 76, 32).Contains(Mouse.Location)) { CurrentState = CharGenStates.SelectHero; } } } break; #endregion } // Update anim if (Anims != null) { Anims.Update(time); } // If the team is ready, let's go ! if (PlayButton.Rectangle.Contains(Mouse.Location) && Mouse.IsNewButtonDown(MouseButtons.Left)) // && IsTeamReadyToPlay) { PrepareTeam(); PlayButton.OnSelectEntry(); } }
public override void Load(BinaryReader reader, int size) { scriptGameVersion = 2; var sk = reader.BaseStream.Position; UnkBitfield = reader.ReadUInt32(); /* * for (int i = 0; i < 8; ++i) * { * ScriptSlots[i] = reader.ReadByte(); * } */ var Count_OGI = reader.ReadByte(); var Count_Anim = Count_OGI; var Count_Script = reader.ReadByte(); var Count_GameObject = reader.ReadByte(); var Count_UnkI32 = reader.ReadByte(); //reader.ReadUInt32(); var Count_Sound = reader.ReadUInt32(); //Class1 = reader.ReadUInt32(); //Class2 = reader.ReadUInt32(); //Class3 = reader.ReadUInt32(); var len = reader.ReadInt32(); Name = new string(reader.ReadChars(len)); // Read UInt32 script slots UI32.Clear(); for (int i = 0; i < Count_UnkI32; ++i) { UI32.Add(reader.ReadUInt32()); } // Read OGI script slots OGIs.Clear(); for (int i = 0; i < Count_OGI; ++i) { OGIs.Add(reader.ReadUInt16()); } // Read Animation script slots Anims.Clear(); for (int i = 0; i < Count_Anim; ++i) { Anims.Add(reader.ReadUInt16()); } // Read Script script slots Scripts.Clear(); for (int i = 0; i < Count_Script; ++i) { Scripts.Add(reader.ReadUInt16()); } // Read Object script slots Objects.Clear(); for (int i = 0; i < Count_GameObject; ++i) { Objects.Add(reader.ReadUInt16()); } // Read Sound script slots Sounds.Clear(); for (int i = 0; i < Count_Sound; ++i) { Sounds.Add(reader.ReadUInt16()); } // Read instance properties if ((UnkBitfield & 0x20000000) != 0x0) { //PHeader = reader.ReadUInt32(); //reader.BaseStream.Position -= 4; var Count_Flags = reader.ReadByte(); var Count_Floats = reader.ReadByte(); var Count_Ints = reader.ReadByte(); reader.ReadByte(); PUI32 = reader.ReadUInt32(); instFlagsList.Clear(); for (int i = 0; i < Count_Flags; ++i) { instFlagsList.Add(reader.ReadUInt32()); } instFloatsList.Clear(); for (int i = 0; i < Count_Floats; ++i) { instFloatsList.Add(reader.ReadSingle()); } instIntegerList.Clear(); for (int i = 0; i < Count_Ints; ++i) { instIntegerList.Add(reader.ReadUInt32()); } } else { //PHeader = 0; PUI32 = 0; instFlagsList.Clear(); instFloatsList.Clear(); instIntegerList.Clear(); } // Read IDs needed for instance creation if ((UnkBitfield & 0x40000000) != 0x0) { flag = reader.ReadUInt32(); if ((flag & 0x00000001) != 0) { var cnt = reader.ReadInt32(); cObjects.Clear(); for (int i = 0; i < cnt; ++i) { cObjects.Add(reader.ReadUInt16()); } } if ((flag & 0x00000002) != 0) { var cnt = reader.ReadInt32(); cOGIs.Clear(); for (int i = 0; i < cnt; ++i) { cOGIs.Add(reader.ReadUInt16()); } } if ((flag & 0x00000004) != 0) { var cnt = reader.ReadInt32(); cAnims.Clear(); for (int i = 0; i < cnt; ++i) { cAnims.Add(reader.ReadUInt16()); } } if ((flag & 0x00000008) != 0) { var cnt = reader.ReadInt32(); cCM.Clear(); for (int i = 0; i < cnt; ++i) { cCM.Add(reader.ReadUInt16()); } } if ((flag & 0x00000010) != 0) { var cnt = reader.ReadInt32(); cScripts.Clear(); for (int i = 0; i < cnt; ++i) { cScripts.Add(reader.ReadUInt16()); } } if ((flag & 0x00000020) != 0) { var cnt = reader.ReadInt32(); cUnk.Clear(); for (int i = 0; i < cnt; ++i) { cUnk.Add(reader.ReadUInt16()); } } if ((flag & 0x00000040) != 0) { var cnt = reader.ReadInt32(); cSounds.Clear(); for (int i = 0; i < cnt; ++i) { cSounds.Add(reader.ReadUInt16()); } } } scriptCommandsAmount = (int)reader.ReadUInt32(); if (scriptCommandsAmount != 0) { scriptCommand = new Script.MainScript.ScriptCommand(reader, scriptGameVersion); var command = scriptCommand; do { scriptCommands.Add(command); command = command.nextCommand; } while (command != null); } else { scriptCommand = null; } this.size = size; }
/// <summary> /// Clear the list of animations. /// </summary> public void Clear() { Anims.Clear(); }
// !--! public void animateEnemy(Anims a) { enemyAnimator.swapAnimation(a); enemyAnimation = a; }
public void animatePlayer(Anims a) { playerAnimator.swapAnimation(a); playerAnimation = a; }
public void SetAnimation(Anims _Anims ) { _PlayerCurrentAnimation = GetBitmap(PlModel + _Anims); _GunCurrentAnimation = GetBitmap(GunModel + _Anims); }