Example #1
0
	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);
	}
Example #2
0
 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;
 }
Example #3
0
 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;
 }
Example #4
0
 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;
 }
Example #5
0
 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);
 }
Example #7
0
	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;
    }
Example #8
0
 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>();
     }
 }
Example #9
0
	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);

	}
Example #10
0
	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);
	}
Example #11
0
    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;
    }
Example #12
0
	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;
 }
Example #19
0
 public MoveAction(ActorModel who, TileModel where)
 {
     Who   = who;
     Where = where;
 }