Beispiel #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>();
    }
Beispiel #2
0
    public void Initialise(TurretData turretData, TurretShop turretShop)
    {
        _costText.text    = $"${turretData.Cost}";
        _iconImage.sprite = turretData.Icon;

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