Exemple #1
0
        private void HardReset()
        {
            for (int i = transform.childCount - 1; i >= 0; i--)
            {
                DestroyImmediate(transform.GetChild(i).gameObject);
            }
            _size = Vector3.zero;
            towerMaterialsAssembly = new TowerMaterialsAssembly();

            if (TryGetComponent(out Collider col))
            {
                DestroyImmediate(col);
            }
        }
Exemple #2
0
        public void Initialize(Vector3 size, Mesh mesh, TowerMaterialsAssembly materials, float materialDivider = 1f, bool createCollider = false)
        {
            _size = size;
            _mesh = mesh;
            towerMaterialsAssembly = materials;
            _gpuLoader             = GPULoader.Instance;

            CreateCube(size, materialDivider);
            if (createCollider)
            {
                //Creation of the collider if needed
                box        = gameObject.AddComponent <BoxCollider>();
                box.center = new Vector3(0, size.y / 2f);
                box.size   = size;
            }
        }