//ToDo: Make it so that the control scheme can be changed by the player. void Awake() { //Attaching scripts and objects. data = gameObject.GetComponent <TankData>(); move = gameObject.GetComponent <TankMove>(); attack = gameObject.GetComponent <TankAttack>(); }
void Awake() { tf = GetComponent <Transform>(); move = GetComponent <TankMove>(); attack = GetComponent <TankAttack>(); life = GetComponent <TankLife>(); //Removed Reverse Speed and just divided the speed //by 3 when moving backwards, I would have to completely //change Move and IController to keep and use the reverse //variable. tankForwardSpeed = 5; tankRotateSpeed = 100; tankMaxLife = 100; tankCurrentLife = 100; tankArmor = 5; tankGunDamage = 6; tankGunAmmoMax = 100; tankGunAmmoCurrent = 100; tankCannonDamage = 40; tankCannonAmmoMax = 10; tankCannonAmmoCurrent = 10; tankCannonFireR = 3; lives = 3; tankScore = 0; }
void Start() { control = GetComponent <AIControl>(); data = GetComponent <TankData>(); move = GetComponent <TankMove>(); attack = GetComponent <TankAttack>(); tf = GetComponent <Transform>(); }
private void Awake() { tankData = GetComponent <TankData>(); tankAttack = GetComponent <TankAttack>(); tankLife = GetComponent <TankLife>(); tankMove = GetComponent <TankMove>(); currentState = AIStates.Camp; }
void Awake() { //'this.gameObject.' is not required, but it leaves //very little to the imagination as to what the //reference is for. Here we attach those variables //to these scripts so that they will interact. tf = this.gameObject.GetComponent <Transform>(); move = this.gameObject.GetComponent <TankMove>(); attack = this.gameObject.GetComponent <TankAttack>(); life = this.gameObject.GetComponent <TankLife>(); }
public override void OnStart() { // the target is dynamic if the target transform is not null and has a valid dynamicTarget = (targetTransform != null && targetTransform.Value != null); tankattack = this.GetComponent <TankAttack>(); // set the speed, angular speed, and destination then enable the agent navMeshAgent.speed = speed.Value; navMeshAgent.angularSpeed = angularSpeed.Value; navMeshAgent.enabled = true; navMeshAgent.destination = Target(); }
void Start() { //Attaching scripts and objects. move = GetComponent <TankMove>(); data = GetComponent <TankData>(); attack = GetComponent <TankAttack>(); tf = GetComponent <Transform>(); color = GetComponent <MeshRenderer>().material; //Creating a way to randomly add personalities to the AI. identity = (Identity)Random.Range(0, System.Enum.GetNames(typeof(Identity)).Length); loopType = LoopType.PingPong; //When the identity is selected, pull the appropriate Script from Unity. switch (identity) { case Identity.Aggro: gameObject.AddComponent <AggroIdentity>(); color.color = Color.red; break; case Identity.Guard: gameObject.AddComponent <GuardIdentity>(); color.color = Color.white; break; case Identity.Sniper: gameObject.AddComponent <SniperIdentity>(); color.color = Color.yellow; break; case Identity.Coward: gameObject.AddComponent <CowardIdentity>(); color.color = Color.black; break; } foreach (GameObject waypointGo in GameManager.instance.waypoints) { waypoints.Add(waypointGo.transform); } }
void Start() { //Attaching scripts and objects. data = GetComponent <TankData>(); attack = GetComponent <TankAttack>(); move = GetComponent <TankMove>(); control = GetComponent <AIControl>(); tf = GetComponent <Transform>(); //Setting some variables. currentWaypoint = 0; closeEnough = 1.0f; patrolForward = true; hearingdistance = 25f; FOVangle = 45.0f; inSightAngle = 10.0f; healthRegen = 10; restTime = 5; }
// Start is called before the first frame update void Start() { this.agent = this.GetComponent <NavMeshAgent>(); this.tankAttack = this.GetComponent <TankAttack>(); SetDecisionTree(); }