Example #1
0
	//Function called when painting with logic tile
	public void Eval(TileLogicScript logic, LogicEvalInfo info, bool u, bool d, bool l, bool r, bool ul, bool ur, bool dl, bool dr) {
		info.Adjust(tname, x + 1, y + 1);

		if (!u) {
			if (!l) info.Adjust(tname, x, y);
			else if (!r) info.Adjust(tname, x + 2, y);
			else info.Adjust(tname, x + 1, y + (dl ? 0 : ul ? 2 : 0));
		} else if (!d) {
			if (!l) info.Adjust(tname, x, y + 2);
			else if (!r) info.Adjust(tname, x + 2, y + 2);
			else info.Adjust(tname, x + 1, y + 2);
		} else if (u) {
			if (!l) info.Adjust(tname, x, y + 1);
			else if (!r) info.Adjust(tname, x + 2, y + 1);
		}	

		if (u && d && l && r) {
			if (!ul) info.Adjust(tname, x + 3, y);
			else if (!ur) info.Adjust(tname, x + 4, y);
			else if (!dl) info.Adjust(tname, x + 3, y + 1);
			else if (!dr) info.Adjust(tname, x + 4, y + 1);
		}

		if (u && d && l && r && ul && ur && dl && dr) {
			info.Adjust(tname, x + 1, y + 1); //middle!
		}

	}
Example #2
0
        public SetTileAction Evaluate(int x, int y)
        {
            try {
                MockupTile tu  = EditorEngine.Instance.CurrentMap.GetTile(x, y - 1, EditorEngine.Instance.SelectedLayer);
                MockupTile td  = EditorEngine.Instance.CurrentMap.GetTile(x, y + 1, EditorEngine.Instance.SelectedLayer);
                MockupTile tl  = EditorEngine.Instance.CurrentMap.GetTile(x - 1, y, EditorEngine.Instance.SelectedLayer);
                MockupTile tr  = EditorEngine.Instance.CurrentMap.GetTile(x + 1, y, EditorEngine.Instance.SelectedLayer);
                MockupTile tul = EditorEngine.Instance.CurrentMap.GetTile(x - 1, y - 1, EditorEngine.Instance.SelectedLayer);
                MockupTile tur = EditorEngine.Instance.CurrentMap.GetTile(x + 1, y - 1, EditorEngine.Instance.SelectedLayer);
                MockupTile tdl = EditorEngine.Instance.CurrentMap.GetTile(x - 1, y + 1, EditorEngine.Instance.SelectedLayer);
                MockupTile tdr = EditorEngine.Instance.CurrentMap.GetTile(x + 1, y + 1, EditorEngine.Instance.SelectedLayer);

                bool u  = isSameType(tu);
                bool d  = isSameType(td);
                bool l  = isSameType(tl);
                bool r  = isSameType(tr);
                bool ul = isSameType(tul);
                bool ur = isSameType(tur);
                bool dl = isSameType(tdl);
                bool dr = isSameType(tdr);

                LogicEvalInfo _info = new LogicEvalInfo("", 0);
                script.Invoke("Eval", this, _info, u, d, l, r, ul, ur, dl, dr);

                int        zt = EditorEngine.Instance.SelectedLayer;
                MockupTile t  = EditorEngine.Instance.CurrentMap.GetTile(x, y, zt);
                if (t == null)
                {
                    return(null);
                }

                SetTileAction act = new SetTileAction(x, y, zt, EditorEngine.Instance.World.TilesetContainer.IndexOf(EditorEngine.Instance.GetTilesetByName(_info.s1)), _info.s2);

                return(act);
            } catch (Exception e) {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("-- Error (" + e.GetType() + "): " + e.Message);
                //GameConsole.WriteLine("Info: " + e.Value.Value);
                Console.WriteLine("\r\n\r\n");
                Console.ResetColor();
            }
            return(null);
        }
Example #3
0
		public SetTileAction Evaluate(int x, int y) {
			try {
				MockupTile tu = EditorEngine.Instance.CurrentMap.GetTile(x, y - 1, EditorEngine.Instance.SelectedLayer);
				MockupTile td = EditorEngine.Instance.CurrentMap.GetTile(x, y + 1, EditorEngine.Instance.SelectedLayer);
				MockupTile tl = EditorEngine.Instance.CurrentMap.GetTile(x - 1, y, EditorEngine.Instance.SelectedLayer);
				MockupTile tr = EditorEngine.Instance.CurrentMap.GetTile(x + 1, y, EditorEngine.Instance.SelectedLayer);
				MockupTile tul = EditorEngine.Instance.CurrentMap.GetTile(x - 1, y - 1, EditorEngine.Instance.SelectedLayer);
				MockupTile tur = EditorEngine.Instance.CurrentMap.GetTile(x + 1, y - 1, EditorEngine.Instance.SelectedLayer);
				MockupTile tdl = EditorEngine.Instance.CurrentMap.GetTile(x - 1, y + 1, EditorEngine.Instance.SelectedLayer);
				MockupTile tdr = EditorEngine.Instance.CurrentMap.GetTile(x + 1, y + 1, EditorEngine.Instance.SelectedLayer);

				bool u = isSameType(tu);
				bool d = isSameType(td);
				bool l = isSameType(tl);
				bool r = isSameType(tr);
				bool ul = isSameType(tul);
				bool ur = isSameType(tur);
				bool dl = isSameType(tdl);
				bool dr = isSameType(tdr);

				LogicEvalInfo _info = new LogicEvalInfo("", 0);
				script.Invoke("Eval", this, _info, u, d, l, r, ul, ur, dl, dr);

				int zt = EditorEngine.Instance.SelectedLayer;
				MockupTile t = EditorEngine.Instance.CurrentMap.GetTile(x, y, zt);
				if (t == null) return null;

				SetTileAction act = new SetTileAction(x, y, zt, EditorEngine.Instance.World.TilesetContainer.IndexOf(EditorEngine.Instance.GetTilesetByName(_info.s1)), _info.s2);

				return act;
			} catch (Exception e) {
				Console.ForegroundColor = ConsoleColor.Red;
				Console.WriteLine("-- Error (" + e.GetType() + "): " + e.Message);
				//GameConsole.WriteLine("Info: " + e.Value.Value);
				Console.WriteLine("\r\n\r\n");
				Console.ResetColor();
			}
			return null;
		}
Example #4
0
	public void Eval(TileLogicScript logic, LogicEvalInfo info, bool u, bool d, bool l, bool r, bool ul, bool ur, bool dl, bool dr) {
		info.Adjust(tname, x, y);
	}