Exemple #1
0
 public Combat(IFightable goodguy, IFightable badguy)
 {
     friend       = goodguy;
     enemy        = badguy;
     friendStatus = friend.GetStatus();
     enemyStatus  = enemy.GetStatus();
 }
    public GuiObject BuildCombatWindow(IFightable friend, IFightable enemy, Combat combat)
    {
        CloseWindow("LeftPane");
        GuiObject window = new GuiObject(new Rect(100, 50, 400, 300), "CentrePane", "Combat!");
        Status    friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();

        combat = new Combat(friend, enemy);
        string report = combat.Phase()();

        window.AddChild(new GuiObject(new Rect(10, 25, 490, 370),
                                      (g) => {
            GUI.Label(g.rect, "Night has fallen and you were attacked!\n" + report);
            if (GUI.Button(new Rect(175, 260, 50, 25), "OK"))
            {
                CloseWindow("CentrePane");
            }
        }, "Report", ""));

        return(window);
    }
Exemple #3
0
	public Combat (IFightable goodguy, IFightable badguy) {
		friend = goodguy;
		enemy = badguy;
		friendStatus = friend.GetStatus();
		enemyStatus = enemy.GetStatus();
	}
    public GuiObject BuildCombatDebugWindow(IFightable friend, IFightable enemy, Combat combat)
    {
        CloseWindow("LeftPane");

        GuiObject window = new GuiObject(new Rect(20, 50, 800, 500), "CentrePane", "Combat!");
        Status    friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();

        combat = new Combat(friend, enemy);

        window.AddChild(new GuiObject(new Rect(20, 20, 800, 100),
                                      (g) => {
            GUI.Label(new Rect(10, 25, 780, 100), "Night has fallen, you are under attack!");

            if (GUI.Button(new Rect(345, 65, 100, 30), "Attack!"))
            {
                combat.Phase();
            }
        }, "Text", ""));

        window.AddChild(new GuiObject(new Rect(20, 100, 360, 390),
                                      (g) => {
            GUI.Box(g.rect, g.text);
            GUI.Label(new Rect(30, 200, 200, 25), "Attack: " + friendStatus.attack);
            if (friendStatus.attackbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(90, 200, 200, 25), "+" + friendStatus.attackbonus);
                SetColor();
            }
            GUI.Label(new Rect(30, 220, 200, 25), "Armour: " + friendStatus.armour);
            if (friendStatus.armorbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(90, 220, 200, 25), "+" + friendStatus.armorbonus);
                SetColor();
            }
            GUI.Label(new Rect(30, 240, 200, 25), "Speed: " + friendStatus.speed);
            if (friendStatus.speedbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(90, 240, 200, 25), "+" + friendStatus.speedbonus);
                SetColor();
            }
            GUI.Label(new Rect(130, 200, 100, 25), "Health: " + friendStatus.health);
            GUI.Label(new Rect(130, 220, 100, 25), "Turn: " + friendStatus.turn);
        }, "FriendBox", "Friend"));

        window.AddChild(new GuiObject(new Rect(410, 100, 360, 390),
                                      (g) => {
            GUI.Box(g.rect, g.text);
            GUI.Label(new Rect(420, 200, 200, 25), "Attack: " + enemyStatus.attack);
            if (enemyStatus.attackbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(480, 200, 200, 25), "+" + enemyStatus.attackbonus);
                SetColor();
            }
            GUI.Label(new Rect(420, 220, 200, 25), "Armour: " + enemyStatus.armour);
            if (enemyStatus.armorbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(480, 220, 200, 25), "+" + enemyStatus.armorbonus);
                SetColor();
            }
            GUI.Label(new Rect(420, 240, 200, 25), "Speed: " + enemyStatus.speed);
            if (enemyStatus.speedbonus > 0f)
            {
                SetColor(() => true);
                GUI.Label(new Rect(480, 240, 200, 25), "+" + enemyStatus.speedbonus);
                SetColor();
            }
            GUI.Label(new Rect(520, 200, 100, 25), "Health: " + enemyStatus.health);
            GUI.Label(new Rect(520, 220, 100, 25), "Turn: " + enemyStatus.turn);
        }, "EnemyBox", "Enemy"));

        return(window);
    }
	public GuiObject BuildCombatDebugWindow(IFightable friend, IFightable enemy, Combat combat) {
		CloseWindow("LeftPane");
		
		GuiObject window = new GuiObject(new Rect(20, 50, 800, 500), "CentrePane", "Combat!");	
		Status friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();
		combat = new Combat(friend, enemy);
		
		window.AddChild(new GuiObject( new Rect(20, 20, 800, 100),
			(g) => {
				GUI.Label(new Rect(10, 25, 780, 100), "Night has fallen, you are under attack!");
				
				if (GUI.Button(new Rect(345, 65, 100, 30), "Attack!")) {
						combat.Phase();
				}
			}, "Text", ""));
		
		window.AddChild(new GuiObject(new Rect(20, 100, 360, 390),
			(g) => {
				GUI.Box(g.rect, g.text);
				GUI.Label(new Rect(30, 200, 200, 25), "Attack: " + friendStatus.attack);
				if (friendStatus.attackbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(90, 200, 200, 25), "+" + friendStatus.attackbonus);
					SetColor();
				}
				GUI.Label(new Rect(30, 220, 200, 25), "Armour: " + friendStatus.armour);
				if (friendStatus.armorbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(90, 220, 200, 25), "+" + friendStatus.armorbonus);
					SetColor();
				}
				GUI.Label(new Rect(30, 240, 200, 25), "Speed: " + friendStatus.speed);
				if (friendStatus.speedbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(90, 240, 200, 25), "+" + friendStatus.speedbonus);
					SetColor();
				}
				GUI.Label(new Rect(130, 200, 100, 25), "Health: " + friendStatus.health);
				GUI.Label(new Rect(130, 220, 100, 25), "Turn: " + friendStatus.turn);
			}, "FriendBox", "Friend"));
		
		window.AddChild(new GuiObject(new Rect(410, 100, 360, 390),
			(g) => {
				GUI.Box(g.rect, g.text);
				GUI.Label(new Rect(420, 200, 200, 25), "Attack: " + enemyStatus.attack);
				if (enemyStatus.attackbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(480, 200, 200, 25), "+" + enemyStatus.attackbonus);
					SetColor();
				}
				GUI.Label(new Rect(420, 220, 200, 25), "Armour: " + enemyStatus.armour);
				if (enemyStatus.armorbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(480, 220, 200, 25), "+" + enemyStatus.armorbonus);
					SetColor();
				}
				GUI.Label(new Rect(420, 240, 200, 25), "Speed: " + enemyStatus.speed);
				if (enemyStatus.speedbonus > 0f) {
					SetColor(() => true);
					GUI.Label(new Rect(480, 240, 200, 25), "+" + enemyStatus.speedbonus);
					SetColor();
				}
				GUI.Label(new Rect(520, 200, 100, 25), "Health: " + enemyStatus.health);
				GUI.Label(new Rect(520, 220, 100, 25), "Turn: " + enemyStatus.turn);
			}, "EnemyBox", "Enemy"));
		
		return window;
	}
	public GuiObject BuildCombatWindow(IFightable friend, IFightable enemy, Combat combat) {
		CloseWindow("LeftPane");
		GuiObject window = new GuiObject(new Rect(100, 50, 400, 300), "CentrePane", "Combat!");
		Status friendStatus = friend.GetStatus(), enemyStatus = enemy.GetStatus();
		combat = new Combat(friend, enemy);
		string report = combat.Phase()();
		
		window.AddChild(new GuiObject(new Rect(10, 25, 490, 370),
			(g) => {
				GUI.Label(g.rect, "Night has fallen and you were attacked!\n" + report);
				if (GUI.Button(new Rect(175, 260, 50, 25), "OK")) {
					CloseWindow("CentrePane");
				}
			}, "Report", ""));
		
		return window;
	}