Skip to content
Permalink
Browse files

"ready to submit"

  • Loading branch information
rkv14001 committed Sep 13, 2016
1 parent feca0e3 commit bc004008ae79765e3fad2c5d9850b9cf848a9871
Showing with 186 additions and 0 deletions.
  1. +9 −0 DnD Fight/Assets/Materials.meta
  2. +9 −0 DnD Fight/Assets/Scene.meta
  3. BIN First Project/Temp/__Backupscenes/0.backup → DnD Fight/Assets/Scene/DnDBattle.unity
  4. +8 −0 DnD Fight/Assets/Scene/DnDBattle.unity.meta
  5. +9 −0 DnD Fight/Assets/Scripts.meta
  6. +128 −0 DnD Fight/Assets/Scripts/DNDFight.cs
  7. +12 −0 DnD Fight/Assets/Scripts/DNDFight.cs.meta
  8. +9 −0 DnD Fight/Assets/Textures.meta
  9. BIN DnD Fight/ProjectSettings/AudioManager.asset
  10. BIN DnD Fight/ProjectSettings/ClusterInputManager.asset
  11. BIN DnD Fight/ProjectSettings/DynamicsManager.asset
  12. BIN DnD Fight/ProjectSettings/EditorBuildSettings.asset
  13. BIN DnD Fight/ProjectSettings/EditorSettings.asset
  14. BIN DnD Fight/ProjectSettings/GraphicsSettings.asset
  15. BIN DnD Fight/ProjectSettings/InputManager.asset
  16. BIN DnD Fight/ProjectSettings/NavMeshAreas.asset
  17. BIN DnD Fight/ProjectSettings/NetworkManager.asset
  18. BIN DnD Fight/ProjectSettings/Physics2DSettings.asset
  19. BIN DnD Fight/ProjectSettings/ProjectSettings.asset
  20. +2 −0 DnD Fight/ProjectSettings/ProjectVersion.txt
  21. BIN DnD Fight/ProjectSettings/QualitySettings.asset
  22. BIN DnD Fight/ProjectSettings/TagManager.asset
  23. BIN DnD Fight/ProjectSettings/TimeManager.asset
  24. BIN DnD Fight/ProjectSettings/UnityAdsSettings.asset
  25. BIN DnD Fight/ProjectSettings/UnityConnectSettings.asset
  26. BIN First Project/Library/CurrentLayout.dwlt
  27. BIN First Project/Library/expandedItems
  28. BIN First Project/Temp/ProcessJobs/e9a6970f79cd12d8b075e7d72f1b07cb.bakert
  29. 0 First Project/Temp/UnityLockfile

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

File renamed without changes.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,128 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DNDFight : MonoBehaviour {

public Text log;
public Text pName;
public Text pHitPoints;
public Text pDMG;
public Text pAcc;
public Text eName;
public Text eHitPoints;
public Text eDMG;
public Text eAcc;

public string pNameStr;
public int pHitPointsInt;
public int pDMGLow;
public int pDMGHigh;
public int pAccf;

public string eNameStr;
public int eHitPointsInt;
public int eDMGLow;
public int eDMGHigh;
public int eAccf;


// Use this for initializations
void Start () {
Debug.Log ("HI");
pName = pName.GetComponent<Text> ();
pHitPoints = pHitPoints.GetComponent<Text> ();
pDMG = pDMG.GetComponent<Text> ();
pAcc = pAcc.GetComponent<Text> ();
eName = eName.GetComponent<Text> ();
eHitPoints = eHitPoints.GetComponent<Text> ();
eDMG = eDMG.GetComponent<Text> ();
eAcc = eAcc.GetComponent<Text> ();
log = log.GetComponent<Text> ();

}



void set () {
pName.text = pNameStr;
pHitPoints.text = "HP: " + pHitPointsInt.ToString ();
pDMG.text = pDMGLow.ToString () + " - " + pDMGHigh.ToString ();
pAcc.text = "Accuracy: " + pAccf.ToString () + " %";

eName.text = eNameStr;
eHitPoints.text = "HP: " + eHitPointsInt.ToString ();
eDMG.text = eDMGLow.ToString () + " - " + eDMGHigh.ToString ();
eAcc.text = "Accuracy: " + eAccf.ToString () + " %";
}

public void Roll () {
pNameStr = "PLAYER 1";
pHitPointsInt = getRandomInt (4.0f, 24.0f);
int pdmg1 = getRandomInt (4.0f, 24.0f);
int pdmg2 = getRandomInt (4.0f, 24.0f);
pDMGHigh = Mathf.Max (pdmg1, pdmg2);
pDMGLow = Mathf.Min (pdmg1, pdmg2);
pAccf = getRandomInt(0.0f, 100.0f);

eNameStr = "Enemy 1";
eHitPointsInt = getRandomInt (4.0f, 24.0f);
int edmg1 = getRandomInt (4.0f, 24.0f);
int edmg2 = getRandomInt (4.0f, 24.0f);
eDMGHigh = Mathf.Max (edmg1, edmg2);
eDMGLow = Mathf.Min (edmg1, edmg2);
eAccf = getRandomInt(0.0f, 100.0f);
}
public void Fight () {

string final = playerAttackEnemy () + enemyAttackPlayer ();
log.text = final;
}

string playerAttackEnemy () {
string result = "";
if (getRandomInt (0.0f, 100.0f) < pAccf) {
result += "Hit! " + pNameStr + " hit " + eNameStr + " for ";
int dmg = getRandomInt ((float)pDMGLow, (float)pDMGHigh);
eHitPointsInt = eHitPointsInt - dmg;
result += dmg.ToString () + " damage. \n";

if (eHitPointsInt <= 0) {
result += "Dead! " + eNameStr + " has died! \n";

}

} else {
result += "Miss! " + pNameStr + " missed " + eNameStr + "! \n";
}
return result;
}
string enemyAttackPlayer () {
string result = "";
if (getRandomInt (0.0f, 100.0f) < pAccf) {
result += "Hit! " + eNameStr + " hit " + pNameStr + " for ";
int dmg = getRandomInt ((float)eDMGLow, (float)eDMGHigh);
pHitPointsInt = pHitPointsInt - dmg;
result += dmg.ToString () + " damage. \n";

if (pHitPointsInt <= 0) {
result += "Dead! " + pNameStr + " has died! \n";

}

} else {
result += "Miss! " + eNameStr + " missed " + pNameStr + "! \n";
}
return result;
}




int getRandomInt(float i, float j) {
return Mathf.RoundToInt(Random.Range (i, j));
}
// Update is called once per frame
void Update () {
set ();
}
}

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
m_EditorVersion: 5.4.0f3
m_StandardAssetsVersion: 0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
No changes.

0 comments on commit bc00400

Please sign in to comment.
You can’t perform that action at this time.