Beispiel #1
0
		public Projectile(FightEngine fightengine, Character creator, ProjectileData data)
			: base(fightengine)
		{
			if (creator == null) throw new ArgumentNullException("creator");
			if (data == null) throw new ArgumentNullException("data");

			m_creator = creator;
			m_offsetcharacter = (data.PositionType == PositionType.P2) ? creator.GetOpponent() : creator;
			m_data = data;
			m_animationmanager = Creator.AnimationManager.Clone();
			m_spritemanager = Creator.SpriteManager.Clone();
			m_gameticks = 0;
			m_hitcountdown = 0;
			m_state = ProjectileState.Normal;
			m_totalhits = 0;
			m_hitpausecountdown = 0;
			m_currentpriority = Data.Priority;
			m_palfx = new PaletteFx();

			CurrentPalette = Creator.CurrentPalette;
			CurrentFacing = Creator.CurrentFacing;
			CurrentLocation = GetStartLocation();
			CurrentVelocity = Data.InitialVelocity;
			CurrentAcceleration = Data.Acceleration;
			CurrentFlip = SpriteEffects.None;
			CurrentScale = Data.Scale;
			DrawOrder = Data.SpritePriority;

			SetLocalAnimation(Data.AnimationNumber, 0);
		}
Beispiel #2
0
		public Player(FightEngine engine, PlayerProfile profile, Team team)
			: base(engine)
		{
			if (profile == null) throw new ArgumentNullException("profile");
			if (team == null) throw new ArgumentNullException("team");

			m_profile = profile;
			m_spritemanager = Engine.GetSubSystem<Drawing.SpriteSystem>().CreateManager(Profile.SpritePath);
			m_animationmanager = Engine.GetSubSystem<Animations.AnimationSystem>().CreateManager(Profile.AnimationPath);
			m_soundmanager = Engine.GetSubSystem<Audio.SoundSystem>().CreateManager(Profile.SoundPath);
			m_statemanager = Engine.GetSubSystem<StateMachine.StateSystem>().CreateManager(this, Profile.StateFiles);
			m_commandmanager = Engine.GetSubSystem<Commands.CommandSystem>().CreateManager(Profile.CommandPath);
			m_constants = new PlayerConstants(this, Engine.GetSubSystem<IO.FileSystem>().OpenTextFile(Profile.ConstantsPath));
			m_dimensions = new CharacterDimensions(Constants);
			m_palettes = BuildPalettes();
			m_palettenumber = 0;
			m_power = 0;
			m_palfx = new PaletteFx();
			m_team = team;
			m_helpers = new Dictionary<Int32, List<Helper>>();

			if (Engine.GetSubSystem<InitializationSettings>().PreloadCharacterSprites == true)
			{
				SpriteManager.LoadAllSprites();
			}

			SpriteManager.UseOverride = true;

			SetLocalAnimation(0, 0);

			CurrentScale = Constants.Scale;
			PushFlag = true;
		}
Beispiel #3
0
        public virtual void UpdateAnimations(Boolean updatepalfx)
        {
            AnimationManager.Update();

            if (updatepalfx == true)
            {
                PaletteFx.Update();
            }
        }
Beispiel #4
0
        public virtual void UpdateAnimations(bool updatepalfx)
        {
            AnimationManager.Update();

            if (updatepalfx)
            {
                PaletteFx.Update();
            }
        }
Beispiel #5
0
        public Player(FightEngine engine, PlayerProfile profile, PlayerMode mode, Team team)
            : base(engine)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }
            if (team == null)
            {
                throw new ArgumentNullException(nameof(team));
            }

            m_profile          = profile;
            m_spritemanager    = Engine.GetSubSystem <Drawing.SpriteSystem>().CreateManager(Profile.SpritePath);
            m_animationmanager = Engine.GetSubSystem <Animations.AnimationSystem>().CreateManager(Profile.AnimationPath);
            m_soundmanager     = Engine.GetSubSystem <Audio.SoundSystem>().CreateManager(Profile.SoundPath);
            m_statemanager     = Engine.GetSubSystem <StateMachine.StateSystem>().CreateManager(this, Profile.StateFiles);

            m_commandmanager = Engine.GetSubSystem <Commands.CommandSystem>().CreateManager(mode, Profile.CommandPath);
            m_constants      = new PlayerConstants(this, Engine.GetSubSystem <IO.FileSystem>().OpenTextFile(Profile.ConstantsPath));
            m_dimensions     = new CharacterDimensions(Constants);
            m_palettes       = BuildPalettes();
            m_palettenumber  = 0;
            m_power          = 0;
            m_palfx          = new PaletteFx();
            m_team           = team;
            m_helpers        = new Dictionary <int, List <Helper> >();

            if (Engine.GetSubSystem <InitializationSettings>().PreloadCharacterSprites)
            {
                SpriteManager.LoadAllSprites();
            }

            SpriteManager.UseOverride = true;

            SetLocalAnimation(0, 0);

            CurrentScale = Constants.Scale;
            PushFlag     = true;
        }
Beispiel #6
0
        public virtual void Draw()
        {
            AfterImages.Draw();

            var currentelement = AnimationManager.CurrentElement;

            if (currentelement == null)
            {
                return;
            }

            var sprite = SpriteManager.GetSprite(currentelement.SpriteId);

            if (sprite == null)
            {
                return;
            }

            var drawlocation = GetDrawLocation();
            var drawoffset   = Misc.GetOffset(Vector2.Zero, CurrentFacing, currentelement.Offset);

            SpriteManager.OverridePalette = CurrentPalette;

            var drawscale = CurrentScale;

            if (this is Character)
            {
                drawscale *= (this as Character).DrawScale;
            }

            var drawstate = SpriteManager.SetupDrawing(currentelement.SpriteId, drawlocation, drawoffset, drawscale, GetDrawFlip());

            drawstate.Blending = Transparency == new Blending() ? currentelement.Blending : Transparency;
            drawstate.Rotation = AngleDraw ? Misc.FaceScalar(CurrentFacing, -DrawingAngle) : 0;

            PaletteFx.SetShader(drawstate.ShaderParameters);

            drawstate.Use();
        }
Beispiel #7
0
        public Projectile(FightEngine fightengine, Character creator, ProjectileData data)
            : base(fightengine)
        {
            if (creator == null)
            {
                throw new ArgumentNullException("creator");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            m_creator           = creator;
            m_offsetcharacter   = (data.PositionType == PositionType.P2) ? creator.GetOpponent() : creator;
            m_data              = data;
            m_animationmanager  = Creator.AnimationManager.Clone();
            m_spritemanager     = Creator.SpriteManager.Clone();
            m_gameticks         = 0;
            m_hitcountdown      = 0;
            m_state             = ProjectileState.Normal;
            m_totalhits         = 0;
            m_hitpausecountdown = 0;
            m_currentpriority   = Data.Priority;
            m_palfx             = new PaletteFx();

            CurrentPalette      = Creator.CurrentPalette;
            CurrentFacing       = Creator.CurrentFacing;
            CurrentLocation     = GetStartLocation();
            CurrentVelocity     = Data.InitialVelocity;
            CurrentAcceleration = Data.Acceleration;
            CurrentFlip         = SpriteEffects.None;
            CurrentScale        = Data.Scale;
            DrawOrder           = Data.SpritePriority;

            SetLocalAnimation(Data.AnimationNumber, 0);
        }
Beispiel #8
0
        public Stage(FightEngine engine, StageProfile profile)
            : base(engine)
        {
            if (profile == null)
            {
                throw new ArgumentNullException(nameof(profile));
            }

            m_profile             = profile;
            m_camerastartlocation = new Point(0, 0);
            m_p1start             = new Vector2(0, 0);
            m_p2start             = new Vector2(0, 0);
            m_palettefx           = new PaletteFx();

            var textfile          = Engine.GetSubSystem <FileSystem>().OpenTextFile(Profile.Filepath);
            var infosection       = textfile.GetSection("Info");
            var camerasection     = textfile.GetSection("Camera");
            var playerinfosection = textfile.GetSection("PlayerInfo");
            var boundsection      = textfile.GetSection("Bound");
            var stageinfosection  = textfile.GetSection("StageInfo");
            var shadowsection     = textfile.GetSection("Shadow");
            var reflectionsection = textfile.GetSection("Reflection");
            var musicsection      = textfile.GetSection("Music");
            var bgdefsection      = textfile.GetSection("BGDef");

            if (infosection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Info' section");
            }
            if (camerasection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Camera' section");
            }
            if (playerinfosection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'PlayerInfo' section");
            }
            if (boundsection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Bound' section");
            }
            if (stageinfosection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'StageInfo' section");
            }
            if (shadowsection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Shadow' section");
            }
            //if (reflectionsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Reflection' section");
            if (musicsection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Music' section");
            }
            if (bgdefsection == null)
            {
                throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'BGDef' section");
            }

            m_name = infosection.GetAttribute <string>("name");

            m_camerastartlocation.X = camerasection.GetAttribute <int>("startx");
            m_camerastartlocation.Y = camerasection.GetAttribute <int>("starty");
            m_camerabounds          = BuildBoundsRect(camerasection, "boundleft", "boundright", "boundhigh", "boundlow");
            m_floortension          = camerasection.GetAttribute("floortension", 0);
            m_tension        = camerasection.GetAttribute <int>("tension");
            m_verticalfollow = camerasection.GetAttribute <float>("verticalfollow");

            m_p1start.X    = playerinfosection.GetAttribute <float>("p1startx");
            m_p1start.Y    = playerinfosection.GetAttribute <float>("p1starty");
            m_p1facing     = playerinfosection.GetAttribute <Facing>("p1facing");
            m_p2start.X    = playerinfosection.GetAttribute <float>("p2startx");
            m_p2start.Y    = playerinfosection.GetAttribute <float>("p2starty");
            m_p2facing     = playerinfosection.GetAttribute <Facing>("p2facing");
            m_p3start.X    = playerinfosection.GetAttribute("p3startx", m_p1start.X);
            m_p3start.Y    = playerinfosection.GetAttribute("p3starty", m_p1start.Y);
            m_p3facing     = playerinfosection.GetAttribute("p3facing", m_p1facing);
            m_p4start.X    = playerinfosection.GetAttribute("p4startx", m_p2start.X);
            m_p4start.Y    = playerinfosection.GetAttribute("p4starty", m_p2start.Y);
            m_p4facing     = playerinfosection.GetAttribute("p4facing", m_p2facing);
            m_playerbounds = BuildBoundsRect(playerinfosection, "leftbound", "rightbound", "topbound", "botbound");

            m_screenleft  = boundsection.GetAttribute <int>("screenleft");
            m_screenright = boundsection.GetAttribute <int>("screenright");

            m_zoffset     = stageinfosection.GetAttribute <int>("zoffset");
            m_zoffsetlink = stageinfosection.GetAttribute <int?>("zoffsetlink", null);
            m_autoturn    = stageinfosection.GetAttribute <bool>("autoturn");
            m_resetbg     = stageinfosection.GetAttribute <bool>("resetBG");

            m_shadowintensity = stageinfosection.GetAttribute <byte>("intensity", 128);
            m_shadowcolor     = stageinfosection.GetAttribute("color", Color.TransparentBlack);
            m_shadowscale     = stageinfosection.GetAttribute("yscale", 0.4f);
            m_shadowfade      = stageinfosection.GetAttribute <Point?>("fade.range", null);

            if (reflectionsection != null)
            {
                m_shadowreflection = reflectionsection.GetAttribute("reflect", false);
            }
            else
            {
                m_shadowreflection = false;
            }

            m_musicfile    = musicsection.GetAttribute("bgmusic", string.Empty);
            m_volumeoffset = musicsection.GetAttribute("bgvolume", 0);

            m_spritefile = bgdefsection.GetAttribute <string>("spr");
            m_debug      = bgdefsection.GetAttribute("debugbg", false);

            if (Engine.GetSubSystem <FileSystem>().DoesFileExist(m_spritefile) == false)
            {
                m_spritefile = Engine.GetSubSystem <FileSystem>().CombinePaths("stages", m_spritefile);
            }

            var spritemanager    = Engine.GetSubSystem <Drawing.SpriteSystem>().CreateManager(SpritePath);
            var animationmanager = Engine.GetSubSystem <Animations.AnimationSystem>().CreateManager(Profile.Filepath);

            m_backgrounds = new Backgrounds.Collection(spritemanager, animationmanager);

            foreach (var textsection in textfile)
            {
                if (s_bgtitleregex.Match(textsection.Title).Success)
                {
                    m_backgrounds.CreateBackground(textsection);
                }
            }

            Reset();
        }
Beispiel #9
0
 public void Reset()
 {
     Backgrounds.Reset();
     PaletteFx.Reset();
 }
Beispiel #10
0
		public Stage(FightEngine engine, StageProfile profile)
			: base(engine)
		{
			if (profile == null) throw new ArgumentNullException("profile");

			m_profile = profile;
			m_camerastartlocation = new Point(0, 0);
			m_p1start = new Vector2(0, 0);
			m_p2start = new Vector2(0, 0);
			m_palettefx = new PaletteFx();

			TextFile textfile = Engine.GetSubSystem<IO.FileSystem>().OpenTextFile(Profile.Filepath);
			TextSection infosection = textfile.GetSection("Info");
			TextSection camerasection = textfile.GetSection("Camera");
			TextSection playerinfosection = textfile.GetSection("PlayerInfo");
			TextSection boundsection = textfile.GetSection("Bound");
			TextSection stageinfosection = textfile.GetSection("StageInfo");
			TextSection shadowsection = textfile.GetSection("Shadow");
			TextSection reflectionsection = textfile.GetSection("Reflection");
			TextSection musicsection = textfile.GetSection("Music");
			TextSection bgdefsection = textfile.GetSection("BGDef");

			if (infosection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Info' section");
			if (camerasection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Camera' section");
			if (playerinfosection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'PlayerInfo' section");
			if (boundsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Bound' section");
			if (stageinfosection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'StageInfo' section");
			if (shadowsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Shadow' section");
			//if (reflectionsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Reflection' section");
			if (musicsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'Music' section");
			if (bgdefsection == null) throw new InvalidOperationException("Stage textfile '" + Profile.Filepath + "' is missing 'BGDef' section");

			m_name = infosection.GetAttribute<String>("name");

			m_camerastartlocation.X = camerasection.GetAttribute<Int32>("startx");
			m_camerastartlocation.Y = camerasection.GetAttribute<Int32>("starty");
			m_camerabounds = BuildBoundsRect(camerasection, "boundleft", "boundright", "boundhigh", "boundlow");
			m_floortension = camerasection.GetAttribute<Int32>("floortension", 0);
			m_tension = camerasection.GetAttribute<Int32>("tension");
			m_verticalfollow = camerasection.GetAttribute<Single>("verticalfollow");

			m_p1start.X = playerinfosection.GetAttribute<Single>("p1startx");
			m_p1start.Y = playerinfosection.GetAttribute<Single>("p1starty");
			m_p1facing = playerinfosection.GetAttribute<Facing>("p1facing");
			m_p2start.X = playerinfosection.GetAttribute<Single>("p2startx");
			m_p2start.Y = playerinfosection.GetAttribute<Single>("p2starty");
			m_p2facing = playerinfosection.GetAttribute<Facing>("p2facing");
			m_playerbounds = BuildBoundsRect(playerinfosection, "leftbound", "rightbound", "topbound", "botbound");

			m_screenleft = boundsection.GetAttribute<Int32>("screenleft");
			m_screenright = boundsection.GetAttribute<Int32>("screenright");

			m_zoffset = stageinfosection.GetAttribute<Int32>("zoffset");
			m_zoffsetlink = stageinfosection.GetAttribute<Int32?>("zoffsetlink", null);
			m_autoturn = stageinfosection.GetAttribute<Boolean>("autoturn");
			m_resetbg = stageinfosection.GetAttribute<Boolean>("resetBG");

			m_shadowintensity = stageinfosection.GetAttribute<Byte>("intensity", 128);
			m_shadowcolor = stageinfosection.GetAttribute<Color>("color", Color.TransparentBlack);
			m_shadowscale = stageinfosection.GetAttribute<Single>("yscale", 0.4f);
			m_shadowfade = stageinfosection.GetAttribute<Point?>("fade.range", null);

			if (reflectionsection != null)
			{
				m_shadowreflection = reflectionsection.GetAttribute<Boolean>("reflect", false);
			}
			else
			{
				m_shadowreflection = false;
			}

			m_musicfile = musicsection.GetAttribute<String>("bgmusic", String.Empty);
			m_volumeoffset = musicsection.GetAttribute<Int32>("bgvolume", 0);

			m_spritefile = bgdefsection.GetAttribute<String>("spr");
			m_debug = bgdefsection.GetAttribute<Boolean>("debugbg", false);

			if (Engine.GetSubSystem<IO.FileSystem>().DoesFileExist(m_spritefile) == false)
			{
				m_spritefile = Engine.GetSubSystem<IO.FileSystem>().CombinePaths("stages", m_spritefile);
			}

			Drawing.SpriteManager spritemanager = Engine.GetSubSystem<Drawing.SpriteSystem>().CreateManager(SpritePath);
			Animations.AnimationManager animationmanager = Engine.GetSubSystem<Animations.AnimationSystem>().CreateManager(Profile.Filepath);
			m_backgrounds = new Backgrounds.Collection(spritemanager, animationmanager);

			foreach (TextSection textsection in textfile)
			{
				if (s_bgtitleregex.Match(textsection.Title).Success == true)
				{
					m_backgrounds.CreateBackground(textsection);
				}
			}

			Reset();
		}