Exemple #1
0
        public void ChangeGroundType(int groundTypeID)
        {
            TileData.GroundType groundType = (TileData.GroundType)groundTypeID;
            _tile = _tileSelector.SelectedTile;

            _levelChangeHandler.ParseGroundTypeChange(_tile, groundType);
        }
Exemple #2
0
        public GameObject GetParticleEffect(TileData.GroundType groundType)
        {
            for (int i = 0; i < _tileEffects.Length; i++)
            {
                if (_tileEffects[i].groundType != groundType)
                {
                    continue;
                }

                return(_tileEffects[i].ParticleSystemGameObject);
            }
            return(null);
        }
Exemple #3
0
        // we can't serialize dictionaries in scriptable objects, hence we're iterating.
        public bool HasTileEffects(TileData.GroundType groundType)
        {
            for (int i = 0; i < _tileEffects.Length; i++)
            {
                if (_tileEffects[i].groundType != groundType)
                {
                    continue;
                }

                return(true);
            }

            return(false);
        }
Exemple #4
0
        public void SetGroundType(TileData.GroundType newType)
        {
            _tileData.groundType = newType;
            var tileLibrary = SkinResources.Instance.GetTileLibrary();

            _renderer.material = tileLibrary.GetMaterial((int)_tileData.groundType);

            if (tileEffect != null)
            {
                Destroy(tileEffect);
            }

            if (tileLibrary.HasTileEffects(_tileData.groundType))
            {
                GameObject effect = tileLibrary.GetParticleEffect(_tileData.groundType);
                tileEffect = Instantiate(effect, transform);
            }
        }
Exemple #5
0
        public void ParseGroundTypeChange(Tile tile, TileData.GroundType newGroundType)
        {
            string tileReference = String.Concat(tile.ID, "/", DatabaseConstants.GROUNDTYPE);

            _reference.Child(tileReference).SetValueAsync((int)newGroundType);
        }