public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            //do not remove this
            base.LoadBasicContent(content);

            logo = content.Load<Texture2D>("logo");
        }
示例#2
0
        public FontManager(GraphicsDevice graphicsDevice, Microsoft.Xna.Framework.Content.ContentManager content, int appWinHeight)
        {
            m_LabelColor = Color.Red;
            m_TopEchoColor = Color.Black;
            m_BottomEchoColor = Color.Black;
            ComputeFontPositions(appWinHeight);

            m_LabelFont = null;
            m_EchoFont = null;
            m_DrawHelper = null;

            const String path1 = @"Resources/Fonts/Arial";
            const String path2 = @"Content/Resources/Fonts/Arial";
            String usePath = null;

            #if WINDOWS_PHONE
            usePath = path2;
            #else
            if (File.Exists(string.Concat(path1, ".xnb")))
                usePath = path1;
            else if (File.Exists(string.Concat(path2, ".xnb")))
                usePath = path2;
            #endif

            if (null!=usePath) {
                m_LabelFont = content.Load<SpriteFont>(usePath);
                m_EchoFont = content.Load<SpriteFont>(usePath);
                Vector2 spaceSize = m_EchoFont.MeasureString(" ");
                m_SpaceFillerWidth = spaceSize.X;
            }
        }
示例#3
0
文件: Life.cs 项目: faudeval/projet
 public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content, string assetName)
 {
     base.LoadContent(content, assetName);
     heart2 = content.Load<Texture2D>("heartv2");
     heart1 = content.Load<Texture2D>("heartv1");
     Position = new Microsoft.Xna.Framework.Vector2(0,0);
 }
示例#4
0
        public override void Init(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            base.Init(content);
            this.collider = new RectangleCollider(new Vector2(0, 0), new Vector2(64, 64));
            Random r = new Random();
            int choo = r.Next(0,100);
            if(choo < 3)
            {
                this.texture = new AnimatedTexture2D(content.Load<Texture2D>(FileNames.jewelPurple), 64, animationSub.def);
                this.loot = 2500;
            }
            else if (choo < 10)
            {
                this.texture = new AnimatedTexture2D(content.Load<Texture2D>(FileNames.jewelBlue), 64, animationSub.def);
                this.loot = 2000;
            }
            else if (choo <  20)
            {
                this.texture = new AnimatedTexture2D(content.Load<Texture2D>(FileNames.jewelOrange), 64, animationSub.def);
                this.loot = 1500;
            }
            else if (choo < 50)
            {
                this.texture = new AnimatedTexture2D(content.Load<Texture2D>(FileNames.jewelGreen), 64, animationSub.def);
                this.loot = 1000;
            }
            else
            {
                this.texture = new AnimatedTexture2D(content.Load<Texture2D>(FileNames.jewelRed), 64, animationSub.def);
                this.loot = 500;
            }

            this.texture.skipC = 4;
        }
        public override bool InitOne(Microsoft.Xna.Framework.Content.ContentManager content, int id)
        {
            XmlDocument _doc = new XmlDocument();
            _doc.Load(_xmlInfo);
            XmlNode _label = _doc.SelectSingleNode("//Label[@id = '" + id.ToString() + "']");

            _prototype[id] = new Label();

            _prototype[id]._nsprite = 1;
            _prototype[id]._sprite = new GameSprite[_prototype[id]._nsprite];
            Texture2D _tempTexture = content.Load<Texture2D>(_label.SelectSingleNode ("BackGround").InnerText);
            _prototype[id]._sprite[0] = new GameSprite(_tempTexture, 0, 0);

            ((Label)_prototype[id]).Sf = content.Load<SpriteFont>(_label.SelectSingleNode("Font").InnerText);
            ((Label)_prototype[id]).StringInfo = _label.SelectSingleNode("StringInfo").InnerText;
            _prototype[id].X = int.Parse(_label.SelectSingleNode("X").InnerText);
            _prototype[id].Y = int.Parse(_label.SelectSingleNode("Y").InnerText);
            _prototype[id].OffSetX = _prototype[id].X;
            _prototype[id].OffSetY = _prototype[id].Y;
            ((Label)_prototype[id]).DrawOffSetX = int.Parse(_label.SelectSingleNode("DrawOffSetX").InnerText);
            ((Label)_prototype[id]).DrawOffSetY = int.Parse(_label.SelectSingleNode("DrawOffSetY").InnerText);

            float _red = float.Parse(_label.SelectSingleNode("Color").SelectSingleNode("R").InnerText);
            float _green = float.Parse(_label.SelectSingleNode("Color").SelectSingleNode("G").InnerText);
            float _blue = float.Parse(_label.SelectSingleNode("Color").SelectSingleNode("B").InnerText);
            ((Label)_prototype[id]).StringColor = new Color(_red, _green, _blue);

            return true;
        }
示例#6
0
 public Item(int id, Microsoft.Xna.Framework.Content.ContentManager content)
 {
     _ID = id;
     if (_ID == (int)ItemName.Apple)
     {
         _texture = content.Load<Texture2D>("Sprites\\Apple");
         _description = "Restores a small amount of health when eaten.";
     }
     if (_ID == (int)ItemName.Golden_Apple)
     {
         _texture = content.Load<Texture2D>("Sprites\\GoldenApple");
         _description = "Fully restores a creature when eaten.";
     }
     if (_ID == (int)ItemName.Spring_Water)
     {
         _texture = content.Load<Texture2D>("Sprites\\SpringWater");
         _description = "Fresh from the springs. Fully restores stamina.";
     }
     if (_ID == (int)ItemName.Honey)
     {
         _texture = content.Load<Texture2D>("Sprites\\Honey");
         _description = "Sugary goodness. Increases a creature's obedience.";
     }
     if (_ID == (int)ItemName.Chilli)
     {
         _texture = content.Load<Texture2D>("Sprites\\Chilli");
         _description = "Makes a creature more aggressive when eaten.";
     }
 }
示例#7
0
 public override void LoadTexture( Microsoft.Xna.Framework.Content.ContentManager Content )
 {
     Texture = Content.Load<Texture2D>( "Sprites\\ExtraLife" );
     Halo = Content.Load<Texture2D>( "Sprites\\ExtraAlive" );
     Origin = new Vector2( 16, 16 );
     Scale = 2.0F;
 }
        public bool Validate(FileCollection sourceFiles, Microsoft.SharePoint.Client.ClientContext ctx)
        {
            int scount = 0;
            int tcount = 0;

            foreach (var sf in sourceFiles)
            {
                scount++;
                string fileName = sf.Src;
                string folderName = sf.Folder;
                string fileUrl = UrlUtility.Combine(ctx.Web.ServerRelativeUrl, folderName + "/" + fileName);
                var file = ctx.Web.GetFileByServerRelativeUrl(UrlUtility.Combine(ctx.Web.ServerRelativeUrl, folderName + "/" + fileName));
                ctx.Load(file, f => f.Exists, f => f.Length);
                ctx.ExecuteQuery();

                if (file.Exists)
                {
                    tcount++;

                    #region File - Security
                    if (sf.Security != null)
                    {
                        ctx.Load(file, f => f.ListItemAllFields);
                        ctx.ExecuteQuery();
                        bool isSecurityMatch = ValidateSecurityCSOM(ctx, sf.Security, file.ListItemAllFields);
                        if (!isSecurityMatch)
                        {
                            return false;
                        }

                    }
                    #endregion

                    #region Overwrite validation
                    if (sf.Overwrite == false)
                    {
                        // lookup the original added file size...should be different from the one we retrieved from SharePoint since we opted to NOT overwrite
                        var files = System.IO.Directory.GetFiles(@".\framework\functional\templates");
                        foreach (var f in files)
                        {
                            if (f.Contains(sf.Src))
                            {
                                if (new System.IO.FileInfo(f).Length == file.Length)
                                {
                                    return false;
                                }
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    return false;
                }
            }

            return true;
        }
示例#9
0
        public override void Load(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
            soundEffectList.Add("dance", contentManager.Load<SoundEffect>(@"Audio\Effects\tingle_dance"));
            soundEffectList.Add("hoi", contentManager.Load<SoundEffect>(@"Audio\Effects\tingle_hoi"));
            soundEffectList.Add("laugh", contentManager.Load<SoundEffect>(@"Audio\Effects\tingle_laugh"));
            soundEffectList.Add("magic", contentManager.Load<SoundEffect>(@"Audio\Effects\tingle_magic"));

            base.Load(contentManager);
        }
示例#10
0
        public static void LoadContent(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            playlist.Add("Amazing Plan", Content.Load<Song>("Music\\AmazingPlan"));
            playlist.Add("Fig Leaf Rag", Content.Load<Song>("Music\\FigLeafRag"));
            playlist.Add("Dark Hallway", Content.Load<Song>("Music\\DarkHallway"));
            playlist.Add("Clay", Content.Load<Song>("Music\\madeofclay"));


        }
示例#11
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager contentLoader, Manifracture.ComponentManifest manifest)
        {
            IrradianceMap = contentLoader.Load<Texture2D>((string)(manifest.Properties[ManifestKeys.IRRADIANCEMAP]));
            SpecPrefilter = contentLoader.Load<Texture2D>((string)(manifest.Properties[ManifestKeys.SPECPREFILTER]));
            NumSpecLevels = (int)(manifest.Properties[ManifestKeys.NUMSPECLEVELS]);
            SpecExponentFactor = (float)(manifest.Properties[ManifestKeys.SPECEXPONENTFACTOR]);
            AmbientLight = (Vector3)(manifest.Properties[ManifestKeys.AMBIENTLIGHT]);

            Owner.ActorInitialized += ActorInitializedHandler;
        }
示例#12
0
文件: IMGui.cs 项目: BaltaX/MegaJump
 public IMGui(Microsoft.Xna.Framework.Content.ContentManager a_content, GraphicsDevice a_graphicsDevice, MegaJump.Model.MainModel a_mainmodel)
 {
     // TODO: Complete member initialization
     m_content = a_content;
     m_spriteBatch = new SpriteBatch(a_graphicsDevice);
     m_spriteFont = a_content.Load<SpriteFont>("Courier New");
     m_menuFont = a_content.Load<SpriteFont>("MenuButtons");
     m_texture = a_content.Load<Texture2D>("button");
     m_backGround = a_content.Load<Texture2D>("MenuBackground");
     m_mainModel = a_mainmodel;
 }
示例#13
0
 public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager Content)
 {
     bakcground.LoadContent(Content);
     objectManager.LoadContent(Content);
     objectManager.AddObject(player);
     this.texture2 = Content.Load<Texture2D>("sprites/Pause");
     this.sound = Content.Load<Song>("sounds/space");
     base.LoadContent(Content);
     MediaPlayer.Play(this.sound);
     MediaPlayer.Volume = 2f;
     MediaPlayer.IsRepeating = true;
 }
示例#14
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            glove = new Image_MenuItem(new Vector2(clientBounds.X + clientBounds.Width / 4, clientBounds.Y + 3 * clientBounds.Height / 4),
                content.Load<Texture2D>("Menu/Punch_Glove"), 200, 200);

            butlerHand = new Image_MenuItem(new Vector2(clientBounds.X + clientBounds.Width / 4, clientBounds.Y + 3 * clientBounds.Height / 4),
                content.Load<Texture2D>("Menu/ButlerHand_Idle"), 200, 200);

            items.Add(glove);
            items.Add(butlerHand);

            base.LoadContent(content);
        }
示例#15
0
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager Content, Microsoft.Xna.Framework.Graphics.SpriteBatch sprBatch)
        {
            m_sprBatch = sprBatch;

            Background = Content.Load<Texture2D>("GameState/Graphics/Credits/creditScreen");
            Cursor = Content.Load<Texture2D>("FallDown/Textures/cursor");
            Arrow = Content.Load<Texture2D>("FallDown/Textures/arrow");
            ListFont = Content.Load<SpriteFont>("FallDown/Textures/ScoreFont");

            ArrowPosition = new Vector2(0, 480 - 50);

            base.LoadContent(Content, sprBatch);
        }
示例#16
0
        public Inventory(Microsoft.Xna.Framework.Content.ContentManager Content, CircuitBoard Home)
        {
            allSlots = new List<HolderSlot>();
            Texture2D texture = Content.Load<Texture2D>("SlotBG");
            this.IsVisible = false;
            myTexture = Content.Load<Texture2D>("Toolbox");

            allSlots.Add(new HolderSlot(texture, ANDLoc, "AND", typeof(ANDGate), Home));
            allSlots.Add(new HolderSlot(texture, INVLoc, "INV", typeof(INVGate), Home));
            allSlots.Add(new HolderSlot(texture, ORLoc, "OR", typeof(ORGate), Home));
            allSlots.Add(new HolderSlot(texture, XORLoc, "XOR", typeof(XORGate), Home));
            allSlots.Add(new HolderSlot(texture, MUXLoc, "MUX", typeof(MUXGate), Home));
        }
示例#17
0
        public static void Load_Textures(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            //Textures for Main menue
            mainmenu_background = content.Load<Texture2D>("Graphics/background");
            button = content.Load<Texture2D>("Graphics/button_green");

            //Textures for in Game Header
            games_pause = content.Load<Texture2D>("Graphics/pause");
            game_normal = content.Load<Texture2D>("Graphics/normal");
            game_fast = content.Load<Texture2D>("Graphics/fast");
            game_faster = content.Load<Texture2D>("Graphics/faster");
            game_header = content.Load<Texture2D>("Graphics/header");

            //Textures for in game side Tabs
            gameTab_airport =  content.Load<Texture2D>("Graphics/airport");
            gameDesign_airport = content.Load<Texture2D>("Graphics/airporttabback");
            gameHighlight_airport = content.Load<Texture2D>("Graphics/airporttabhover");
            gameTab_route = content.Load<Texture2D>("Graphics/routes");
            gameDesign_route = content.Load<Texture2D>("Graphics/routesback");
            gameHighlight_route = content.Load<Texture2D>("Graphics/routeshover");
            gameTab_flight =  content.Load<Texture2D>("Graphics/flight");
            gameDesign_flight = content.Load<Texture2D>("Graphics/flighttabback");

            //Textures for Menues
            message_background = content.Load<Texture2D>("Graphics/Message");
            newRoute_background = content.Load<Texture2D>("Graphics/New_route");
            Airport_background = content.Load<Texture2D>("Graphics/AirportWindow");
            Window_Tab_open = content.Load<Texture2D>("Graphics/Tab_departure_highlight"); 
            Window_Tab_closed = content.Load<Texture2D>("Graphics/Tab_departure"); 


            //Textures for UI
            checkbox_unchecked = content.Load<Texture2D>("Graphics/unchecked");
            checkbox_checked = content.Load<Texture2D>("Graphics/checked");
            listbox = content.Load<Texture2D>("Graphics/textbox_list");
            textbox = content.Load<Texture2D>("Graphics/textbox_background");
            textbox_selected = content.Load<Texture2D>("Graphics/textbox_hover");
            button_Cancel = content.Load<Texture2D>("Graphics/Cancel");
            button_Create = content.Load<Texture2D>("Graphics/Create");

            //Textures for General Map use
            line_black = content.Load<Texture2D>("Graphics/line");
            airport_normal = content.Load<Texture2D>("Graphics/circle");
        
            //Fonts
            font_normal = content.Load<SpriteFont>("Main");
            font_small = content.Load<SpriteFont>("List");

            //Airplane
            B747 = content.Load<Texture2D>("Graphics/Airplane1");
        }
示例#18
0
        public void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            if (_dEffect == null)
                _dEffect = content.Load<Effect>("Content/Effects/Series4Effects");

            _texture1 = content.Load<Texture2D>("Content/Textures/Ground/sand");
            _texture2 = content.Load<Texture2D>("Content/Textures/Ground/grass");
            _texture3 = content.Load<Texture2D>("Content/Textures/Ground/rock");
            _texture4 = content.Load<Texture2D>("Content/Textures/Ground/snow");

            _skyDome = content.Load<Model>("Content/Models/dome");
            _skyDome.Meshes[0].MeshParts[0].Effect = _dEffect.Clone();

            _cloudMap = content.Load<Texture2D>("Content/Models/cloudMap");

            //PresentationParameters pp = _dDevice.PresentationParameters;
            //refractionRenderTarget = new RenderTarget2D(_dDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, pp.BackBufferFormat, pp.DepthStencilFormat);
            //reflectionRenderTarget = new RenderTarget2D(_dDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, pp.BackBufferFormat, pp.DepthStencilFormat);

            SetUpWaterVertices();

            waterBumpMap = content.Load<Texture2D>("Content/Textures/Ground/water");

            VertexPositionTexture[] fullScreenVertices = SetUpFullscreenVertices();
            //fullScreenVertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);

            VertexDeclaration vertexDeclaration = new VertexDeclaration(VertexMultitextured.VertexElements);
            fullScreenBuffer = new VertexBuffer(_dDevice, vertexDeclaration, fullScreenVertices.Length, BufferUsage.WriteOnly);
            fullScreenBuffer.SetData(fullScreenVertices);

            fullScreenVertexDeclaration = new VertexDeclaration(VertexPositionTexture.VertexDeclaration.GetVertexElements());
        }
示例#19
0
        public void Draw(Microsoft.Xna.Framework.Content.ContentManager content, Microsoft.Xna.Framework.Graphics.SpriteBatch batch)
        {
            if (font == null)
            {
                //Load the font
                font = content.Load<SpriteFont>(@"Fonts/LightText");
            }

            batch.Draw(content, SpriteManager.GetSprite(ColourSpriteName.WHITE), borderRect, Color.DarkGray);
            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.PAPER_TEXTURE), rect, Color.White);

            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.WOOD_TEXTURE), objectNameRect, Color.WhiteSmoke);
            batch.DrawString(font, treasureChest.Name, objectNameRect, Alignment.Center, Color.Black);

            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.CLOSE), crossRect, Color.White);

            for (int i = 0; i < itemRectangles.Count; i++)
            {
                Rectangle r = itemRectangles[i];

                MapItem mi = null;

                if (treasureChest.Contents.Count > i)
                {
                    mi = treasureChest.Contents[i];
                    batch.Draw(content, mi.Graphics[0], r, Color.White);
                }

            }

            batch.DrawString(font, descriptionShown, descriptionRect, Alignment.Left, Color.Black);
            batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.WOOD_TEXTURE), takeAllRect, Color.White);
            batch.DrawString(font, "TAKE ALL", takeAllRect, Alignment.Center, Color.Black);
        }
示例#20
0
        public void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content)
        {
            if (_dEffect == null)
                _dEffect = content.Load<Effect>("Content/Effects/ShaderFog");

            _texture = TextureManager.Instance[_textureName];
        }
示例#21
0
 public void Initialize(
     Microsoft.Xna.Framework.Graphics.GraphicsDevice device,
     Microsoft.Xna.Framework.Content.ContentManager Content)
 {
     batch = new SpriteBatch(device);
     texture = Content.Load<Texture2D>("7-segment");
 }
示例#22
0
        public Web CreateSubSite(Microsoft.SharePoint.Client.ClientContext ctx, Web hostWeb, string txtUrl,
                                 string template, string title, string description)
        {
            // Create web creation configuration
            WebCreationInformation information = new WebCreationInformation();
            information.WebTemplate = template;
            information.Description = description;
            information.Title = title;
            information.Url = txtUrl;
            // Currently all english, could be extended to be configurable based on language pack usage
            information.Language = 1033;

            Microsoft.SharePoint.Client.Web newWeb = null;
            newWeb = hostWeb.Webs.Add(information);
            ctx.ExecuteQuery();

            ctx.Load(newWeb);
            ctx.ExecuteQuery();

            // Add sub site link override
            new LabHelper().AddJsLink(ctx, newWeb, this.Request);

            // Set oob theme to the just created site
            new LabHelper().SetThemeBasedOnName(ctx, newWeb, hostWeb, "Orange");

            // All done, let's return the newly created site
            return newWeb;
        }
示例#23
0
 public override void LoadContent( Microsoft.Xna.Framework.Content.ContentManager Content, int screenWidth, int screenHeight )
 {
     Texture = Content.Load<Texture2D>( "Sprites\\Boom" );
     Origin = new Vector2( 32, 32 );
     if ( LoadScale ) Scale = ( float )Game.Settings[ "BlastRadius" ].Item2;
     base.LoadContent( Content, screenWidth, screenHeight );
 }
示例#24
0
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content, GraphicsDevice graphics)
        {
            texture = new Texture2D[2];
            texture[0] = content.Load<Texture2D>(@"textures\controls\checkbox\checked");
            texture[1] = content.Load<Texture2D>(@"textures\controls\checkbox\unchecked");

            Width = (int)(texture[0].Width + Font.MeasureString(Text).X + 15);
            Height = (int)(System.Math.Max(texture[0].Height, Font.LineSpacing));

            area = new Rectangle(0, 0, (int)Size.X, (int)Size.Y);

            textOffset.X = texture[0].Width + 5f;
            textOffset.Y = System.Math.Abs(texture[0].Height - Font.LineSpacing) - 1;

            base.Initialize(content, graphics);
        }
示例#25
0
 public static void Initialize(GraphicsDevice gd, Microsoft.Xna.Framework.Content.ContentManager content)
 {
     DirtCloud = new AnimatedSprite(content.Load<Texture2D>("Art/Z3 Art/Dirt Particle"));
     DirtCloud.DrawArgs.Scale = new Vector2(Scale * 0.25f);
     DirtCloud.SetOriginToCenter();
     DirtCloud.StartAnimation();
 }
示例#26
0
 public override void Init(Microsoft.Xna.Framework.Content.ContentManager content)
 {
     base.Init(content);
     float extra = 30f;
     this.collider = new RectangleCollider(new Vector2(-extra, -extra), new Vector2(64+extra+extra, 64+extra+extra));
     this.texture = new AnimatedTexture2D(content.Load<Texture2D>("Traps/gasvent"), 64, animationSub.def);
 }
示例#27
0
 public override bool Load(string assetName, Microsoft.Xna.Framework.Content.ContentManager content, FarseerGames.FarseerPhysics.PhysicsSimulator simulator)
 {
     quarkAnimation = new Animation(content.Load<Texture2D>("Sprites\\quark"), 0.1f, true); //quarkAnimation has 0.1 units between frames, and is looping
     currentTexture = content.Load<Texture2D>(assetName);
     origin = new Vector2(currentTexture.Width / 2, currentTexture.Height / 2);
     body = BodyFactory.Instance.CreateRectangleBody(currentTexture.Width, currentTexture.Height, 1);
     geom = GeomFactory.Instance.CreateRectangleGeom(body, currentTexture.Width / 9, currentTexture.Height);
     body.Position = position;
     body.Tag = this;
     geom.Tag = this;
     simulator.Add(body);
     simulator.Add(geom);
     this.geom.CollisionEnabled = false; // this object should not collide with other objects
     animationPlayer.PlayAnimation(quarkAnimation);//plays the quark animation
     return true;
 }
        public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager contentLoader, ComponentManifest manifest)
        {
            SkyTexture = contentLoader.Load<TextureCube>((string)(manifest.Properties[ManifestKeys.TEXTURE]));
            OnEnvironmentMapAdded(EventArgs.Empty);

            base.Initialize(contentLoader, manifest);
        }
示例#29
0
        public Animation teleAnimation; //this holds the teleport animation

        #endregion Fields

        #region Methods

        public override bool Load(string assetName, Microsoft.Xna.Framework.Content.ContentManager content, FarseerGames.FarseerPhysics.PhysicsSimulator simulator)
        {
            teleAnimation = new Animation(content.Load<Texture2D>("portalv2"), 0.1f, true); //creates the animation. 0.1f is the time between frames and true means is looping

            currentTexture = content.Load<Texture2D>(assetName);
            origin = new Vector2((currentTexture.Height / 4) / 2, currentTexture.Height / 2);
            body = BodyFactory.Instance.CreateRectangleBody((currentTexture.Height / 4), currentTexture.Height, 1);
            geom = GeomFactory.Instance.CreateRectangleGeom(body, (currentTexture.Height / 4), currentTexture.Height);
            body.Position = position;
            body.Tag = this;
            geom.Tag = this;
            simulator.Add(body);
            simulator.Add(geom);
            animationPlayer.PlayAnimation(teleAnimation);//plays the teleport animation
            return true;
        }
示例#30
0
        public Animation pickupAnimation; // the animation for the pickup

        #endregion Fields

        #region Methods

        public override bool Load(string assetName, Microsoft.Xna.Framework.Content.ContentManager content, FarseerGames.FarseerPhysics.PhysicsSimulator simulator)
        {
            currentTexture = content.Load<Texture2D>(assetName);
            pickupAnimation = new Animation(content.Load<Texture2D>("pickup"), 0.1f, true);
            origin = new Vector2((currentTexture.Width / 8) / 2, currentTexture.Height / 2);
            body = BodyFactory.Instance.CreateRectangleBody((currentTexture.Width / 8), currentTexture.Height, 1);
            geom = GeomFactory.Instance.CreateRectangleGeom(body, (currentTexture.Width / 8), currentTexture.Height);
            body.Position = position;
            body.Tag = this;
            geom.Tag = this;
            simulator.Add(body);
            simulator.Add(geom);
            animationPlayer.PlayAnimation(pickupAnimation);
            isAlive = true; //if boolean is true, it has no been picked up
            return true;
        }