Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        cubehighlight       = Resources.Load("Outline", typeof(Material)) as Material;
        cubenolight         = Resources.Load("Normal", typeof(Material)) as Material;
        cubehighlight.color = Color.white;
        cubenolight.color   = Color.white;
        group = 0;
        //graycast = New GraphicRaycaster();
        mes = GetComponent <EventSystem>();
        //initialize literally everything
        //gold manager
        gold = GameObject.FindObjectOfType <GoldManager>();
        g    = gameObject.GetComponent <GridManager>();
        //box collider for the grid to know when its clicked on
        BoxCollider b = gameObject.GetComponent <BoxCollider>();

        b.center = b.center + new Vector3(g.w / 2, 0, g.h / 2);
        b.size   = new Vector3(g.w + 1, 1, g.h + 1);
        //track when grid is awake or asleep
        state = 0;
        awake = false;
        //turret prefab and holder (holder not yet implemented)
        bh_transform = FindObjectOfType <Building_Holder>().gameObject.transform;
        cam          = GameObject.FindObjectOfType <CameraController>().gameObject;
        //this isnt working, so need to set this in the editor manually
        //blocker = GameObject.FindObjectOfType<Blocker>().gameObject;
        //blocker.SetActive(false);
        tss = turretshop.GetComponent <TurretShop>();
        ng  = Object.FindObjectOfType <nogold>();
    }
Esempio n. 2
0
    public void Initialise(TurretData turretData, TurretShop turretShop)
    {
        _costText.text    = $"${turretData.Cost}";
        _iconImage.sprite = turretData.Icon;

        _turretData = turretData;
        _turretShop = turretShop;
    }
Esempio n. 3
0
 public static void RestartGame()
 {
     StartGame();
     GameData.ResetData();
     TurretShop.ResetData();
     foreach (Node n in _map)
     {
         n.Turret = null;
     }
 }
Esempio n. 4
0
 public void OnMouseDown()
 {
     if (turret != null)
     {
         TurretShop.SelectedNode = this;
     }
     else if (turret == null && BuildManager.GetInstance().IsWaiting)
     {
         BuildTurret();
     }
     else
     {
         TurretShop.TurretShopUI(false);
     }
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     turretShop = this;
     fillList();
 }