示例#1
0
        public EngineInitialization(CombatMode mode, PlayerProfile p1, Int32 p1palette, PlayerProfile p2, Int32 p2palette, StageProfile stage, Int32 seed)
        {
            if (mode == CombatMode.None)
            {
                throw new ArgumentOutOfRangeException("mode");
            }
            if (p1 == null)
            {
                throw new ArgumentNullException("p1");
            }
            if (p1palette < 0 || p1palette > 11)
            {
                throw new ArgumentOutOfRangeException("p1palette");
            }
            if (p2 == null)
            {
                throw new ArgumentNullException("p2");
            }
            if (p2palette < 0 || p2palette > 11)
            {
                throw new ArgumentOutOfRangeException("p2palette");
            }
            if (stage == null)
            {
                throw new ArgumentNullException("stage");
            }

            m_mode  = mode;
            m_p1    = new PlayerCreation(p1, p1.GetValidPaletteIndex(p1palette));
            m_p2    = new PlayerCreation(p2, p2.GetValidPaletteIndex(p2palette));
            m_stage = stage;
            m_seed  = seed;
        }
示例#2
0
        void CheckReady()
        {
            if (m_isdone == true)
            {
                return;
            }
            if (m_stageselected == false || m_p1info.IsSelected == false || m_p2info.IsSelected == false)
            {
                return;
            }

            m_isdone = true;

            if (m_currentstage == -1)
            {
                m_currentstage = MenuSystem.GetSubSystem <Random>().NewInt(0, StageProfiles.Count - 1);
            }

            Int32 p1index = (m_p1info.CurrentCell.Y * m_gridsize.X) + m_p1info.CurrentCell.X;
            Int32 p2index = (m_p2info.CurrentCell.Y * m_gridsize.X) + m_p2info.CurrentCell.X;

            PlayerSelect p1    = PlayerProfiles[p1index];
            PlayerSelect p2    = PlayerProfiles[p2index];
            StageProfile stage = StageProfiles[m_currentstage];

            Combat.EngineInitialization init = new Combat.EngineInitialization(CombatMode.Versus, p1.Profile, m_p1info.PaletteIndex, p2.Profile, m_p2info.PaletteIndex, stage);

            MenuSystem.PostEvent(new Events.SetupCombat(init));
            MenuSystem.PostEvent(new Events.SwitchScreen(ScreenType.Versus));
        }
示例#3
0
        void DrawStage()
        {
            if (m_stageselector == null)
            {
                return;
            }

            PrintData pd = (m_blinkval > 0) ? m_stagefont1 : m_stagefont2;

            if (m_stageselected)
            {
                pd = m_stagedonefont;
            }

            StageProfile sp = (m_currentstage >= 0 && m_currentstage < StageProfiles.Count) ? StageProfiles[m_currentstage] : null;

            m_stagedisplaybuilder.Length = 0;
            if (sp != null)
            {
                m_stagedisplaybuilder.AppendFormat("Stage {0}: {1}", m_currentstage + 1, sp.Name);
            }
            else
            {
                m_stagedisplaybuilder.Append("Stage: Random");
            }

            Print(pd, (Vector2)m_stageposition, m_stagedisplaybuilder.ToString(), null);
        }
        public EngineInitialization(CombatMode mode, TeamMode team1mode, TeamMode team2mode,
                                    PlayerProfile team1p1, int team1p1palette, PlayerMode team1p1mode,
                                    PlayerProfile team1p2, int team1p2palette, PlayerMode team1p2mode,
                                    PlayerProfile team2p1, int team2p1palette, PlayerMode team2p1mode,
                                    PlayerProfile team2p2, int team2p2palette, PlayerMode team2p2mode,
                                    StageProfile stage, int?seed = null)
        {
            seed = seed ?? Environment.TickCount;
            if (mode == CombatMode.None)
            {
                throw new ArgumentOutOfRangeException(nameof(mode));
            }
            if (team1p1 == null)
            {
                throw new ArgumentNullException(nameof(team1p1));
            }
            if (team1p1palette < 0 || team1p1palette > 11)
            {
                throw new ArgumentOutOfRangeException(nameof(team1p1palette));
            }
            if (team1p2palette < 0 || team1p2palette > 11)
            {
                throw new ArgumentOutOfRangeException(nameof(team1p2palette));
            }
            if (team2p1 == null)
            {
                throw new ArgumentNullException(nameof(team2p1));
            }
            if (team2p1palette < 0 || team2p1palette > 11)
            {
                throw new ArgumentOutOfRangeException(nameof(team2p1palette));
            }
            if (team2p2palette < 0 || team2p2palette > 11)
            {
                throw new ArgumentOutOfRangeException(nameof(team2p2palette));
            }
            if (stage == null)
            {
                throw new ArgumentNullException(nameof(stage));
            }

            m_mode    = mode;
            Team1Mode = team1mode;
            Team2Mode = team2mode;
            m_team1p1 = new PlayerCreation(team1p1, team1p1.GetValidPaletteIndex(team1p1palette), team1p1mode);
            if (team1p2 != null)
            {
                m_team1p2 = new PlayerCreation(team1p2, team1p2.GetValidPaletteIndex(team1p2palette), team1p2mode);
            }
            m_team2p1 = new PlayerCreation(team2p1, team2p1.GetValidPaletteIndex(team2p1palette), team2p1mode);
            if (team2p2 != null)
            {
                m_team2p2 = new PlayerCreation(team2p2, team2p2.GetValidPaletteIndex(team2p2palette), team2p2mode);
            }
            m_stage = stage;
            m_seed  = seed.Value;
        }
 public EngineInitialization(CombatMode mode,
                             PlayerProfile team1p1, int team1p1palette, PlayerMode team1p1mode,
                             PlayerProfile team2p1, int team2p1palette, PlayerMode team2p1mode,
                             StageProfile stage) :
     this(mode, TeamMode.None, TeamMode.None,
          team1p1, team1p1palette, team1p1mode, null, 0, PlayerMode.Human,
          team2p1, team2p1palette, team2p1mode, null, 0, PlayerMode.Human,
          stage)
 {
 }
示例#6
0
 void SelectStage()
 {
     foreach (StageProfile stageP in stages)
     {
         if (stageP.ID == selectedStageID)
         {
             stage = stageP;
             return;
         }
     }
     Debug.LogError("Stage with StageID " + selectedStageID + " not found in Stages list");
 }
		public EngineInitialization(CombatMode mode, PlayerProfile p1, Int32 p1palette, PlayerProfile p2, Int32 p2palette, StageProfile stage, Int32 seed)
		{
			if (mode == CombatMode.None) throw new ArgumentOutOfRangeException("mode");
			if (p1 == null) throw new ArgumentNullException("p1");
			if (p1palette < 0 || p1palette > 11) throw new ArgumentOutOfRangeException("p1palette");
			if (p2 == null) throw new ArgumentNullException("p2");
			if (p2palette < 0 || p2palette > 11) throw new ArgumentOutOfRangeException("p2palette");
			if (stage == null) throw new ArgumentNullException("stage");

			m_mode = mode;
			m_p1 = new PlayerCreation(p1, p1.GetValidPaletteIndex(p1palette));
			m_p2 = new PlayerCreation(p2, p2.GetValidPaletteIndex(p2palette));
			m_stage = stage;
			m_seed = seed;
		}
示例#8
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        StageProfile origin = (StageProfile)target;

        EditorGUILayout.Space();
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("CHARACTERS:");
        foreach (CharacterBaseInfoClass charInfoClass in origin.BattleInfoManager.GetComponent <BattleInfoManagerScript>().PlayerBattleInfo)
        {
            EditorGUILayout.LabelField(charInfoClass.Name.ToString() + " || " + charInfoClass.CharacterName.ToString());
        }

        EditorGUILayout.Space();
        string theTypeOfStage = "";

        switch (origin.BattleInfoManager.GetComponent <BattleInfoManagerScript>().MatchInfoType)
        {
        case (MatchType.PPvE):
            theTypeOfStage = "Co-op";
            break;

        case (MatchType.PPvPP):
            theTypeOfStage = "Team Deathmatch";
            break;

        case (MatchType.PvE):
            theTypeOfStage = "Player vs Enemy";
            break;

        case (MatchType.PvP):
            theTypeOfStage = "Player Vs Player";
            break;

        default:
            theTypeOfStage = origin.BattleInfoManager.GetComponent <BattleInfoManagerScript>().MatchInfoType.ToString();
            break;
        }
        EditorGUILayout.LabelField("BATTLE TYPE: " + theTypeOfStage);

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        WaveManagerScript waveM;

        if (origin.Wave != null)
        {
            waveM = origin.Wave.GetComponent <WaveManagerScript>();
            EditorGUILayout.LabelField("WAVES:");
            EditorGUILayout.LabelField("Wave Count - " + waveM.WavePhases.Count.ToString());

            foreach (WavePhaseClass wave in waveM.WavePhases)
            {
                EditorGUILayout.Space();
                EditorGUILayout.BeginFoldoutHeaderGroup(true, wave.name.ToUpper());
                foreach (WaveCharClass waveC in wave.ListOfEnemy)
                {
                    EditorGUILayout.LabelField("     " + waveC.NumberOfCharacter + " " + waveC.name + (waveC.NumberOfCharacter > 1 && waveC.name[waveC.name.Length - 1].ToString() != "s" ? "s" : ""));
                }
                EditorGUILayout.EndFoldoutHeaderGroup();
            }
        }
    }
示例#9
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();
        }
示例#10
0
 public EngineInitialization(CombatMode mode, PlayerProfile p1, Int32 p1palette, PlayerProfile p2, Int32 p2palette, StageProfile stage) :
     this(mode, p1, p1palette, p2, p2palette, stage, Environment.TickCount)
 {
 }
示例#11
0
		public EngineInitialization(CombatMode mode, PlayerProfile p1, Int32 p1palette, PlayerProfile p2, Int32 p2palette, StageProfile stage):
			this(mode, p1, p1palette, p2, p2palette, stage, Environment.TickCount)
		{
		}
示例#12
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();
		}