protected override void OnSelect(ToolController owner)
    {
        Debug.Log("Satellite Tool Selected");
        satInv = owner.GetComponent <SatelliteInventory>();
        if (satInv == null || satInv.StoredSatellites.Count == 0 || satInv.StoredSatellites[0] == null)
        {
            satInv.NoSatTooltip.SetActive(true);
            //Debug.Log("NoSat Found");
            return;
        }

        //this is such a gross way of checking what satellite type a thing is im sorry
        if (satInv.StoredSatellites[0].name == "FuelSatellite")
        {
            foreach (var cloud in cloudVisualizers)
            {
                cloud.VisualizeArea();
            }
        }

        SatellitePreview = GameObject.Instantiate(satInv.StoredSatellites[0].PreviewPrefab);
        SatellitePreview.transform.position = satInv.SatelliteSpawnPos.position;
        SatellitePreview.transform.rotation = satInv.SatelliteSpawnPos.rotation;
        SatellitePreview.transform.SetParent(owner.GetComponentInChildren <Camera>().transform);
        SatBehavior = SatellitePreview.GetComponent <SatelliteBehavior>();
    }
Exemple #2
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        sb     = player.GetComponent <SatelliteBehavior>();

        position = transform.localPosition;
    }
 protected override void OnDeselect(ToolController owner)
 {
     if (cloudVisualizers[0].enabled == true)
     {
         foreach (var cloud in cloudVisualizers)
         {
             cloud.DisableVisualizer();
         }
     }
     Debug.Log("Satellite Tool DeSelected");
     //turn off tooltips from satinv
     satInv.NoSatTooltip.SetActive(false);
     satInv.SatNotInCloud.SetActive(false);
     satInv.PlaceSat.SetActive(false);
     //nullify satinv
     satInv      = null;
     SatBehavior = null;
     Destroy(SatellitePreview);
 }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     projectile = (GameObject)Resources.Load("Projectile", typeof(GameObject));
     audio      = FindObjectOfType <Audio>();
     cs         = FindObjectOfType <SatelliteBehavior>();
 }
 // Use this for initialization
 void Start()
 {
     player   = GameObject.FindGameObjectWithTag("Player");
     sb       = player.GetComponent <SatelliteBehavior>();
     coinText = GetComponent <Text>();
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     sb = FindObjectOfType <SatelliteBehavior>();
 }