Exemple #1
0
        void PlayerRestore(Player player)
        {
            if (player == null) throw new ArgumentNullException("player");

            player.Life = player.Constants.MaximumLife;
            player.Power = player.Constants.MaximumPower;
        }
Exemple #2
0
		public void CreatePlayers(PlayerCreation p1, PlayerCreation p2)
		{
			if (p1 == null) throw new ArgumentNullException("p1");

			Clear();

			m_p1 = new Player(Engine, p1.Profile, this);
			m_p1.PaletteNumber = p1.PaletteIndex;

			if (p2 != null)
			{
				m_p2 = new Player(Engine, p2.Profile, this);
				m_p2.PaletteNumber = p2.PaletteIndex;
			}

			ResetPlayers();
		}
Exemple #3
0
        void PrintName(Player player)
        {
            if (player == null) throw new ArgumentNullException("player");

            if (m_namelement.DataMap.Type == ElementType.Text)
            {
                m_team.Engine.Print(m_namelement.DataMap.FontData, m_nameposition, player.Profile.DisplayName, null);
            }
        }
Exemple #4
0
        void DrawFace(Player player)
        {
            if (player == null) throw new ArgumentNullException("player");

            if (m_facebg.DataMap.Type == ElementType.Static || m_facebg.DataMap.Type == ElementType.Animation)
            {
                m_facebg.Draw(m_faceposition);
            }

            if (m_faceimage != null && m_faceimage.DataMap.Type == ElementType.Static)
            {
                var drawstate = player.SpriteManager.SetupDrawing(m_faceimage.DataMap.SpriteId, m_faceposition + m_faceimage.DataMap.Offset, Vector2.Zero, m_faceimage.DataMap.Scale, m_faceimage.DataMap.Flip);

                player.PaletteFx.SetShader(drawstate.ShaderParameters);

                drawstate.Use();
            }
        }
Exemple #5
0
        void DrawPowerbar(Player player)
        {
            if (player == null) throw new ArgumentNullException("player");

            if (m_powerbg0.DataMap.Type == ElementType.Static || m_powerbg0.DataMap.Type == ElementType.Animation)
            {
                m_powerbg0.Draw(m_powerbarposition);
            }

            if (m_powerbg1.DataMap.Type == ElementType.Static || m_powerbg1.DataMap.Type == ElementType.Animation)
            {
                m_powerbg1.Draw(m_powerbarposition);
            }

            if (m_powermid.DataMap.Type == ElementType.Static || m_powermid.DataMap.Type == ElementType.Animation)
            {
                //m_powermid.Draw(m_powerbarposition);
            }

            if (m_powerfront != null && m_powerfront.DataMap.Type == ElementType.Static)
            {
                Single power_percentage = Math.Max(0.0f, (Single)player.Power / (Single)player.Constants.MaximumPower);

                var drawstate = m_powerfront.SpriteManager.SetupDrawing(m_powerfront.DataMap.SpriteId, m_powerbarposition, Vector2.Zero, m_powerfront.DataMap.Scale, m_powerfront.DataMap.Flip);
                drawstate.ScissorRectangle = CreateBarScissorRectangle(m_powerfront, m_powerbarposition, power_percentage, m_powerbarrange);
                drawstate.Use();
            }

			if (m_powercounter.DataMap.Type == ElementType.Text)
			{
				String powertext = (player.Power / 1000).ToString();
				m_team.Engine.Print(m_powercounter.DataMap.FontData, m_powerbarposition + m_powercounter.DataMap.Offset, powertext, null);
			}
        }
Exemple #6
0
        void DrawLifebar(Player player)
        {
            if (player == null) throw new ArgumentNullException("player");

            if (m_lifebg0.DataMap.Type == ElementType.Static || m_lifebg0.DataMap.Type == ElementType.Animation)
            {
                m_lifebg0.Draw(m_lifebarposition);
            }

            if (m_lifebg1.DataMap.Type == ElementType.Static || m_lifebg1.DataMap.Type == ElementType.Animation)
            {
                m_lifebg1.Draw(m_lifebarposition);
            }

            if (m_lifemid.DataMap.Type == ElementType.Static)
            {
                //m_lifemid.Draw(m_lifebarposition);
            }

            if (m_lifefront.DataMap.Type == ElementType.Static)
            {
                Single life_percentage = Math.Max(0.0f, (Single)player.Life / (Single)player.Constants.MaximumLife);

                var drawstate = m_lifefront.SpriteManager.SetupDrawing(m_lifefront.DataMap.SpriteId, m_lifebarposition, Vector2.Zero, m_lifefront.DataMap.Scale, m_lifefront.DataMap.Flip);
                drawstate.ScissorRectangle = CreateBarScissorRectangle(m_lifefront, m_lifebarposition, life_percentage, m_lifebarrange);
                drawstate.Use();
            }
        }
		public PlayerConstants(Player player, TextFile textfile)
		{
			if (player == null) throw new ArgumentNullException("player");
			if (textfile == null) throw new ArgumentNullException("textfile");

			TextSection datasection = textfile.GetSection("Data");
			TextSection sizesection = textfile.GetSection("Size");
			TextSection velocitysection = textfile.GetSection("Velocity");
			TextSection movementsection = textfile.GetSection("Movement");

			StringConverter converter = player.Engine.GetSubSystem<StringConverter>();

			if (datasection == null) throw new ArgumentException("Constants file '" + textfile.Filepath + "' does not have a 'Data' section");
			if (sizesection == null) throw new ArgumentException("Constants file '" + textfile.Filepath + "' does not have a 'Size' section");
			if (velocitysection == null) throw new ArgumentException("Constants file '" + textfile.Filepath + "' does not have a 'Velocity' section");
			if (movementsection == null) throw new ArgumentException("Constants file '" + textfile.Filepath + "' does not have a 'Movement' section");

			m_scale = new Vector2(1, 1);

			m_life = datasection.GetAttribute<Int32>("life", 1000);
			m_maxpower = datasection.GetAttribute<Int32>("power", 3000);
			m_attackpower = datasection.GetAttribute<Int32>("attack", 100);
			m_defensivepower = datasection.GetAttribute<Int32>("defence", 100);
			m_falldefenseincrease = datasection.GetAttribute<Int32>("fall.defence_up", 50);
			m_liedowntime = datasection.GetAttribute<Int32>("liedown.time", 60);
			m_airjuggle = datasection.GetAttribute<Int32>("airjuggle", 15);
			m_defaultspark = datasection.GetAttribute<Evaluation.PrefixedExpression>("sparkno", null);
			m_defaultguardspark = datasection.GetAttribute<Evaluation.PrefixedExpression>("guard.sparkno", null);
			m_KOecho = datasection.GetAttribute<Boolean>("KO.echo", false);
			m_volumeoffset = datasection.GetAttribute<Int32>("volume", 0);
			m_persistanceintindex = datasection.GetAttribute<Int32>("IntPersistIndex", 60);
			m_persistancefloatindex = datasection.GetAttribute<Int32>("FloatPersistIndex", 40);

			m_scale.X = sizesection.GetAttribute<Single>("xscale", 1.0f);
			m_scale.Y = sizesection.GetAttribute<Single>("yscale", 1.0f);
			m_groundback = sizesection.GetAttribute<Int32>("ground.back", 15);
			m_groundfront = sizesection.GetAttribute<Int32>("ground.front", 16);
			m_airback = sizesection.GetAttribute<Int32>("air.back", 12);
			m_airfront = sizesection.GetAttribute<Int32>("air.front", 12);
			m_height = sizesection.GetAttribute<Int32>("height", 60);
			m_attackdistance = sizesection.GetAttribute<Int32>("attack.dist", 160);
			m_projectileattackdist = sizesection.GetAttribute<Int32>("proj.attack.dist", 90);
			m_projectilescaling = sizesection.GetAttribute<Boolean>("proj.doscale", false);
			m_headposition = sizesection.GetAttribute<Vector2>("head.pos", Vector2.Zero);
			m_midposition = sizesection.GetAttribute<Vector2>("mid.pos", Vector2.Zero);
			m_shadowoffset = sizesection.GetAttribute<Int32>("shadowoffset", 0);
			m_drawoffset = sizesection.GetAttribute<Point>("draw.offset", new Point(0, 0));

			m_walk_forward = velocitysection.GetAttribute<Single>("walk.fwd");
			m_walk_back = velocitysection.GetAttribute<Single>("walk.back");
			m_run_fwd = velocitysection.GetAttribute<Vector2>("run.fwd");
			m_run_back = velocitysection.GetAttribute<Vector2>("run.back");

			m_jump_neutral = velocitysection.GetAttribute<Vector2>("jump.neu");

			m_jump_back = velocitysection.GetAttribute<Vector2>("jump.back");
			if (m_jump_back.Y == 0) m_jump_back.Y = m_jump_neutral.Y;

			m_jump_forward = velocitysection.GetAttribute<Vector2>("jump.fwd");
			if (m_jump_forward.Y == 0) m_jump_forward.Y = m_jump_neutral.Y;

			m_runjump_back = velocitysection.GetAttribute<Vector2>("runjump.back", m_run_back);
			m_runjump_fwd = velocitysection.GetAttribute<Vector2>("runjump.fwd", m_run_fwd);
			m_airjump_neutral = velocitysection.GetAttribute<Vector2>("airjump.neu", Jump_neutral);

			m_airjump_back = velocitysection.GetAttribute<Vector2>("airjump.back", Jump_back);
			if (m_airjump_back.Y == 0) m_airjump_back.Y = m_airjump_neutral.Y;

			m_airjump_forward = velocitysection.GetAttribute<Vector2>("airjump.fwd", Jump_forward);
			if (m_airjump_forward.Y == 0) m_airjump_forward.Y = m_airjump_neutral.Y;

			m_airjumps = movementsection.GetAttribute<Int32>("airjump.num", 0);
			m_airjumpheight = movementsection.GetAttribute<Int32>("airjump.height", 0);
			m_vert_acceleration = movementsection.GetAttribute<Single>("yaccel");
			m_standfriction = movementsection.GetAttribute<Single>("stand.friction");
			m_crouchfriction = movementsection.GetAttribute<Single>("crouch.friction");

			m_airjump_forward.Y = m_airjump_neutral.Y;
			m_airjump_back.Y = m_airjump_neutral.Y;
		}