Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Commit for Homework 9/14
  • Loading branch information
apw14002 committed Sep 15, 2016
1 parent 040812a commit 3070871
Show file tree
Hide file tree
Showing 99 changed files with 69,225 additions and 0 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added D&DcharacterGen/.DS_Store
Binary file not shown.
Binary file added D&DcharacterGen/Assets/.DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions D&DcharacterGen/Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added D&DcharacterGen/Assets/Scenes/GameCombat.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions D&DcharacterGen/Assets/Scenes/GameCombat.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions D&DcharacterGen/Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions D&DcharacterGen/Assets/Scripts/PlayerHits.cs
@@ -0,0 +1,128 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class PlayerHits : MonoBehaviour {

public float PlayerHitPointsText = 0.0f;
public float PlayerDamage = 0.0f;
public float PlayerChanceToHit = 0.0f;
public float EnemyHitPoints = 0;
public float EnemyDamage = 0;
public float EnemyChanceToHit = 0.0f;

public Text pName;
public Text pDamage;
public Text pChance;
public Text eHits;
public Text eDamage;
public Text eChance;

public Text status;
public Text status2;

// Use this for initialization
void Start () {

Debug.Log (EnemyHitPoints);

}

public void RollStats () {
PlayerHitPointsText = Random.Range (4, 6);
PlayerDamage = Random.Range (1, 3);
PlayerChanceToHit = Random.Range (0, 100);
EnemyHitPoints = Random.Range (2, 8);
EnemyDamage = Random.Range (1,3);
EnemyChanceToHit = Random.Range (0, 100);

pName = pName.GetComponent<Text>();
pName.text = PlayerHitPointsText.ToString();

pDamage = pDamage.GetComponent<Text>();
pDamage.text = PlayerDamage.ToString();

pChance = pChance.GetComponent<Text>();
pChance.text = PlayerChanceToHit + "%".ToString();

eHits = eHits.GetComponent<Text>();
eHits.text = EnemyHitPoints.ToString();

eDamage = eDamage.GetComponent<Text>();
eDamage.text = EnemyDamage.ToString();

eChance = eChance.GetComponent<Text>();
eChance.text = EnemyChanceToHit + "%".ToString();


Debug.Log (EnemyHitPoints);

}

//player health - enemy damage

public void Fight() {
var roll = Random.Range (0.0f, 100.0f);
var playerstatus = "status";
var enemystatus = "status";

if (PlayerChanceToHit >= roll) {

EnemyHitPoints = EnemyHitPoints - PlayerDamage;


playerstatus = "You hit the enemy! Enemy Health is now " + EnemyHitPoints;


} else {
playerstatus = "You missed the enemy! Enemy Health is still " + EnemyHitPoints;
};

if (EnemyChanceToHit >= roll) {

PlayerHitPointsText = PlayerHitPointsText - EnemyDamage;


enemystatus = "The enemy hit you! Your health is now " + PlayerHitPointsText;

} else {
enemystatus = "The enemy missed you! Your health is still " + PlayerHitPointsText;
};

status = status.GetComponent<Text> ();
status.text = playerstatus.ToString ();

status2 = status2.GetComponent<Text> ();
status2.text = enemystatus.ToString ();

if (EnemyHitPoints <= 0) {
enemystatus = "";
playerstatus = "You won!";

status = status.GetComponent<Text> ();
status.text = playerstatus.ToString ();

status2 = status2.GetComponent<Text> ();
status2.text = enemystatus.ToString ();
};

if (PlayerHitPointsText <= 0) {
enemystatus = "";
playerstatus = "You Lost";

status = status.GetComponent<Text> ();
status.text = playerstatus.ToString ();

status2 = status2.GetComponent<Text> ();
status2.text = enemystatus.ToString ();
};


}


// Update is called once per frame
void Update () {

}
}
12 changes: 12 additions & 0 deletions D&DcharacterGen/Assets/Scripts/PlayerHits.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
13 changes: 13 additions & 0 deletions D&DcharacterGen/D&DcharacterGen_AndrewWolf/BuildNotes.rtf
@@ -0,0 +1,13 @@
{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 This is a character combat game.\
\
Click Roll to Get your Health, Damage, and chance to hit value.\
\
Hit Fight to to fight the enemy. Keep clicking fight until you have destroyed the enemy or the enemy has destroyed you. \
\
Click roll to play again, then start fighting.}

0 comments on commit 3070871

Please sign in to comment.