protected void CheckAnimation(AnimationList ani)
 {
     if (CurrentAnimation == (int)ani)
     {
         CurrentAnimation = (int)AnimationList.Move;
     }
 }
Beispiel #2
0
        public IceballMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/iceball.png")
        {
            Damage   = damageInstance;
            Width    = 64;
            Height   = 64;
            X        = p.X;
            Y        = p.Y;
            Creator  = zerd;
            Origin   = p;
            Distance = AbilityConstants.IceballDistance;
            Speed    = AbilityConstants.IceballSpeed;
            Velocity = Creator.Facing.Normalized();

            Animations = new AnimationList();
            var moveAnimation = new Animation(AnimationTypes.Move);

            moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            Animations.Add(moveAnimation);
            var deathAnimation = new Animation(AnimationTypes.Death);

            deathAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.08));
            deathAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.93f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.85f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.78f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.71f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.64f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.58f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.51f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 8, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.46f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 9, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.38f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 10, 0, 64, 64), TimeSpan.FromSeconds(0.08), () => { Opacity = 0.3f; return(true); });
            deathAnimation.AddFrame(new Rectangle(64 * 11, 0, 64, 64), TimeSpan.FromSeconds(0.08), DeathFunc);
            Animations.Add(deathAnimation);
        }
Beispiel #3
0
        public FrostDemon(MapSection section) : base(EnemyTypes.FrostDemon, EnemyConstants.GetFrostDemonProperties(), "Entities/FrostDemon.png", section)
        {
            _ai = new RangeAI(this, EnemyConstants.FrostDemonAggroRange, EnemyConstants.FrostDemonWanderLength, new RangeAttack(this, 14, 17, MissileTypes.FrostDemonMissile, EnemyConstants.FrostDemonMissileCooldown));

            HitboxSize  = 0.93f;
            Width       = 64;
            Height      = 64;
            AttackRange = 400;

            Animations = new AnimationList();
            var spawnAnimation = new Animation(AnimationTypes.Spawn);

            spawnAnimation.AddFrame(new Rectangle(0, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.05), SpawnedFunc);
            Animations.Add(spawnAnimation);

            var walkAnimation = new Animation(AnimationTypes.Move);

            walkAnimation.AddFrame(new Rectangle(TextureSize * 0, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 1, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 2, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 3, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 4, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 5, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 6, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 7, TextureSize * 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            Animations.Add(walkAnimation);

            var attackAnimation = new Animation(AnimationTypes.Attack);

            attackAnimation.AddFrame(new Rectangle(TextureSize * 0, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 1, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 2, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 3, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 4, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 5, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25), AttackedFunc);
            attackAnimation.AddFrame(new Rectangle(TextureSize * 6, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 7, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 7, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.05), DoneAttackingFunc);
            Animations.Add(attackAnimation);

            var dieAnimation = new Animation(AnimationTypes.Death);

            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25), OnDeath);
            dieAnimation.AddFrame(new Rectangle(TextureSize * 1, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 2, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 3, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 4, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 5, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 6, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 7, TextureSize * 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 1, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 2, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 3, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 4, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 5, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 6, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 7, TextureSize * 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.25), OnDeathFinished);
            Animations.Add(dieAnimation);
        }
Beispiel #4
0
 public void SetShellingData(HougekiModel model)
 {
     _iList       = getAnimation(model.AttackType);
     _clsAttacker = model.Attacker;
     setShipsTexture(model.Attacker);
     setSlotItems(model.GetSlotitems());
 }
Beispiel #5
0
        public IcicleMissile(Zerd zerd, DamageInstance damageInstance, Point p, int index) : base("Missiles/icicle.png")
        {
            Damage   = damageInstance;
            Width    = 40;
            Height   = 40;
            X        = p.X;
            Y        = p.Y;
            Creator  = zerd;
            Origin   = p;
            Distance = AbilityConstants.IcicleDistance;
            Speed    = AbilityConstants.IcicleSpeed;
            Velocity = Creator.Facing.Normalized().Rotate(360f * index / 8);
            // Move the icicle away from the caster a bit
            X += Velocity.X * 45;
            Y -= Velocity.Y * 45;

            Animations = new AnimationList();
            var moveAnimation = new Animation(AnimationTypes.Move);

            moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.1));
            Animations.Add(moveAnimation);
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void LoadSprites(object sender, LoadSpritesEventArgs e)
        {
            if (Animations != null)
            {
                System.Console.WriteLine("Reloading animations:");
                Animations.Dispose();
                Animations = null;
                background.Dispose();
                background = null;
                System.GC.Collect();
            }

            Animations = new AnimationList(Settings.Get <BomberStuff.Core.Utilities.ColorRemapInfo[]>(Settings.Types.PlayerColor));
            System.Console.WriteLine("Loading animations...");
            //long ticks = System.DateTime.Now.Ticks;
            AniFileReader.AddAliFile(Animations, Settings.Get <string>(Settings.Types.ABDirectory) + @"\DATA\ANI\master.ali");
            System.Console.WriteLine("Done loading animations..." /* took {0} µs", (System.DateTime.Now.Ticks - ticks) / 10.0*/);
            Animations.Check();
            System.Console.WriteLine("Animation check succeeded. All animations accounted for.");

            System.Console.WriteLine("Caching animations...");
            Animations.Cache(e.Device, Players.Length);
            System.Console.WriteLine("Done caching animations.");

            background = e.Device.LoadSprite(PCXReader.FromFile(Settings.Get <string>(Settings.Types.ABDirectory) + @"\DATA\RES\FIELD" + Tileset + ".PCX"), false, System.Drawing.Color.Transparent);

            System.Console.WriteLine("Stand by...");
            System.GC.Collect();
        }
Beispiel #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aniList"></param>
 /// <param name="device"></param>
 /// <returns></returns>
 public override BomberStuff.Core.UserInterface.ISprite GetSprite(AnimationList aniList, BomberStuff.Core.UserInterface.IDevice device)
 {
     //if (PlayerIndex == -1)
     //return aniList[Animation].GetSprite(device, AnimationState);
     //else
     return(aniList[Animation].GetSprite(device, AnimationState, PlayerIndex));
 }
Beispiel #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="aniList"></param>
 /// <param name="device"></param>
 /// <returns></returns>
 public override ISprite GetSprite(AnimationList aniList, IDevice device)
 {
     //if (PlayerIndex == -1)
     //return aniList[Animation].GetSprite(device, AnimationState);
     //else
     return(aniList[Animation].GetSprite(device, AnimationState, PlayerIndex));
 }
Beispiel #9
0
            public void ConvertAnimation(odfANIMSection anim, odfParser odaParser, bool odaSkeleton)
            {
                if (odaSkeleton)
                {
                    FrameList.Clear();
                    ConvertFrames(odaParser.FrameSection.RootFrame);
                }

                ImportedKeyframedAnimation iAnim = new ImportedKeyframedAnimation();

                AnimationList.Add(iAnim);
                iAnim.TrackList = new List <ImportedAnimationKeyframedTrack>(anim.Count);
                string notFound = String.Empty;

                foreach (odfTrack track in anim)
                {
                    odfFrame boneFrame = odf.FindFrame(track.BoneFrameId, odaParser.FrameSection.RootFrame);
                    if (boneFrame == null)
                    {
                        notFound += (notFound.Length > 0 ? ", " : "") + track.BoneFrameId;
                        continue;
                    }

                    ImportedAnimationKeyframedTrack iTrack = new ImportedAnimationKeyframedTrack();
                    iAnim.TrackList.Add(iTrack);
                    iTrack.Name      = boneFrame.Name;
                    iTrack.Keyframes = ConvertTrack(track.KeyframeList);
                }
                if (notFound.Length > 0)
                {
                    Report.ReportLog("Warning: Animations weren't converted for the following missing frame IDs: " + notFound);
                }
            }
Beispiel #10
0
        public HealthPotion(Enemy dropper) : base("Consumables/potions.png", dropper)
        {
            Animations = new AnimationList();
            var anim = new Animation(AnimationTypes.Stand);

            anim.AddFrame(new Rectangle(0, 537, 146, 155), TimeSpan.FromMilliseconds(100));
            Animations.Add(anim);
        }
Beispiel #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override SizeF GetOffset(AnimationList aniList)
        {
            SizeF offset = aniList[Animation].GetOffset(AnimationState);

            // HACKHACK: this belongs to the animation, not the object
            offset.Height -= 17.0f / 36.0f;

            return(offset);
        }
Beispiel #12
0
 public virtual void Play(AnimationList iList, Action callback)
 {
     _iList               = iList;
     _isFinished          = false;
     _actCallback         = callback;
     _nSpriteIndex        = 0;
     _uiHexBtn.spriteName = _strSpriteNames[_nSpriteIndex];
     this.SetActive(isActive: true);
     _animAnimation.Play(iList.ToString());
 }
Beispiel #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="aniList"></param>
        /// <returns></returns>
        public override SizeF GetOffset(AnimationList aniList)
        {
            //SizeF offset = aniList[Animation].GetOffset(AnimationState);

            //offset.Width += 0.0f / 40.0f;
            //offset.Height -= 10.0f / 36.0f;

            //return offset;
            return(new SizeF());
        }
Beispiel #14
0
 public void Play(AnimationList iList, Action callback)
 {
     Init();
     _actCallback = callback;
     base.transform.localPosition = Vector3.zero;
     _iList = iList;
     setGlowEffects();
     base.transform.localScale = Vector3.one;
     _animAnimation.Play(iList.ToString());
 }
Beispiel #15
0
 /// <summary>
 /// Get a sprite to draw for this object on the specified device
 /// </summary>
 /// <param name="aniList">The game's animation list</param>
 /// <param name="device">The device to get a sprite for</param>
 /// <returns>The sprite the draw</returns>
 public virtual ISprite GetSprite(AnimationList aniList, IDevice device)
 {
     // TRYTRY: this seems to be quite a performance penalty. Verify.
     //         Player-related objects currently override this instead
     //         of relying on this check.
     //if (PlayerIndex == -1)
     return(aniList[Animation].GetSprite(device, AnimationState));
     //else
     //	return aniList[Animation].GetSprite(device, AnimationState, PlayerIndex);
 }
Beispiel #16
0
        void AddList(Transform attach_transform, TextAnimation animation)
        {
            AnimationList list;

            if (m_PlayingList.TryGetValue(attach_transform, out list) == false)
            {
                list = new AnimationList();
                m_PlayingList.Add(attach_transform, list);
            }
            list.Add(animation);
        }
Beispiel #17
0
    public void AnimationTest(string aniName)
    {
        if (m_character == null)
        {
            return;
        }

        AnimationList aniList = m_character.GetComponent <AnimationList>();

        aniList.PlayAnimation(aniName);
    }
Beispiel #18
0
        public Editor(Pat.Project proj)
        {
            ProjectReset   += ResetActionIndex;
            AnimationReset += ResetPreviewMode;
            AnimationReset += ResetEditMode;

            Project = proj;

            AnimationFramesUI = new AnimationFrames(this);
            PreviewWindowUI   = new PreviewWindow(this);
            AnimationListUI   = new AnimationList(this);
        }
Beispiel #19
0
            public void ConvertAnimation(reaANICsection animSection, remParser parser)
            {
                ImportedSampledAnimation anim = new ImportedSampledAnimation();

                anim.TrackList = new List <ImportedAnimationSampledTrack>(animSection.Count);
                foreach (reaAnimationTrack track in animSection)
                {
                    remBone boneFrame  = rem.FindFrame(track.boneFrame, parser.BONC.rootFrame);
                    bool    isTopFrame = boneFrame != null && boneFrame.Parent == parser.BONC.rootFrame;
                    ImportedAnimationSampledTrack iTrack = ConvertTrack(track, isTopFrame);
                    anim.TrackList.Add(iTrack);
                }
                AnimationList.Add(anim);
            }
 private void DebugPlay()
 {
     _iList       = AnimationList.ProdTorpedoCutIn;
     _actCallback = null;
     GetComponent <Animation>().Stop();
     base.Play(_iList, null);
     debugShipInfo();
     if (_iList == AnimationList.ProdTorpedoCutIn || _iList == AnimationList.TorpedoCutInFriend)
     {
         ShipUtils.PlayTorpedoVoice(getTorpedoCutInShip(_clsRaigeki, isFriend: true));
     }
     else if (_iList != AnimationList.TorpedoCutInEnemy)
     {
     }
 }
 private void init()
 {
     _iList = AnimationList.None;
     if (_listShipTex == null)
     {
         _listShipTex = new List <UITexture>();
         foreach (int value in Enum.GetValues(typeof(FleetType)))
         {
             if (value != 2)
             {
                 _listShipTex.Add(((Component)base.transform.FindChild($"{((FleetType)value).ToString()}Ship/Anchor/Object2D")).GetComponent <UITexture>());
             }
         }
     }
 }
Beispiel #22
0
        private MstShipGraphColumn GetGraphColumn(AnimationList iList)
        {
            switch (iList)
            {
            case AnimationList.ProdTAMainBatteryx3:
                return(MstShipGraphColumn.CutIn);

            case AnimationList.ProdTATorpedox2:
            case AnimationList.ProdTAMainBatteryNTorpedo:
                return(MstShipGraphColumn.CutInSp1);

            default:
                return(MstShipGraphColumn.CutIn);
            }
        }
Beispiel #23
0
        public HuePopUp(AnimationList animationList, int hue)
        {
            InitializeComponent();
            Icon = Options.GetFiddlerIcon();
            if ((hue & 0x8000) != 0)
            {
                hue ^= 0x8000;
                HueOnlyGray.Checked = true;
            }
            if (hue != 0)
            {
                control.Selected = hue;
            }

            _animationListMob = animationList;
        }
Beispiel #24
0
        public Key(Enemy dropper) : base("Consumables/key.png", dropper)
        {
            const float scale = 0.2f;

            Width      = 134 * scale;
            Height     = 218 * scale;
            HitboxSize = 2;
            Animations = new AnimationList();
            var anim = new Animation(AnimationTypes.Stand, 134, 218);

            anim.AddFrame(0, 0, TimeSpan.FromMilliseconds(300));
            anim.AddFrame(1, 0, TimeSpan.FromMilliseconds(200));
            anim.AddFrame(2, 0, TimeSpan.FromMilliseconds(200));
            anim.AddFrame(1, 0, TimeSpan.FromMilliseconds(300));
            Animations.Add(anim);
        }
	void AnimationComplete( Spine.AnimationState animationState, int trackIndex, int loopCount ){
		switch( animationState.ToString( ) ){
		case "Idle" :
			runningAnimation = AnimationList.Idle;
			break;
		case "Walking":
			runningAnimation = AnimationList.Walking;
			break;
		case "Running":
			runningAnimation = AnimationList.Running;
			break;
		case "Activate":
			runningAnimation = AnimationList.Activate;
			break;
		}
	}
Beispiel #26
0
        public void SetFocusAnimation()
        {
            _animAnimation.Stop();
            _animAnimation.wrapMode = WrapMode.Default;
            UISprite component = ((Component)base.transform.FindChild("HexSelect")).GetComponent <UISprite>();

            component.alpha      = 0.03f;
            _toggle.startsActive = false;
            if (isFocus)
            {
                _toggle.startsActive    = true;
                _animAnimation.wrapMode = WrapMode.Loop;
                _iList = AnimationList.HexButtonSelect;
                _animAnimation.Play(_iList.ToString());
            }
        }
Beispiel #27
0
        public LavaBlastMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/lava_blast.png")
        {
            Damage     = damageInstance;
            Width      = 86;
            Height     = 86;
            X          = p.X;
            Y          = p.Y;
            Creator    = zerd;
            Origin     = p;
            Distance   = AbilityConstants.FireballDistance * (1 + zerd.Player.AbilityUpgrades[AbilityUpgradeType.LavaBlastDistance] / 100f);
            Speed      = AbilityConstants.FireballSpeed;
            Velocity   = Creator.Facing.Normalized();
            TargetsHit = new List <Being>();

            Animations = new AnimationList();
            var moveAnimation = new Animation(AnimationTypes.Move);

            moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 0, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 1, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 2, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1));
            moveAnimation.AddFrame(new Rectangle(120 * 3, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.1));
            Animations.Add(moveAnimation);

            var deathAnimation = new Animation(AnimationTypes.Death);

            deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03));
            deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.91f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.82f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 0, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.73f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.64f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.55f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.46f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 1, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.37f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 0, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.28f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 1, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.19f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 2, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), () => { Opacity = 0.1f; return(true); });
            deathAnimation.AddFrame(new Rectangle(120 * 3, 120 * 2, 120, 120), TimeSpan.FromSeconds(0.03), DeathFunc);
            Animations.Add(deathAnimation);
        }
Beispiel #28
0
    public Coroutine StartAnimation(string key, IEnumerator coro)
    {
        if (string.IsNullOrEmpty(key))
        {
            throw new ArgumentException("key");
        }
        if (animations.ContainsKey(key) == false)
        {
            animations[key] = new AnimationList();
        }

        var c = StartCoroutine(WrapCoroutine(key, coro));

        animations[key].coroutines.Add(c);

        return(c);
    }
Beispiel #29
0
        public override void Process()
        {
            currentStep++;

            float   t   = (float)currentStep / (float)stepCount;
            Vector3 pos = path.GetStep(t);

            setValue(pos);

            if (currentStep < stepCount)
            {
                return;
            }

            AnimationList.Remove(this);
            RaiseAnimationFinishedEvent();
        }
Beispiel #30
0
        public Zombie(MapSection section) : base(EnemyTypes.Zombie, EnemyConstants.GetZombieProperties(), "Entities/Zombie.png", section)
        {
            _ai = new MeleeAI(this, EnemyConstants.ZombieAggroRange, new Melee(this, EnemyConstants.ZombieMinDamage, EnemyConstants.ZombieMaxDamage), EnemyConstants.ZombieWanderLength);

            HitboxSize  = 0.8f;
            Width       = 64;
            Height      = 64;
            AttackRange = EnemyConstants.ZombieAttackRange;

            Animations = new AnimationList();
            var spawnAnimation = new Animation(AnimationTypes.Spawn);

            spawnAnimation.AddFrame(new Rectangle(TextureSize * 13, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.5));
            spawnAnimation.AddFrame(new Rectangle(TextureSize * 14, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.5));
            spawnAnimation.AddFrame(new Rectangle(TextureSize * 14, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.05), SpawnedFunc);
            Animations.Add(spawnAnimation);

            var walkAnimation = new Animation(AnimationTypes.Move);

            walkAnimation.AddFrame(new Rectangle(TextureSize * 9, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.4));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 10, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.4));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 11, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.4));
            walkAnimation.AddFrame(new Rectangle(TextureSize * 12, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.4));
            Animations.Add(walkAnimation);

            var attackAnimation = new Animation(AnimationTypes.Attack);

            attackAnimation.AddFrame(new Rectangle(TextureSize * 7, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.35));
            attackAnimation.AddFrame(new Rectangle(TextureSize * 8, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.4), AttackedFunc);
            attackAnimation.AddFrame(new Rectangle(TextureSize * 8, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1), DoneAttackingFunc);
            Animations.Add(attackAnimation);

            var dieAnimation = new Animation(AnimationTypes.Death);

            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 0, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1), OnDeath);
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 1, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 2, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 3, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 4, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 5, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 0, 6, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1));
            dieAnimation.AddFrame(new Rectangle(TextureSize * 6, 6, TextureSize, TextureSize), TimeSpan.FromSeconds(0.1), OnDeathFinished);
            Animations.Add(dieAnimation);
        }
Beispiel #31
0
        public ArrowMissile(Being being, DamageInstance damageInstance, Point p) : base("Missiles/arrow.png")
        {
            Damage   = damageInstance;
            Width    = 22;
            Height   = 22;
            X        = p.X;
            Y        = p.Y;
            Creator  = being;
            Origin   = p;
            Distance = EnemyConstants.ArcherArrowLength;
            Speed    = EnemyConstants.ArcherArrowSpeed;
            Velocity = Creator.Facing.Normalized().Rotate(Helpers.RandomInRange(-3, 3));

            Animations = new AnimationList();
            var moveAnimation = new Animation(AnimationTypes.Move);

            moveAnimation.AddFrame(new Rectangle(0, 0, 32, 32), TimeSpan.FromSeconds(0.15));
            Animations.Add(moveAnimation);
        }
	public void InitAnimations( GameObject characterObject ) {
		this.sceneCharacter = characterObject.transform.parent.gameObject;
		this.spineAnimation = sceneCharacter.GetComponent< SkeletonAnimation >( );
		this.runningAnimation = AnimationList.Idle;
		this.spineAnimation.state.Complete += AnimationComplete;
	}
	public void PlayNewAnimation( AnimationList animation ){
		PlayNewAnimation( animation, false );
	}
	public void PlayNewAnimation( AnimationList animation, bool isLooped ){
		spineAnimation.state.AddAnimation( 1, animation.ToString( ), isLooped, 0.5f );
		runningAnimation = animation;
	}