当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.AddAnimation方法代码示例

本文整理汇总了C#中GameObject.AddAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.AddAnimation方法的具体用法?C# GameObject.AddAnimation怎么用?C# GameObject.AddAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObject的用法示例。


在下文中一共展示了GameObject.AddAnimation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateGuardGO

        public static GameObject CreateGuardGO(ContentManager content, GraphicsDevice gd, List<Vector2> points)
        {
            if (guardTexture == null)
            {
                guardTexture = content.Load<Texture2D>("Guard");
            }

            GameObject guard = new GameObject();

            guard.AddTransform();
            guard.AddAnimation(guardTexture, new Vector2(20f, 34f));
            guard.AddScript(new GuardScript(guard, points));
            guard.Animation.AddAnimation("Idle", 1, 1);
            guard.Animation.AddAnimation("Run", 0, 4);
            guard.AddDynamicRigidBody(new Vector2(20f, 34f));
            guard.Animation.Play("Idle");
            guard.AddRenderer(gd, SpriteTransparency.Transparent);

            return guard;
        }
开发者ID:ErikUggeldahl,项目名称:AlternativeDevelopment2012PrisonBreak,代码行数:20,代码来源:GuardScript.cs

示例2: CreateTysonGO

        public static GameObject CreateTysonGO(ContentManager manager, GraphicsDevice gd, PlayerScript playerScript)
        {
            if (tysonSprite == null)
            {
                tysonSprite = manager.Load<Texture2D>("Characters/MikeTyson");
            }

            GameObject tyson = new GameObject();

            tyson.AddTransform();
            tyson.AddAnimation(tysonSprite, new Vector2(60f, 119f));
            tyson.Animation.AddAnimation("Idle", 0, 4);
            tyson.Animation.AddAnimation("Die", 1, 3, false);
            tyson.Animation.Play("Idle");
            tyson.AddRenderer(gd, SpriteTransparency.Transparent);
            tyson.AddTrigger(new Vector2(80f, 119f));
            tyson.Trigger.CollidesWith = CollisionCats.PlayerCategory;
            ShankTargetScript tysonScript = new ShankTargetScript(tyson, playerScript);
            tyson.AddScript(tysonScript);
            tyson.Trigger.OnEnter += new FarseerPhysics.Dynamics.OnCollisionEventHandler(tysonScript.OnEnter);
            tyson.Trigger.OnStay += new FarseerPhysics.Dynamics.OnSeparationEventHandler(tysonScript.OnStay);

            return tyson;
        }
开发者ID:ErikUggeldahl,项目名称:AlternativeDevelopment2012PrisonBreak,代码行数:24,代码来源:ShankTargetScript.cs

示例3: LoadContent


//.........这里部分代码省略.........
            teleporter3.Transform.Translate(new Vector2(330f, 140f));
            manager.AddGameObject(teleporter3);
            GameObject teleporter4 = TeleporterScript.CreateTeleporterGO(Content, playerScript, new Vector2(600f, 140f), false);
            teleporter4.Transform.Translate(new Vector2(2450f, 340f));
            manager.AddGameObject(teleporter4);
            GameObject teleporter5 = TeleporterScript.CreateTeleporterGO(Content, playerScript, new Vector2(1604f, -332f), true);
            teleporter5.Transform.Translate(new Vector2(800f, 140f));
            manager.AddGameObject(teleporter5);
            GameObject teleporter6 = TeleporterScript.CreateTeleporterGO(Content, playerScript, new Vector2(600f, -230f), false);
            teleporter6.Transform.Translate(new Vector2(2385f, -420f));
            manager.AddGameObject(teleporter6);

            GameObject tyson = ShankTargetScript.CreateTysonGO(Content, GraphicsDevice, playerScript);
            tyson.Transform.Translate(new Vector2(775f, 180f));
            manager.AddGameObject(tyson);

            //GameObject laser = LaserScript.CreateLaserGO(Content, GraphicsDevice);
            //manager.AddGameObject(laser);
            //laser.Transform.Translate(new Vector3(400f, 30f, 0f));

            //List<Vector2> patrolPoints = GuardScript.CreatePatrolPoints(200f, -50f, 300f, -50f, 400f, -50f, 500f, -50f);
            //GameObject guard = GuardScript.CreateGuardGO(Content, GraphicsDevice, patrolPoints);
            //guard.Transform.Translate(new Vector2(-300f, -50f));
            //manager.AddGameObject(guard);

            GameObject shank = ShankScript.CreateShankGO(Content, GraphicsDevice, (PlayerScript)player.GetComponent<PlayerScript>());
            manager.AddGameObject(shank);

            GameObject superStar = new GameObject();
            superStar.AddTransform();
            superStar.AddAudio();
            superStar.Audio.AddMusic(Content.Load<Song>("Sounds/Music/GuileTheme"));
            superStar.Transform.Translate(new Vector2(692f, -200f));
            superStar.AddAnimation(Content.Load<Texture2D>("Pickups/Superstar"), new Vector2(14f, 20f));
            superStar.Animation.AddAnimation("Idle", 0, 4);
            superStar.Animation.Play("Idle");
            superStar.AddRenderer(GraphicsDevice, SpriteTransparency.Transparent);
            superStar.AddTrigger(new Vector2(100f, 100f));
            superStar.AddScript(new EndScript(superStar));
            manager.AddGameObject(superStar);

            List<string> kkDi1 = new List<string>(11);
            kkDi1.Add("Who's out there?");
            kkDi1.Add("Just a man looking for his place in this cesspool.");
            kkDi1.Add("Well, this ain't no zoo so unless you gots anything for me then scram.");
            kkDi1.Add("What could an oversized turtle want in prison?");
            kkDi1.Add("Turtle!? When I have my koopas catch yo -");
            kkDi1.Add("You're minions couldn't catch a fat 3 foot tall plumber, even if they had wings.");
            kkDi1.Add("If my flying koopas in here hadn't had their wings pulled off by that damn Donkey Kong I'd have you before getting out of this cell.");
            kkDi1.Add("Ripping their wings off? Why'd he do that?");
            kkDi1.Add("That damn monkey was trying to muscle in on my woman. After Pauline disappeared he went after my princess before coming here. I put a hit on him but the damn monkey's too tough for my troopas. But when I'm out of this cell not only is he a dead chimp but I'll be busting out of here real soon.");
            kkDi1.Add("How do you intend on escaping the prison?");
            kkDi1.Add("None of your business. But if you bring me that primates head I might let you in on the plan.");
            List<string> kkCh1 = new List<string>(11);
            kkCh1.Add("Bowser");
            kkCh1.Add("Player");
            kkCh1.Add("Bowser");
            kkCh1.Add("Player");
            kkCh1.Add("Bowser");
            kkCh1.Add("Player");
            kkCh1.Add("Bowser");
            kkCh1.Add("Player");
            kkCh1.Add("Bowser");
            kkCh1.Add("Player");
            kkCh1.Add("Bowser");
            GameObject kkDGO1 = DialogueBoxScript.CreateDialogueAreaGO(kkDi1, kkCh1, new Vector2(96f, 64f));
开发者ID:ErikUggeldahl,项目名称:AlternativeDevelopment2012PrisonBreak,代码行数:67,代码来源:Game1.cs

示例4: CreatePlayerGO

        public static GameObject CreatePlayerGO(ContentManager content, GraphicsDevice gd)
        {
            if (characterSprite == null)
            {
                characterSprite = content.Load<Texture2D>("Characters/MainCharacter");
            }

            GameObject playerGO = new GameObject();
            playerGO.AddTransform();
            playerGO.AddAudio();
            playerGO.Audio.AddSFX("Pickup", content.Load<SoundEffect>("Sounds/PlayerSounds/Pickup"));
            playerGO.Audio.AddSFX("Shank", content.Load<SoundEffect>("Sounds/PlayerSounds/Shank"));
            playerGO.AddAnimation(characterSprite, new Vector2(28f, 30f));
            playerGO.Animation.AddAnimation("Idle", 0, 1);
            playerGO.Animation.AddAnimation("Run", 0, 4);
            playerGO.Animation.AddAnimation("Hide", 2, 1);
            playerGO.Animation.AddAnimation("Stab", 3, 1);
            playerGO.Animation.AddAnimation("Stealth", 1, 4);
            playerGO.Animation.AddAnimation("Elevator", 5, 1);
            playerGO.Animation.AddAnimation("VentIdle", 4, 1);
            playerGO.Animation.AddAnimation("VentCrawl", 4, 4);
            playerGO.AddRenderer(gd, SpriteTransparency.Transparent);
            playerGO.AddDynamicRigidBody(new Vector2(28f, 30f));
            playerGO.RigidBody.CollisionCategory = CollisionCats.PlayerCategory;
            playerGO.AddScript(new PlayerScript(playerGO));

            return playerGO;
        }
开发者ID:ErikUggeldahl,项目名称:AlternativeDevelopment2012PrisonBreak,代码行数:28,代码来源:PlayerScript.cs


注:本文中的GameObject.AddAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。