Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,136 @@ | |||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |||
<html xmlns="http://www.w3.org/1999/xhtml"> | |||
<head> | |||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |||
<title>Unity Web Player | Roguelike</title> | |||
<script type='text/javascript' src='https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/jquery.min.js'></script> | |||
<script type="text/javascript"> | |||
<!-- | |||
var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"; | |||
if (document.location.protocol == 'https:') | |||
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-"); | |||
document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>'); | |||
--> | |||
</script> | |||
<script type="text/javascript"> | |||
<!-- | |||
var config = { | |||
width: 960, | |||
height: 600, | |||
params: { enableDebugging:"0" } | |||
|
|||
}; | |||
var u = new UnityObject2(config); | |||
|
|||
jQuery(function() { | |||
|
|||
var $missingScreen = jQuery("#unityPlayer").find(".missing"); | |||
var $brokenScreen = jQuery("#unityPlayer").find(".broken"); | |||
$missingScreen.hide(); | |||
$brokenScreen.hide(); | |||
|
|||
u.observeProgress(function (progress) { | |||
switch(progress.pluginStatus) { | |||
case "broken": | |||
$brokenScreen.find("a").click(function (e) { | |||
e.stopPropagation(); | |||
e.preventDefault(); | |||
u.installPlugin(); | |||
return false; | |||
}); | |||
$brokenScreen.show(); | |||
break; | |||
case "missing": | |||
$missingScreen.find("a").click(function (e) { | |||
e.stopPropagation(); | |||
e.preventDefault(); | |||
u.installPlugin(); | |||
return false; | |||
}); | |||
$missingScreen.show(); | |||
break; | |||
case "installed": | |||
$missingScreen.remove(); | |||
break; | |||
case "first": | |||
break; | |||
} | |||
}); | |||
u.initPlugin(jQuery("#unityPlayer")[0], "Roguelike_AITest.unity3d"); | |||
}); | |||
--> | |||
</script> | |||
<style type="text/css"> | |||
<!-- | |||
body { | |||
font-family: Helvetica, Verdana, Arial, sans-serif; | |||
background-color: white; | |||
color: black; | |||
text-align: center; | |||
} | |||
a:link, a:visited { | |||
color: #000; | |||
} | |||
a:active, a:hover { | |||
color: #666; | |||
} | |||
p.header { | |||
font-size: small; | |||
} | |||
p.header span { | |||
font-weight: bold; | |||
} | |||
p.footer { | |||
font-size: x-small; | |||
} | |||
div.content { | |||
margin: auto; | |||
width: 960px; | |||
} | |||
div.broken, | |||
div.missing { | |||
margin: auto; | |||
position: relative; | |||
top: 50%; | |||
width: 193px; | |||
} | |||
div.broken a, | |||
div.missing a { | |||
height: 63px; | |||
position: relative; | |||
top: -31px; | |||
} | |||
div.broken img, | |||
div.missing img { | |||
border-width: 0px; | |||
} | |||
div.broken { | |||
display: none; | |||
} | |||
div#unityPlayer { | |||
cursor: default; | |||
height: 600px; | |||
width: 960px; | |||
} | |||
--> | |||
</style> | |||
</head> | |||
<body> | |||
<p class="header"><span>Unity Web Player | </span>Roguelike</p> | |||
<div class="content"> | |||
<div id="unityPlayer"> | |||
<div class="missing"> | |||
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!"> | |||
<img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" /> | |||
</a> | |||
</div> | |||
<div class="broken"> | |||
<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now! Restart your browser after install."> | |||
<img alt="Unity Web Player. Install now! Restart your browser after install." src="http://webplayer.unity3d.com/installation/getunityrestart.png" width="193" height="63" /> | |||
</a> | |||
</div> | |||
</div> | |||
</div> | |||
<p class="footer">« created with <a href="http://unity3d.com/unity/" title="Go to unity3d.com">Unity</a> »</p> | |||
</body> | |||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,15 +1,84 @@ | |||
using UnityEngine; | using UnityEngine; | ||
using System.Collections; | using System.Collections; | ||
|
|
||
public class EnemyArcher : MonoBehaviour { | public class EnemyArcher : MonoBehaviour | ||
|
{ | ||
// Use this for initialization | public Ray ray; | ||
void Start () { | public GameObject player; | ||
|
|
||
} | public bool canSee; | ||
|
|
||
// Update is called once per frame | public float distance; | ||
void Update () { |
|
||
|
public float speed; | ||
} |
|
||
public Vector3 midpoint; | |||
public int morale = 1; | |||
|
|||
|
|||
// Use this for initialization | |||
void Start() | |||
{ | |||
|
|||
} | |||
|
|||
// Update is called once per frame | |||
void Update() | |||
{ | |||
distance = Vector3.Distance(player.transform.position, gameObject.transform.position); | |||
midpoint = new Vector3(gameObject.transform.position.x + (player.transform.position.x - gameObject.transform.position.x) / 2, transform.position.y, gameObject.transform.position.z + (player.transform.position.z)); | |||
speed = distance * 1.1f; | |||
RaycastHit hit; | |||
ray = new Ray(gameObject.transform.position, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z - 4)); | |||
if (Physics.Raycast(ray, out hit)) | |||
{ | |||
if (hit.collider.tag == "Player") | |||
{ | |||
Debug.Log("Hit, hit, damage report"); | |||
canSee = true; | |||
ray = new Ray(gameObject.transform.position, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z - 4)); | |||
|
|||
} | |||
if (hit.collider.tag != "Player") | |||
{ | |||
Debug.Log("No Joy"); | |||
canSee = false; | |||
ray = new Ray(gameObject.transform.position, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z - 4)); | |||
|
|||
} | |||
|
|||
} | |||
|
|||
if (canSee == true) | |||
{ | |||
iTween.MoveTo(gameObject, midpoint, speed); | |||
} | |||
if (canSee == false) | |||
{ | |||
iTween.MoveTo(gameObject, new Vector3(gameObject.transform.position.x + 0.01f, gameObject.transform.position.y, gameObject.transform.position.z + .01f), 1); | |||
} | |||
|
|||
//MOrale=================== | |||
if (morale == 0) | |||
{ | |||
iTween.MoveTo(gameObject, new Vector3(gameObject.transform.position.x + 5f, gameObject.transform.position.y, gameObject.transform.position.z + 5f), 1); | |||
} | |||
|
|||
} | |||
|
|||
void OnCollisionEnter(Collision collision) | |||
{ | |||
if (collision.gameObject.tag == "Player") | |||
{ | |||
Debug.Log("Ouch!"); | |||
} | |||
|
|||
} | |||
//Button | |||
public void BreakMorale() | |||
{ | |||
Debug.Log("Milita Broken!"); | |||
morale = 0; | |||
} | |||
|
|||
} | } |
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,15 +1,76 @@ | |||
using UnityEngine; | using UnityEngine; | ||
using System.Collections; | using System.Collections; | ||
|
|
||
public class EnemyMilitia : MonoBehaviour { | public class EnemyMilitia : MonoBehaviour | ||
|
{ | ||
// Use this for initialization | public Ray ray; | ||
void Start () { | public GameObject player; | ||
|
|
||
} | public bool canSee; | ||
|
|
||
// Update is called once per frame | public float distance; | ||
void Update () { |
|
||
|
public float speed; | ||
} |
|
||
public int morale = 1; | |||
|
|||
// Update is called once per frame | |||
void Update() | |||
{ | |||
distance = Vector3.Distance(player.transform.position, gameObject.transform.position); | |||
speed = distance * 1.1f; | |||
RaycastHit hit; | |||
ray = new Ray(gameObject.transform.position, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z - 4)); | |||
if (Physics.Raycast(ray, out hit)) | |||
{ | |||
if (hit.collider.tag == "Player") | |||
{ | |||
Debug.Log("Hit, hit, damage report"); | |||
canSee = true; | |||
ray = new Ray(gameObject.transform.position, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z - 4)); | |||
|
|||
} | |||
if (hit.collider.tag != "Player") | |||
{ | |||
Debug.Log("No Joy"); | |||
canSee = false; | |||
ray = new Ray(gameObject.transform.position, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z - 4)); | |||
|
|||
} | |||
|
|||
} | |||
|
|||
if (canSee == true) | |||
{ | |||
iTween.MoveTo(gameObject, player.transform.position, speed); | |||
} | |||
if (canSee == false) | |||
{ | |||
iTween.MoveTo(gameObject, new Vector3(gameObject.transform.position.x + 0.01f, gameObject.transform.position.y, gameObject.transform.position.z + .01f), 1); | |||
} | |||
|
|||
|
|||
|
|||
//MOrale=================== | |||
if (morale == 0) | |||
{ | |||
iTween.MoveTo(gameObject, new Vector3(gameObject.transform.position.x + 5f, gameObject.transform.position.y, gameObject.transform.position.z + 5f), 1); | |||
} | |||
} | |||
|
|||
void OnCollisionEnter(Collision collision) | |||
{ | |||
if (collision.gameObject.tag == "Player") | |||
{ | |||
Debug.Log("Ouch!"); | |||
} | |||
|
|||
} | |||
|
|||
//Button | |||
public void BreakMorale() | |||
{ | |||
Debug.Log("Milita Broken!"); | |||
morale = 0; | |||
} | |||
} | } |