private void btn_respawnRole_Click(object sender, EventArgs e) { ItemGroup roleGrp = ModuleSharer.SceneMgr.GetGroupByName("RoleGroup"); if(roleGrp == null) { roleGrp = new ItemGroup(); roleGrp.Name = "RoleGroup"; ModuleSharer.SceneMgr.ItemGroups.Add(roleGrp); } roleGrp.Items.Clear(); Role role = new Role(); role.Name = "Role"; AnimTexture animTex = new AnimTexture("Roles/MarioRole"); animTex.SourceRect = new Rectangle(0, 0, 28, 48); animTex.AnimSeqList.Add(new AnimSequence("Run", 0, 8, 10, false, true)); animTex.PlaySeq("Run"); role.AnimTexture = animTex; role.PhysicsBody = new PhysicsBody(role.AnimTexture.TextureSize); role.Active = true; role.IsStatic = false; role.Position = ModuleSharer.SceneMgr.Camera.Focus; roleGrp.Add(role); // SceneMgr.Instance.RespawnRole(new Vector2(GameMgr.GameWidth / 2, GameMgr.GameHeight / 2)); }
/// <summary> /// Loads the textures /// </summary> private void LoadTextures() { // Load animated textures. this.walkLeftAnimation = new AnimTexture(Resources.guard48x48_Walking_Left, 0.2f, true, 48); this.walkRightAnimation = new AnimTexture(Resources.guard48x48_Walking_Right, 0.2f, true, 48); this.walkUpAnimation = new AnimTexture(Resources.guard48x48_Walking_Up, 0.2f, true, 48); this.walkDownAnimation = new AnimTexture(Resources.guard48x48_Walking_Down, 0.2f, true, 48); this.stillAnimation = new AnimTexture(Resources.Guard48x96_AliveDead, 0.2f, true, 48); this.hands = new AnimTexture(Resources.player48x240_Hands, 0.2f, true, 48); this.gunFlame = new AnimTexture(Resources.Gun_Flame, 0.2f, true, 48); this.vest = Resources.Vest; }
/// <summary> /// Initializes a new instance of the Chest class /// </summary> /// <param name="x">Coordinate X</param> /// <param name="y">Coordinate Y</param> /// <param name="image">Image of the chest</param> /// <param name="company">Delivery company for the inventory</param> public Chest(int x, int y, Image image, ItemDeliveryCompany company) : base(x, y, image) { this.Inventory = company.DeliverInventory(); this.openCloseAnimation = new AnimTexture(Resources.Chest_Close_Open, 0.2f, true, 48); }
/// <summary> /// Loads an animation from a texture /// </summary> /// <param name="animTexture">Animation texture</param> public void LoadAnimation(AnimTexture animTexture) { // Start the new animation. this.AnimTexture = animTexture; }
/// <summary> /// Begins or continues playback of an animation. /// </summary> /// <param name="animTexture">An animation texture</param> public void PlayAnimation(AnimTexture animTexture) { // If this animation is already running, do not restart it. if (this.AnimTexture == animTexture) { return; } // Start the new animation. this.AnimTexture = animTexture; this.FrameIndex = 0; this.time = 0.0f; }
/// <summary> /// Load textures /// </summary> private void LoadTextures() { this.walkLeftAnimation = new AnimTexture(Resources.player48x48_Walking_Left, 0.2f, true, 48); this.walkRightAnimation = new AnimTexture(Resources.player48x48_Walking_Right, 0.2f, true, 48); this.walkUpAnimation = new AnimTexture(Resources.player48x48_Walking_Up, 0.2f, true, 48); this.walkDownAnimation = new AnimTexture(Resources.player48x48_Walking_Down, 0.2f, true, 48); this.stillAnimation = new AnimTexture(Resources.player48x48_Idle, 0.2f, true, 48); this.hands = new AnimTexture(Resources.player48x240_Hands, 0.2f, true, 48); this.gunFlame = new AnimTexture(Resources.Gun_Flame, 0.2f, true, 48); }
public void SetAnimTexture(AnimTexture animTexture) { tte_texture.TexturePath = animTexture.TexturePath; anv_anim.AnimTexture = animTexture; }