Advertisement
Guest User

Unity for noobs AI_Class 1.0

a guest
May 25th, 2015
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class AIBrain{
  2.  //how fast should this character move
  3.  public var moveSpeed:float;
  4.  //how close should this enemy get to to target
  5.  public var minDistance:float;
  6.  //unity's navagation system
  7.  public var Legs:NavMeshAgent;
  8.  //how close can a person get to this npc before it reacts
  9.  public var EnemyDetectionRange:float;
  10.  //how fast should this npc turn
  11.  public var rotationSpeed:float;
  12.  
  13. }
  14.  
  15. //this controlls all the combat varibles and functions for thhe npc
  16. public class AIAttack{
  17.  //the person the npc should attack
  18.  public var target:Transform;
  19.  //this tells the enemy to go into attack mode
  20.  public var Provoked:boolean;
  21.  //how close we can get before we can attack
  22.  public var attackRange:float;
  23.  //sometimes the npc has muliple target it needs to attack
  24.  public var targets:GameObject[];
  25.  //the countdown timer to attack
  26.  public var attackTimer:float;
  27.  //the lenght of time between attacks
  28.  public var cooldown:float;
  29.  //let the npc know when it can shoot a bullet so it doesnt shoot them back to back
  30.  public var CanAttack:boolean;
  31.  
  32.  
  33.  //the function to countdown to attack
  34.  function CountdownTimer(){
  35.    if(attackTimer > 0){
  36.    attackTimer -= Time.deltaTime;
  37.    }
  38.    if(attackTimer < 0){
  39.    attackTimer =0;
  40.    }
  41.    if(attackTimer ==0) {
  42.    CanAttack=true;
  43.    }
  44.    }
  45. }
  46. //this class controls all the rpg stats of the the npc
  47. public class AIStats{
  48. //how much damage should the npc do
  49. public var damage:float;
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement