示例#1
0
    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;
            }
        }
    }
示例#2
0
    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;
            }
        }
    }
示例#3
0
 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;
         }
     }
 }
示例#4
0
 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;
     }
 }
示例#5
0
 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;
         }
     }
 }
示例#6
0
 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;
     }
 }
示例#7
0
 private void BePassive()
 {
     driveBehavior = DriveBehavior.Idle;
 }
示例#8
0
 private void BePassive()
 {
     driveBehavior = DriveBehavior.Idle;
 }