public void init(int tileType, BoardManager board) { this.board = board; turnCount = 0; tileObj = GameObject.CreatePrimitive(PrimitiveType.Quad); tileMod = tileObj.AddComponent<TileModel>(); tileMod.init(this, type); }
public TileModel GetRightTile(TileModel from) { TileModel value=null; if(from.fieldPosition.x+1<4) { value = tiles[from.fieldPosition.x+1,from.fieldPosition.y]; } return value; }
public TileModel GetLeftTile(TileModel from) { TileModel value=null; if(from.fieldPosition.x-1>-1) { value = tiles[from.fieldPosition.x-1,from.fieldPosition.y]; } return value; }
public TileModel GetBottomTile(TileModel from) { TileModel value=null; if(from.fieldPosition.y+1<4) { value = tiles[from.fieldPosition.x,from.fieldPosition.y+1]; } return value; }
public TileModel GetTopTile(TileModel from) { TileModel value=null; if(from.fieldPosition.y-1>-1) { value = tiles[from.fieldPosition.x,from.fieldPosition.y-1]; } return value; }
public TilePropertiesWindow(Tile tile, DesignerItem item, Level level) : base() { InitializeComponent(); item.PropertyWindow = this; DataContext = new TileModel(tile, item, level); item.SizeChanged += new SizeChangedEventHandler(item_SizeChanged); }
public void init(int tile_type) { this.tile_type = tile_type; GameObject modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); model = modelObject.AddComponent<TileModel>(); model.init(tile_type, this); orientation = Quaternion.Euler(0f, 0f, (orientation.eulerAngles.z - (90f*Random.Range(0, 4))) % 360f); transform.localRotation = orientation; }
void Validation() { if(model==null) { model = this.GetComponent<TileModel>(); if(model==null) { model = gameObject.AddComponent<TileModel>(); } } if(fieldController==null) { fieldController = this.transform.parent.GetComponent<FieldController>(); } }
public void addTurn(){ this.tiletype = 2; turn = true; S = true; E = true; var modelObject2 = GameObject.CreatePrimitive (PrimitiveType.Quad); model2 = modelObject2.AddComponent<TileModel> (); model2.init (x, y, 2, this, modelObject2); }
public void addPit(){ this.tiletype = 3; pit = true; var modelObject2 = GameObject.CreatePrimitive (PrimitiveType.Quad); modelObject2.tag = "pit"; model2 = modelObject2.AddComponent<TileModel> (); MeshCollider mc = modelObject2.GetComponent<MeshCollider> (); mc.enabled = false; BoxCollider bc = modelObject2.AddComponent<BoxCollider> (); bc.size = new Vector3(.1f, .1f, 3); Rigidbody rb = modelObject2.AddComponent<Rigidbody> (); rb.useGravity = false; rb.isKinematic = false; model2.init (x, y, 3, this, modelObject2); }
bool Validation() { if(model==null) { model = this.GetComponent<TileModel>(); if(model==null) { model = gameObject.AddComponent<TileModel>(); } } if(valueText==null) { model = this.GetComponent<TileModel>(); if(model==null) { model = gameObject.AddComponent<TileModel>(); } } if(spriteRenderer==null) { spriteRenderer = this.GetComponent<SpriteRenderer>(); } if(spriteRenderer==null) { spriteRenderer = gameObject.AddComponent<SpriteRenderer>(); } return true; }
public void addEmptyTexture(){ var modelObject1 = GameObject.CreatePrimitive (PrimitiveType.Quad); model1 = modelObject1.AddComponent<TileModel> (); model1.init (x, y, 1, this, modelObject1); }
private TileModel CreateTile() { TileModel tile = new TileModel(); tile.PositionInBoard = m_tilesModel.Count; return tile; }
public void SetModel(TileModel _tileModel) { m_tileModel = _tileModel; }
/// <summary> /// Setups the tile view. Load and cache the tileView prefab. Instantiate TilesView to the scene /// </summary> /// <param name="_tileModel">The _tile model.</param> private void SetupTileView(TileModel _tileModel) { if(m_prefabTileView==null) { m_prefabTileView = Resources.Load<GameObject>(TILE_PREFAB_NAME); } GameObject tileGameObject = Instantiate(m_prefabTileView); tileGameObject.GetComponent<Transform>().SetParent(transform); tileGameObject.name = typeof(TileView).Name; TileController tileController = tileGameObject.GetComponent<TileController>(); tileController.SetModel(_tileModel); tileController.Initialize(); TileView tileView = tileGameObject.GetComponent<TileView>(); tileView.Initialize(tileController); m_TilesView.Add(tileView); }
public bool isTileInSamePosition(TileModel tile, TileModel other) { var distance = figureVectorDistance(new float[] { tile.X, tile.Z }, new float[] { other.X, other.Z }); return(distance < 0.00005f); }
public StairModel(TileModel _startTile, TileModel _endTile) : base(_startTile, _endTile) { StartTile = _startTile; EndTile = _endTile; }
public TeleporterModel(TileModel _startTile, TileModel _endTile) { StartTile = _startTile; EndTile = _endTile; }
public MoveAction(ActorModel who, TileModel where) { Who = who; Where = where; }