當前位置: 首頁>>代碼示例>>C#>>正文


C# Animation.HasSequence方法代碼示例

本文整理匯總了C#中OpenRA.Graphics.Animation.HasSequence方法的典型用法代碼示例。如果您正苦於以下問題:C# Animation.HasSequence方法的具體用法?C# Animation.HasSequence怎麽用?C# Animation.HasSequence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenRA.Graphics.Animation的用法示例。


在下文中一共展示了Animation.HasSequence方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NormalizeSequence

        public static string NormalizeSequence(Animation anim, DamageState state, string sequence)
        {
            var states = new Pair<DamageState, string>[]
            {
                Pair.New(DamageState.Critical, "critical-"),
                Pair.New(DamageState.Heavy, "damaged-"),
                Pair.New(DamageState.Medium, "scratched-"),
                Pair.New(DamageState.Light, "scuffed-")
            };

            // Remove existing damage prefix
            foreach (var s in states)
            {
                if (sequence.StartsWith(s.Second))
                {
                    sequence = sequence.Substring(s.Second.Length);
                    break;
                }
            }

            foreach (var s in states)
                if (state >= s.First && anim.HasSequence(s.Second + sequence))
                    return s.Second + sequence;

            return sequence;
        }
開發者ID:ushardul,項目名稱:OpenRA,代碼行數:26,代碼來源:RenderSprites.cs

示例2: GravityBomb

        public GravityBomb(GravityBombInfo info, ProjectileArgs args)
        {
            Args = args;
            altitude = args.srcAltitude;

            anim = new Animation(info.Image);
            if (anim.HasSequence("open"))
                anim.PlayThen("open", () => anim.PlayRepeating("idle"));
            else
                anim.PlayRepeating("idle");
        }
開發者ID:patthoyts,項目名稱:OpenRA,代碼行數:11,代碼來源:GravityBomb.cs

示例3: NormalizeSequence

        public static string NormalizeSequence(Animation anim, DamageState state, string sequence)
        {
            // Remove any existing damage prefix
            sequence = UnnormalizeSequence(sequence);

            foreach (var s in DamagePrefixes)
                if (state >= s.First && anim.HasSequence(s.Second + sequence))
                    return s.Second + sequence;

            return sequence;
        }
開發者ID:pchote,項目名稱:OpenRA,代碼行數:11,代碼來源:RenderSprites.cs

示例4: GravityBomb

        public GravityBomb(GravityBombInfo info, ProjectileArgs args)
        {
            this.info = info;
            this.args = args;
            pos = args.Source;
            velocity = new WVec(WRange.Zero, WRange.Zero, -info.Velocity);

            anim = new Animation(info.Image);
            if (anim.HasSequence("open"))
                anim.PlayThen("open", () => anim.PlayRepeating("idle"));
            else
                anim.PlayRepeating("idle");
        }
開發者ID:Generalcamo,項目名稱:OpenRA,代碼行數:13,代碼來源:GravityBomb.cs

示例5: NormalizeSequence

        public static string NormalizeSequence(Animation anim, DamageState state, string baseSequence)
        {
            var states = new Pair<DamageState, string>[]
            {
                Pair.New(DamageState.Critical, "critical-"),
                Pair.New(DamageState.Heavy, "damaged-"),
                Pair.New(DamageState.Medium, "scratched-"),
                Pair.New(DamageState.Light, "scuffed-")
            };

            foreach (var s in states)
                if (state >= s.First && anim.HasSequence(s.Second+baseSequence))
                    return s.Second+baseSequence;

            return baseSequence;
        }
開發者ID:TiriliPiitPiit,項目名稱:OpenRA,代碼行數:16,代碼來源:RenderSprites.cs

示例6: Parachute

        public Parachute(Player owner, float2 location, int altitude, Actor cargo)
        {
            this.location = location;
            this.altitude = altitude;
            this.cargo = cargo;

            var rs = cargo.Trait<RenderSimple>();
            var image = rs.anim.Name;
            palette = rs.Palette(owner);

            anim = new Animation(image);
            if (anim.HasSequence("idle"))
                anim.PlayFetchIndex("idle", () => 0);
            else
                anim.PlayFetchIndex("stand", () => 0);
            anim.Tick();

            paraAnim = new Animation("parach");
            paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle"));
        }
開發者ID:katzsmile,項目名稱:OpenRA,代碼行數:20,代碼來源:Parachute.cs

示例7: Parachute

        public Parachute(Player owner, PPos location, int altitude, Actor cargo)
        {
            this.location = location;
            this.altitude = altitude;
            this.cargo = cargo;

            var rs = cargo.Trait<RenderSimple>();
            var image = rs.anim.Name;
            palette = rs.Palette(owner);

            anim = new Animation(image);
            if (anim.HasSequence("idle"))
                anim.PlayFetchIndex("idle", () => 0);
            else
                anim.PlayFetchIndex("stand", () => 0);
            anim.Tick();

            var pai = cargo.Info.Traits.GetOrDefault<ParachuteAttachmentInfo>();

            paraAnim = new Animation(pai != null ? pai.ParachuteSprite : "parach");
            paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle"));

            if (pai != null) offset = pai.Offset;
        }
開發者ID:JamesDunne,項目名稱:OpenRA,代碼行數:24,代碼來源:Parachute.cs


注:本文中的OpenRA.Graphics.Animation.HasSequence方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。