Hello everyone…
Her is the thing. Im doing a game for fun…
so far i manged to do the Terrain, FPS Controller, Now im in the enemy
part of the game…
So far i managed to make the character animate when its dead and it follows the user.
Now the question i have …
How i can make the script creates a random enemies when all of them die…???
Any recommended improvements???
Thanks…
Enemy Script/…
var Player : Transform;
var MoveSpeed = 4;
var MaxDist = 10;
var MinDist = 5;
public var Health = 100;
function Start ()
{
}
function Update ()
{
transform.LookAt(Player);
if(Vector3.Distance(transform.position,Player.position) >= MinDist)
{
transform.position = transform.position + transform.forward*MoveSpeed*Time.deltaTime;
if(Health >=1){
animation.Play("walk");
}else if (Health <= 0){
animation.CrossFade("die");
Destroy(gameObject, 2);
}
if(Vector3.Distance(transform.position,Player.position) <= MaxDist)
{
if(Health >=1){
animation.CrossFade("attack");
}else if (Health <= 0){
animation.CrossFade("diehard");
Destroy(gameObject, 2);
}
}
}
}
public function applyDamage(health : int){
Health = Health - health;
}
// When the enemy is hit animat...
// But i can seem to make Yeild To WORK....!!!!!!
function gotHit(){
animation.CrossFade("resist");
yield WaitForSeconds(1);
}
function Test(){
Debug.Log(this.name);
}
Your pointers are appreciated