Friday, November 19, 2010

Wednesday, November 10, 2010

Week 5: Programming: AI

var enemyaggro : GameObject;
var player2 : GameObject;
var enemyState = "String";
var health= 100;
var localchase =false;
var playerLastX=0.0;
var playerLastZ=0.0;
var playerLastY=0.0;
var firstX=0.0;
var switcher=1;
function Start(){
enemyState = "idle";
print(enemyState);
firstX=transform.position.x;
}
function Update () {
if(enemyState == "chase"){
enemychase();
print(enemyState);
}
if(enemyState == "attackmode"){
enemyAttack();
print(enemyState);
}
if(localchase){
enemyState="chase";
}
if(enemyState=="looking"){
startLooking2();
}
if(enemyState=="confusion"){
startConfusion();
}
}
function OnCollisionStay (collision : Collision) {
if (collision.gameObject.tag == "Player") {
enemyState="attackmode";
}
}
function enemyAttack(){
transform.LookAt(player2.transform);
print("enemyhit");
yield WaitForSeconds(3);
enemyState="idle";
}
function enemychase(){
transform.LookAt(player2.transform);
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
}
function startLocalChase () {
localchase =true;
}
function startLooking(){
localchase = false;
playerLastX=player2.transform.position.x;
playerLastZ=player2.transform.position.z;
playerLastY=player2.transform.position.y;
enemyState ="looking";
transform.LookAt(Vector3(playerLastX,playerLastY,playerLastZ));
}
function startLooking2(){
if(!localchase){
rigidbody.transform.Translate(2*Vector3.forward * Time.deltaTime);
yield WaitForSeconds(6);
enemyState="confusion";
print(enemyState);
}
}
function startConfusion(){
if(!localchase){
transform.Rotate(20*Vector3.down * Time.deltaTime);
}
}
function OnGUI () {
GUI.Label(Rect(Screen.width - 120, 10, 200, 50),"Enemy Health: " + health);
}

Tuesday, October 26, 2010

Week 4: Programming

function Update() {

if(Input.GetButtonDown("KeyBoardAttack(F)"))
{

swordenable();
}
}
function swordenable(){

gameObject.tag = "player_weapon";
print("namechanged");
yield WaitForSeconds(1);
gameObject.tag = "Untagged";
}

Code which solves the previous weeks problem. Now the dagger is only active for one second after you hit the attack button.

Week 4: Texturing




Week 3: Modeling











Week 3: Programming

function OnTriggerEnter(other: Collider)
{
if(other.gameObject.tag == "player_weapon")
{
print("hit");
SendMessageUpwards ("Assasination");

}
}

This code is on a collider behind the enemy and when you sneak up behind him and attack him he will die in one hit. A problem that I am having is that the sword object is always active. So even without hitting the attack button it will kill then enemy. One way to solve this problem is im am going to change the name of the collider for the sword and only change it when the attack button is pressed and then change it back in a couple of seconds.

Tuesday, October 12, 2010

Week 2: Programming


Worked with robin getting the core mechanic started so far we have coliders on the end of the swords. We need to get the enemy prefab and not with a static variable. We will also get the enemy dying with a hit to the back and front attacks take atleast three hits.

Week 2: Level Design


Added my puzzle into level one designed by Dan. Dan and I also lightmapped the scene so it doesnt require lights in unity. Feedback: Make boxes bigger turn falling ones red.

Week 2: Texturing




Week 2: Modeling



Tuesday, August 31, 2010

Programming: Test Enviornment 03: One shadow collider


Light map created for unity


UVoutline of level 3


Overview shot in unity of the shadow collider in the scene, scene is lit with no lights

Mesh for shadow collider, this collider is ignored in unity and is used as a mesh collider. This is now used for the shadows instead of creating a ton of colliders I have one collider now.

Level 3 After Modifications
Level 3 before modifications