public void SpawnBradley()
 {
     if (Object.op_Inequality((Object)this.spawned, (Object)null))
     {
         Debug.LogWarning((object)"Bradley attempting to spawn but one already exists!");
     }
     else
     {
         if (!Bradley.enabled)
         {
             return;
         }
         Vector3    position  = ((Component)this.path.interestZones[Random.Range(0, this.path.interestZones.Count)]).get_transform().get_position();
         BaseEntity entity    = GameManager.server.CreateEntity(this.bradleyPrefab.resourcePath, position, (Quaternion)null, true);
         BradleyAPC component = (BradleyAPC)((Component)entity).GetComponent <BradleyAPC>();
         if (Object.op_Implicit((Object)component))
         {
             entity.Spawn();
             component.InstallPatrolPath(this.path);
         }
         else
         {
             entity.Kill(BaseNetworkable.DestroyMode.None);
         }
         Debug.Log((object)("BradleyAPC Spawned at :" + (object)position));
         this.spawned = component;
     }
 }
    public void SpawnBradley()
    {
        if (this.spawned != null)
        {
            Debug.LogWarning("Bradley attempting to spawn but one already exists!");
            return;
        }
        if (!Bradley.enabled)
        {
            return;
        }
        Vector3     item        = this.path.interestZones[UnityEngine.Random.Range(0, this.path.interestZones.Count)].transform.position;
        GameManager gameManager = GameManager.server;
        string      str         = this.bradleyPrefab.resourcePath;
        Quaternion  quaternion  = new Quaternion();
        BaseEntity  baseEntity  = gameManager.CreateEntity(str, item, quaternion, true);
        BradleyAPC  component   = baseEntity.GetComponent <BradleyAPC>();

        if (!component)
        {
            baseEntity.Kill(BaseNetworkable.DestroyMode.None);
        }
        else
        {
            baseEntity.Spawn();
            component.InstallPatrolPath(this.path);
        }
        Debug.Log(string.Concat("BradleyAPC Spawned at :", item));
        this.spawned = component;
    }
        private void OnBradleyApcInitialize(BradleyAPC bradley)
        {
            bradley._maxHealth       = configs.options.startHealth;
            bradley.health           = bradley._maxHealth;
            bradley.viewDistance     = configs.options.maxTurretRange;
            bradley.searchRange      = configs.options.maxTurretRange;
            bradley.throttle         = configs.options.speed;     // TODO: Ensure Bradley speed.
            bradley.leftThrottle     = bradley.throttle;
            bradley.rightThrottle    = bradley.throttle;
            bradley.maxCratesToSpawn = configs.options.maxLootCrates;

            // Ensures there is a AI path to follow.
            Vector3 position = BradleySpawner.singleton.path.interestZones[UnityEngine.Random.Range(0, BradleySpawner.singleton.path.interestZones.Count)].transform.position;

            bradley.transform.position = position;
            bradley.DoAI = true;
            bradley.DoSimpleAI();
            bradley.InstallPatrolPath(BradleySpawner.singleton.path);

            if (!configs.options.bradleyEnabled)
            {
                bradley.Kill();
            }
        }
 public void SpawnBradley()
 {
     if (spawned != null)
     {
         Debug.LogWarning("Bradley attempting to spawn but one already exists!");
     }
     else if (Bradley.enabled)
     {
         Vector3    position   = path.interestZones[UnityEngine.Random.Range(0, path.interestZones.Count)].transform.position;
         BaseEntity baseEntity = GameManager.server.CreateEntity(bradleyPrefab.resourcePath, position);
         BradleyAPC component  = baseEntity.GetComponent <BradleyAPC>();
         if ((bool)component)
         {
             baseEntity.Spawn();
             component.InstallPatrolPath(path);
         }
         else
         {
             baseEntity.Kill();
         }
         Debug.Log("BradleyAPC Spawned at :" + position);
         spawned = component;
     }
 }