예제 #1
0
파일: SplashScreen.cs 프로젝트: lcraver/TM2
        public override void LoadContent(ContentManager Content, InputManager inputManager)
        {
            base.LoadContent(Content, inputManager);
            splashItems = new List<string>();
            splashImages = new List<Texture2D>();

            Animation = new List<Animation>();
            fAnimation = new FadeAnimation();
            fAnimation.DefaultAlpha = 0.001f;

            ssAnimation = new SpriteSheetAnimation();
            animationTypes = new List<string>();

            alpha = new List<float>();
            itemNumber = 0;
            position = Vector2.Zero;
            align = "Center";

            fileManager = new FileManager();
            fileManager.LoadContent("Load/Splash.txt");

            audio = new AudioManager();
            audio.LoadContent(content, "Splash");
            audio.PlaySong(0);
            audio.MusicVolume = 0.0f;
            audio.FadeSong(1.0f, new TimeSpan(0,0,1));

            for (int i = 0; i < fileManager.Attributes.Count; i++)
            {
                for (int j = 0; j < fileManager.Attributes[i].Count; j++)
                {
                    switch (fileManager.Attributes[i][j])
                    {
                        case "Font":
                            font = this.content.Load<SpriteFont>(fileManager.Contents[i][j]);
                            break;
                        case "Item":
                            splashItems.Add(fileManager.Contents[i][j]);
                            break;
                        case "Image":
                            splashImages.Add(content.Load<Texture2D>(fileManager.Contents[i][j]));
                            break;
                        case "Axis":
                            axis = int.Parse(fileManager.Contents[i][j]);
                            break;
                        case "Position":
                            string[] temp = fileManager.Contents[i][j].Split(' ');
                            position = new Vector2(float.Parse(temp[0]),
                                float.Parse(temp[1]));
                            break;
                        case "Animation":
                            animationTypes.Add(fileManager.Contents[i][j]);
                            break;
                        case "Alpha":
                            alpha.Add(float.Parse(fileManager.Contents[i][j]));
                            break;
                        case "FadeSpeed":
                            fadeSpeed = float.Parse(fileManager.Contents[i][j]);
                            break;
                        case "Align":
                            align = fileManager.Contents[i][j];
                            break;
                    }
                }
            }
            SetSplashItems();
            SetAnimations();
        }
예제 #2
0
        public void Initialize()
        {
            Animation = new Animation();
            ssAnimation = new SpriteSheetAnimation();
            fAnimation = new FadeAnimation();

            currentScreen = new SplashScreen();
            inputManager = new InputManager();
        }
예제 #3
0
파일: Entity.cs 프로젝트: lcraver/TM2
        public virtual void LoadContent(ContentManager content, List<string> attributes, List<string> contents, InputManager input)
        {
            this.content = new ContentManager(content.ServiceProvider, "Content");

            moveAnimation = new Animation();
            ssAnimation = new SpriteSheetAnimation();
            fAnimation = new FadeAnimation();
            images = new List<Texture2D>();
            healths = new List<int>();
            framesList = new List<Vector2>();
            moveSpeeds = new List<float>();

            for (int i = 0; i < attributes.Count; i++)
            {
                switch (attributes[i])
                {
                    case "Image":
                        Texture2D tempImage = this.content.Load<Texture2D>(contents[i]);
                        string[] name = contents[i].Split('/');
                        tempImage.Name = name[name.Count() - 1];
                        image = tempImage;
                        break;
                    case "Frames":
                        string[] framesTemp = contents[i].Split(',');
                        moveAnimation.Frames = new Vector2(int.Parse(framesTemp[0]), int.Parse(framesTemp[1]));
                        break;
                    case "Position":
                        string[] pos = contents[i].Split(',');
                        position = new Vector2(int.Parse(pos[0]) * Layer.Instance.TileDimensions.X, int.Parse(pos[1]) * Layer.Instance.TileDimensions.Y);
                        break;
                    case "Health":
                        health = int.Parse(contents[i]);
                        break;
                    case "MoveSpeed" :
                        moveSpeed = float.Parse(contents[i]);
                        break;
                    case "Range":
                        range = int.Parse(contents[i]);
                        break;
                }
            }

            gravity = 100f;
            velocity = Vector2.Zero;
            syncTilePosition = false;
            activateGravity = true;
            moveAnimation.LoadContent(content, image, "", position, Color.White);
        }