public override void Start() { base.Start (); driveBehavior = DriveBehavior.None; maxStartupTime = Random.Range (3, 7); vehicleControls = GetComponent<VehicleControls>(); turretTransform = transform.Find ("Turret"); turret = turretTransform.GetComponent<SheepTurret>(); turret.owner = gameObject; myRigidBody = GetComponent<Rigidbody2D>(); if(reversePosition){ reverseFactor *= -1; } acceleration = Random.value; enemyPlayer = GetComponent<Entity>().EnemyPlayer(); DeterminePersonality(); if(reversePosition){ OrientationHelper.RotateTransform(turretTransform, 180); } foreach(Transform child in transform.Find ("Body").transform){ CarWheel wheel = child.GetComponent<CarWheel>(); if(wheel){ wheel.vehicleControls = vehicleControls; } } }
public override void Start() { base.Start(); driveBehavior = DriveBehavior.None; vehicleControls = GetComponent <VehicleControls>(); turretTransform = transform.Find("Turret"); turret = turretTransform.GetComponent <SheepTurret>(); turret.owner = gameObject; myRigidBody = GetComponent <Rigidbody2D>(); if (reversePosition) { reverseFactor *= -1; } acceleration = Random.value; if (reversePosition) { OrientationHelper.RotateTransform(turretTransform, 180); } foreach (Transform child in transform.Find("Body").transform) { CarWheel wheel = child.GetComponent <CarWheel>(); if (wheel) { wheel.vehicleControls = vehicleControls; } } }
private void BePassive() { if (driveBehavior == DriveBehavior.None) { float distanceBehindEnemy = enemyPlayer.transform.position.x - transform.position.x; if (enemyPlayer && distanceBehindEnemy < 2) { driveBehavior = DriveBehavior.Idle; } else if (enemyPlayer == null) { driveBehavior = DriveBehavior.Idle; } else if (distanceBehindEnemy > 2) { driveBehavior = DriveBehavior.Accelerate; } } }
private void BeAggressive() { if (enemyPlayer && Mathf.Abs(enemyPlayer.transform.position.x - transform.position.x) < 0.3f) { driveBehavior = DriveBehavior.Idle; } else if (enemyPlayer == null) { driveBehavior = DriveBehavior.Idle; } else if (enemyPlayer.transform.position.x > transform.position.x) { driveBehavior = DriveBehavior.Accelerate; } else { driveBehavior = DriveBehavior.Brake; } }
private void BePassive() { if(driveBehavior == DriveBehavior.None){ float distanceBehindEnemy = enemyPlayer.transform.position.x - transform.position.x; if(enemyPlayer && distanceBehindEnemy < 2){ driveBehavior = DriveBehavior.Idle; }else if(enemyPlayer == null){ driveBehavior = DriveBehavior.Idle; }else if (distanceBehindEnemy > 2){ driveBehavior = DriveBehavior.Accelerate; } } }
private void BeAggressive() { if(enemyPlayer && Mathf.Abs(enemyPlayer.transform.position.x - transform.position.x) < 0.3f){ driveBehavior = DriveBehavior.Idle; }else if(enemyPlayer == null){ driveBehavior = DriveBehavior.Idle; }else if (enemyPlayer.transform.position.x > transform.position.x){ driveBehavior = DriveBehavior.Accelerate; }else{ driveBehavior = DriveBehavior.Brake; } }
private void BePassive() { driveBehavior = DriveBehavior.Idle; }