From da7a7822d446de05d744116e4ef5f3898b36b329 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 May 2020 01:55:52 +0200 Subject: [PATCH 1/6] ProductionRate --- Game1/Content/Content.mgcb | 84 ++++++++++++++++ Game1/Content/MaizeIcon.png | Bin 0 -> 1955 bytes Game1/Content/MilletsIcon.png | Bin 0 -> 2338 bytes Game1/Content/PaddyIcon.png | Bin 0 -> 2951 bytes Game1/Content/PulsesIcon.png | Bin 0 -> 2130 bytes Game1/Content/SeedOilIcon.png | Bin 0 -> 631 bytes Game1/Content/SugarcaneIcon.png | Bin 0 -> 1729 bytes Game1/Content/TobaccoIcon.png | Bin 0 -> 747 bytes Game1/Game1.cs | 44 ++++++--- Game1/Sources/Controlls/Controller.cs | 2 +- Game1/Sources/Crops/Crops.cs | 129 ++++++++++++++++++------- Game1/Sources/Crops/Farm.cs | 9 +- Game1/Sources/Crops/SoilProperties.cs | 9 +- Game1/Sources/Objects/DayNightCycle.cs | 2 +- 14 files changed, 220 insertions(+), 59 deletions(-) create mode 100644 Game1/Content/MaizeIcon.png create mode 100644 Game1/Content/MilletsIcon.png create mode 100644 Game1/Content/PaddyIcon.png create mode 100644 Game1/Content/PulsesIcon.png create mode 100644 Game1/Content/SeedOilIcon.png create mode 100644 Game1/Content/SugarcaneIcon.png create mode 100644 Game1/Content/TobaccoIcon.png diff --git a/Game1/Content/Content.mgcb b/Game1/Content/Content.mgcb index 73c3ac3..c286d3c 100644 --- a/Game1/Content/Content.mgcb +++ b/Game1/Content/Content.mgcb @@ -68,6 +68,18 @@ /processorParam:TextureFormat=Color /build:house.png +#begin MaizeIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:MaizeIcon.png + #begin Markers.png /importer:TextureImporter /processor:TextureProcessor @@ -80,6 +92,18 @@ /processorParam:TextureFormat=Color /build:Markers.png +#begin MilletsIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:MilletsIcon.png + #begin Mountain.png /importer:TextureImporter /processor:TextureProcessor @@ -104,6 +128,18 @@ /processorParam:TextureFormat=Color /build:MouseCursor.png +#begin PaddyIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:PaddyIcon.png + #begin Plantable.png /importer:TextureImporter /processor:TextureProcessor @@ -152,6 +188,42 @@ /processorParam:TextureFormat=Color /build:ProgressionBarStatus.png +#begin PulsesIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:PulsesIcon.png + +#begin SeedOilIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:SeedOilIcon.png + +#begin SugarcaneIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:SugarcaneIcon.png + #begin Tile.png /importer:TextureImporter /processor:TextureProcessor @@ -176,6 +248,18 @@ /processorParam:TextureFormat=Color /build:tileunplantable.png +#begin TobaccoIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:TobaccoIcon.png + #begin Tractor.png /importer:TextureImporter /processor:TextureProcessor diff --git a/Game1/Content/MaizeIcon.png b/Game1/Content/MaizeIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..65d19b71a356a928f93fed9261c4fbe2626eacb0 GIT binary patch literal 1955 zcmV;U2VD4xP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&2RKPYK~#8N?VQ1m z8$}dF%NZtQk_<3QBou@MLM&LZU^|~Oe*`~(k{`%|FBpj(E231Cx$6dd?`RKQxNgnAaRv6twR&y>53W`U%pPU%06q-gczdD5FwpHWD%@;^{$H=wnvg zPzt1sct5`_=hXMgLY5Zx*?Z1iY{`jcDg{_yDH&vKA%m%qeEPz?r%+|2KF34I5@ykTM@XG#NuJtRNeWAxV&k$G4sP%uBd7 zb?%GjVZ)Z8wXnjhC1kSf{Xhg0@#R0x-FVY)T@fZ*7Z@r$B^8pBCn1jyFGb)DLk58q ztmgoqn0=Wel@2^>EiMzA3qdMg`(no;WZ`8>&h}@|0kbI?iM56F+7@Ks=+}^imnp%R zf`2zM3nzp`YejNh!E}Jl67t3uSf*kKrUd(A_9fWLv7``J5;9N8=VA6VbkyVg1KXb7 zxD;U|C4*=(3a0~XmJp&G^_|~bOgF~a9 zTUbviO4}MOB`A2@s-%Q%7(*7?77F~UKWj(PAt)|5W@T9apBIPqO555B3Z^ArLI4Up z73U^e!69PeML}BPdP((^Xa!!DjzWpqSjf`BJqCgxinA~)v#nK&uC=y|Nf7o0NRWls#AKwb5KMbzO5$+?a$aHCKOhC$0cK^O#ywmt zu6DG`!c)x9{uwADWZt%L2Rw?7lyK&RaYNo%M+x#rvU&4_g?qSU;iaHLluZcJfoIN~ zaQ6wo_<{AjSIhtDuBFr_KGOM`iQuxNP&z;{A@h{PgL!u^m;XQmdc(c)cC(=C|9kWhN?`1QcmoTCwAF@LBHb*X5k@f}%o_ zDIt&oxDClcO60!EjH?K;@Ufsu=>X*u0+)J+JGM?0pr_~4L)503}8K>*;`QY$5rCBkygus}5- z^OOJ{?U>p^0*XzzjbAi!Yyqj3w<%iTWjZP*rD{S}8sOR1Z~_Sd*bfro@5MY>2lu$> zL+L0;{gy?Bj&{ttaFvnCfdqUnR*InnR7?k`E~J+dq(B1$J0$QZg}j5%!gieT5(4-& zN(_>NcXs%C_R9wn_ice<=Ojo*<#d2ig!BgZ7|6gFg0E3*ZaaY#oVtNUr9U7^Ta2@rzdcBcIJ+bj>4DIA literal 0 HcmV?d00001 diff --git a/Game1/Content/MilletsIcon.png b/Game1/Content/MilletsIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..30c4dcf6f2c2f3eb8dddebb8b06dd4b5616cddac GIT binary patch literal 2338 zcmV+-3ElRIP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&2)9W@K~#8N?VN3h zR8<(q&+6(brWKMEnGk3O)dwXKK|vx=68lgI5w&FIhc&RWz+I@!2(2#}g07{DAk~Kq zzes@}dI5uq$f&F+1;aFRi?V{+^=+H~?0uZav*+AUS-kmz@nWWBN4FxAkc;?W!xYzl>z#hLvK)LyN_N`L|ReYk_#@ zjpuUPhh|g@^3AtLv$J7d-SMTkZSIY^MqVn3c$o4oe2!FGm&H^Qhv~qn0!@Wyz3X zeykV;z+jXz05>$yr6YMKMWXO}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&Bn=!&XF}`q>hKxERPsM4$TE5`wrGs8PGbRMa&zYL}P`<2)()Duf!~bT*=5F05JEWqX zgX`V8Pj*Ox)aoVzaY(ZEx)dZi*IP&(Alo8NknLxZHnX!yM(ePJDj*j4sj|rp8x;=07*qo IM6N<$f<}r$_y7O^ literal 0 HcmV?d00001 diff --git a/Game1/Content/PaddyIcon.png b/Game1/Content/PaddyIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..cac6ba54c20c5a2a2f2367108e895f1bbcbbae9a GIT binary patch literal 2951 zcmV;23wZR2P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&3mi#AK~#8N?OSWC zTvZibGk0e0+)J&J{tysjO~|#sl#mdk(P(^x zf|AzM#3+e?0wFOHVg!xiA8JIcua;_Vv{ibaGvofwoPF+|HEX|S&di)U_k79fo!NWs zefD18dhBz~v_eE3B_#@iYWlZCL6AjAr&9*XBvGk=3Py--EHPe~wl7mw!B7%XFqDK8 z3?(52LrF-%kjp9S^0!s!`U5lc%8Szm0jK{?^x&a3J^q7s+EPNpw0$mw9C^CtBqIbb zEmr8hJ6iPc(XB^V?u1;mr%KoC8%_4x3XwH1Av`si#&Sjpt}qzaR!kF70}~RSn$$dM zz8Df}N_oAzlqgICF{bUK^320WLN_gu0g}>>0!%XIT2uU6o&sAxyuDsH(?tz*> zAYu8Oii$b)!7=}|7WL@ln~>3Pkde?E3OOR0^F*twl%%KceoZzwqVux{tMs1T(^Efy z=-nLuS^B{S3sKAG2q3$ft8|C7O?N5 zv-IUprWR8;F~61-;7}mtJoRXsUUzAQUbS4O4=*&5c0JdHFV*O-FShC4AF5DE(Nrpj z_s!AUKSX`kTU{Z#a$!CFwz&{pL!@U_%m1m+Wz?XHmS?)(mECSQw44|agni=1s+%NS zHN70l$T#=3Y4^e`U43P5w46BArrW-~Lf?60V=mkLNB35G^fn8k2)W`-HTwJm73$0- zYEIz(;dhS^?fq1j6dgr95tI;-UA6~^n#E_T^yxP@)0P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2YqG8B-Lpl{4{a@o8r&NfYp;Jf-tn%q zwIDH43PMor3ln>2Nxaiem3a;rH)49c!raKs} zdkA1?H^8mEVj|)9)A+4F0K*@M2?rLgUtV_>;R>!TYV1*vWG1T(sdZqLj2LhpNPS*p4wysr?`J3I~gE>En;39c2gZ1`bg-70TY*F>-t zl1GeKNGl>@jSF{YKJY4t$!^kkXRqkwppj=Oct?^&_meBUSeIAJaR2YBRhG2sc@I}ab_d9Q-dU}j;m z8$5waaA$=!`1!|Tq6P6P2n}Wyy48UUBwO2U+r>ZwSKf#PuYzO+(-zb3qsuuQB$=L71+G!3XVFsijXw+!3Aj+vP9vm2$zC55TZP<#vTPp=8{>_FQO%< z`pGJAS{c3-n-Y8NWRONh(6x3EMv1+4GD!RLM6Ce2*31`AwvEQV&>WHk+zNU>(u&a7 zM^!p8fhY8Kp(zAuCkhqBrPkFh6e@^It*f1=%k&}J)-4meskAnb%707*qo IM6N<$f&*pyX#fBK literal 0 HcmV?d00001 diff --git a/Game1/Content/SeedOilIcon.png b/Game1/Content/SeedOilIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..0ae6fb428028df8508837342c5444a618767134f GIT binary patch literal 631 zcmeAS@N?(olHy`uVBq!ia0vp^DIm z8;@L*a0R1qO47t2mCTm1`#$%lOGrOnUpw<|tHb@$yAOXTcPxLnU7=3>NkKtC)T`ef zhMYye7GE=stKP07(R@IH<(Ps2TcaUIk7EK4Q?kGell52be?Nct^3B`tvMWyI?)mmZ zp}uv-DLJ*X(dxxXEj#~DZ%hX%zTo(59&ae$_XjO7GaT7he)*NOPDuC>x3ezPR35Vv zV)+pZ&$NVazL>_EEC94op*iQP1HT`K&q@VRwbPtHt9kTJOymCoHfUMQgg4Rign3NSh=-bYeABCJOWE-+@6oNGOxUKVvb2L3aZ!?F>XG_F+<^@Aoom5HwRYE?>ZUZBpAh2 z{-h^rAK~cm-+$le`QPPSipR41`HG6PeWtGT5MQ$E<1OX$6LgK?F6fS)c5COZZ(Rp< extG4)$0)FH+Q+8b@+*Ofg~8L+&t;ucLK6Ui2me3- literal 0 HcmV?d00001 diff --git a/Game1/Content/SugarcaneIcon.png b/Game1/Content/SugarcaneIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..e2f173b05d77516c9b1bc271c64e16a9350d9a27 GIT binary patch literal 1729 zcmV;y20rPx#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&23AQ#K~#8N?VCML z9Z3*?hm9aI(k6sxBZ9pEHz4rJS0Jzi9D$HiKt@PxttGC&5r_;Kq|V6Lt;dvIF85z` zRrho^^GPG#!%WXief87tN#2^K>Gl6(r4jy^f37sbj|zExT?=JNwzfb86N0~7sSAz$ z+OisB719{Px2(Uue4JlR)3;Aw=T~h(V?VSIDudFRn0G%ze4<)l*a`^+-MT{fwWRC6 zi)p%{D#Z${LOd)OPDrSQ zlxS7F0+HNntse}Huxg7#4Ry>~+CDH)C91=99YA`m;fK1fjaWciBE1gE(TX3YLTb+r z7rECNzCub7l3~RVLTXe;Oor8U)(SDevL$ve1Tq&tn9&2MRUI)T=XXEUOSdarA0)eW zZn10d`*Z#MFhjkx430$w#;RqVApvOc@H2<2N__Z&ACh7!|vw7>r|gW&b$E1&$;tfNH>}!L>FNM5fLuzB3@O<{uCK3utBiw# zgCDJnw=m1L70O@@G@w2yxuhmbmJq0py}iBpT^bf`3j;=jg#pu6N2t{Rn(C0;n^*|8 zsvInLTM#Tfw1k2Q>(^*ih**fLRi&b7TUHrZ8|l4?zsrKZ(~$FhSu6uJLbPk+`Fz%- zR2Gu`T^6*fR z0c6b(8hrR_BzLD}MXn4Vv^qk>l0-|A5I)S|ed+I~NJKKy{s+ zoz3t3{Q3Fs`PENSTZ#{@3^?C6cQi6YGlb6$4XH9pWid+jwWrX!u6vTqoe-iKLM!9$ z?rwf114O_DQ)I-*eQ*dU2G6zK%~{t%1}7@y;^JcS6M}kpc(@6y^pJ>%RYwkVO_!8d zKtuOrDFcYMtlE@#_?YC-x|(xS5w)zE#2!9})@5*-5)vZk;jID+?F|p4gbbh=As9UR z@H7Cm;W9%T0!x~iA)#!}$wvA)27^fnty#NOH8(?I0gwXgfdrb>G_y4UE!C=!=4XgD z04T;)B`&NhRm$Q*XaFqchNj(ES85K6&k+8d70qO6MwXOOvO1cXAs7T{Td7TrR)s9y zvV0Pjs19tI+P0}-F(I)4N`SROL6o#AUa2*!188EG#j`Ru2-@uC)mmEyu*guSEdt5S z%2=gIs)JKY2#x)sLR`Ez8Ni~utXLpgpr#B?RUwvHS+Y8oq=}&}rKF4{s{^Pega?A} zh9rT=-A&;=;Q5++C`Hu@@dZKx1QmB=xk06$HMI9*O_g01%}l=62U0WB)ow7Dux@A_ z*SVA>t7EZUmP>{fn(aPXmcc15#3~p)1yw`!T~VKLU1>Qhb5!Q;Ft>024$3> zYG`Jc1u}Bx4S*u?e7;UkBF$!qE4v{m*s@Zqg9eheJKy;uR8{dA!ZS1m4XSJI9)aw$GgzAFKGs1A-v%hI%s-2XeyuStc#T0P02u~!Rm$)Ht|QXM>) zNU97My$Ug#A=oykj1V-a@VBwQm(Y_8j;cavP(cI_YD#tZ$gPeZWfZ9pNrta7{A3F$ z71UH{i^MiL0%k3XW1ZzAR|k!~N(jP(waSoTE+hw6kX?a|$pBU%#$eDxLR@nKHWIzd z0GboxWAs*q(AXFGa&aY}rYi(Voj1MGP0Ml-nm4`DwU80<3Rzi>--N8R!Me+8ifQ@} XY#PIgbTVum00000NkvXXu0mjf!U_~5 literal 0 HcmV?d00001 diff --git a/Game1/Content/TobaccoIcon.png b/Game1/Content/TobaccoIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..9a2b8df83788f4f8423e6e946893e1439ed89bab GIT binary patch literal 747 zcmeAS@N?(olHy`uVBq!ia0vp^DImnOr`O^7Mbe;Qt@TE#iNyX1M_oqppn>Tgq1xe)%0zHKdHZS;+lT>}DHZ5eBnfWP2 zXTg#r4F|QV9m~=JbPPlk7Kh!HR2I?ZIa(jt9G2L#X~xZhZ*wN>+iP%)vFH?cTbA4r z;kGQPBhqbIVn>wQvV@Lkw`K7iF>cG^I%3_H#kPcn=PHYbro^hM36l&$t|}}|T#@DI zbtE9PX-e0^Rm_@_&Y`S9R&A@;may@JvU=!Btg4tW%OK>U!q&tUNsd`Z0$iJ}bS>;+ zUMcA;${J+drp2~|l_!+NLtEmMt%tY7DN~PZiBq~B-4dr%JyuJclJz((aZ1$VwZti2 z4vFb84GkZ!zEeoJvt64*;{I)3mY$bojEu?q&N?2bxU)oNG2TRW%)!0|wje>Dz0tSz`m?EuH3?6aYDS97fQ(n7bs;PO2!KLnf&c_b3A6~Y^ zJC@^mdyW^A;%|mRXmnd}3#2nX(s7u>+OZiS=q-PF-u|5epIO;9z5dntleeYj$f=^x b>wnpseHC4_T7y)836#Op)z4*}Q$iB}$Hysb literal 0 HcmV?d00001 diff --git a/Game1/Game1.cs b/Game1/Game1.cs index eb3a5f7..a1372d0 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -14,7 +14,7 @@ namespace Game1 SpriteBatch spriteBatch; SpriteFont Bold; private Texture2D[] tile = new Texture2D[5]; - private Texture2D[] Crops = new Texture2D[5]; + private Texture2D[] Crops = new Texture2D[11]; private Texture2D tractor; private Texture2D house; private Texture2D markers; @@ -95,13 +95,23 @@ namespace Game1 tile[0] = Content.Load("Mountain"); tile[1] = Content.Load("tileunplantable"); tile[2] = Content.Load("Plantable"); - tile[3] = Content.Load("Planted"); - tile[4] = Content.Load("Crop"); + tile[3] = Content.Load("Crop"); Crops[0] = Content.Load("CarrotIcon"); Crops[1] = Content.Load("WheatIcon"); - Crops[2] = Content.Load("BerriesIcon"); //Replace 2 and 3 with the new crop Textures - Crops[3] = Content.Load("TreePlantationIcon"); + Crops[2] = Content.Load("BerriesIcon"); + + + + Crops[3] = Content.Load("MaizeIcon"); + Crops[4] = Content.Load("MilletsIcon"); + Crops[5] = Content.Load("SeedOilIcon"); + Crops[6] = Content.Load("PaddyIcon"); + Crops[7] = Content.Load("PulsesIcon"); + Crops[8] = Content.Load("SugarcaneIcon"); + Crops[9] = Content.Load("TobaccoIcon"); + Crops[10] = Content.Load("WheatIcon"); + ProgressionBar = Content.Load("ProgressionBar"); ProgressionBarStatus = Content.Load("ProgressionBarStatus"); @@ -217,6 +227,9 @@ namespace Game1 for (int j = 0; j < input.getSize().Y; j++) { Rectangle tilePos = new Rectangle(i * (input.getSpacingTile()), j * (input.getSpacingTile()), input.getTileSize(), input.getTileSize()); + + + spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Time.GetTimeOfDay()); if (tilePos.Intersects(mousePosition)) { @@ -232,15 +245,22 @@ namespace Game1 x = i; y = j; } + if (tractorUnit.getFarm().getCrop(i, j).getStatus() != 0 && tractorUnit.getFarm().getCrop(i, j).getStatus() != 1) + { + spriteBatch.Draw(Crops[tractorUnit.getFarm().getCrop(i, j).getCropType()], new Rectangle(i * input.getSpacingTile(), j * input.getSpacingTile(), input.getTileSize(), input.getTileSize()), Color.White); + } } - if ((tractorUnit.getFarm().getCrop(i, j).getStatus() == 4)) + else { - spriteBatch.Draw(ProgressionBar, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 3, j * (input.getSpacingTile()), input.getTileSize() / 3, input.getTileSize()), Color.White); - spriteBatch.Draw(ProgressionBarStatus, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 4, j * (input.getSpacingTile()) + input.getTileSize() / 3, input.getTileSize() / 4, tractorUnit.getFarm().getCrop(i, j).getCropTimerBar((input.getTileSize())) + 1), Color.White); - } - if (tractorUnit.getFarm().getCrop(i, j).getStatus() != 0 && tractorUnit.getFarm().getCrop(i, j).getStatus() != 1) - { - spriteBatch.Draw(Crops[tractorUnit.getFarm().getCrop(i, j).getCropType()], new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 3, j * (input.getSpacingTile()), input.getTileSize() / 3, input.getTileSize() / 3), Color.White); + if (tractorUnit.getFarm().getCrop(i, j).getStatus() != 0 && tractorUnit.getFarm().getCrop(i, j).getStatus() != 1) + { + if ((tractorUnit.getFarm().getCrop(i, j).getStatus() == 3)) + { + spriteBatch.Draw(ProgressionBar, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 3, j * (input.getSpacingTile()), input.getTileSize() / 3, input.getTileSize()), Color.White); + spriteBatch.Draw(ProgressionBarStatus, new Rectangle(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 4, j * (input.getSpacingTile()) + input.getTileSize() / 3, input.getTileSize() / 4, tractorUnit.getFarm().getCrop(i, j).getCropTimerBar((input.getTileSize())) + 1), Color.White); + } + spriteBatch.Draw(Crops[tractorUnit.getFarm().getCrop(i, j).getCropType()], new Rectangle((int)(i * (input.getSpacingTile()) + input.getTileSize() - input.getTileSize() / 2.5), j * (input.getSpacingTile()), (int)(input.getTileSize() / 2.5), input.getTileSize() / 3), Color.White); + } } } diff --git a/Game1/Sources/Controlls/Controller.cs b/Game1/Sources/Controlls/Controller.cs index 08817cf..7f6cce5 100644 --- a/Game1/Sources/Controlls/Controller.cs +++ b/Game1/Sources/Controlls/Controller.cs @@ -59,7 +59,7 @@ class Controller public int controllSpeed(int Speed) { KeyboardState state = Keyboard.GetState(); - if (state.IsKeyDown(Keys.Right)) + if (state.IsKeyDown(Keys.Right) && Speed < 350) { Speed++; } diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 6230d6e..04e14b2 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -13,21 +13,34 @@ class Crops private int originalStatus; private int cropType = 0; private int Timer = 1; + private int UpdateCrop; private int fullTimer; private bool housePos = false; private Vector2 Size; + private CropTypes DataSet; SoilProperties soilProperties = new SoilProperties(); public void updateCrop(Vector2 newSize) { - - if (Status == 4 && Timer != 1) + if (Status == 3 && Timer != 1) { Timer--; } Size = newSize; + UpdateCrop++; + if (UpdateCrop == 60) + { + degradeSoil(); + UpdateCrop = 0; + } + + } + + public SoilProperties getSoilProperties() + { + return soilProperties; } public int getCropTimer() @@ -47,8 +60,6 @@ class Crops soilProperties.setSoilProperties(); } - - // Changes the time required for the crops to be harvestable public void setCropTimer() { @@ -84,7 +95,7 @@ class Crops { return 8; } - else if (Status == 3) //crops + else { if (cropType == 0) { @@ -103,36 +114,36 @@ class Crops return 50; //Fruit Trees } } - else //Harvestable Crops + } + + public void degradeSoil() + { + + if (soilProperties.Nitrogen > 4.0f) { - if (cropType == 0) - { - return 30; //Carrots - } - else if (cropType == 1) - { - return 40; //Wheat - } - else if (cropType == 2) - { - return 50; //Berries - } - else - { - return 100; //Fruit Trees - } + soilProperties.Nitrogen = soilProperties.Nitrogen - soilProperties.NitrogenDegradeRate; } + if (soilProperties.Phosphorous > 0.1f) + { + soilProperties.Phosphorous = soilProperties.Phosphorous - soilProperties.PhosphorousDegradeRate; + } + if (soilProperties.Potassium > 0.1f) + { + soilProperties.Potassium = soilProperties.Potassium - soilProperties.PotassiumDegradeRate; + } + } - public void setCropType(int Type) + public void setCropType(int Type, CropTypes nCropType) { + DataSet = nCropType; cropType = Type; } public int getStatus() { - if (Status != 4) + if (Status != 3) { return Status; } @@ -176,6 +187,47 @@ class Crops return housePos; } + public float getProductionRate() + { + if (DataSet != null) + { + int ProductionRate = 100; + ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature)); + ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Moisture , DataSet.Moisture)); + ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Humidity , DataSet.Humidity)); + ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Phosphorous , DataSet.Phosphorous)); + ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Potassium , DataSet.Potassium)); + ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Nitrogen , DataSet.Nitrogen)); + if (ProductionRate < 0) + { + return 0; + } + else + { + return ProductionRate; + } + + } + else + { + return 0; + } + } + + public float compareToDatset(float i, float j) + { + if (i < j) + { + return (i / j) * 0.2f; + } + else + { + return i / j; + } + + } + + public void Inspect(int tileSize, int Spacing, SpriteFont Bold, SpriteBatch spriteBatch, string[] cropTypesNames) { spriteBatch.Begin(); @@ -196,17 +248,13 @@ class Crops spriteBatch.DrawString(Bold, "Tiletype: Soil", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); } else if (Status == 3) - { - spriteBatch.DrawString(Bold, "Tiletype: Planted", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); - } - else if (Status == 4) { int x = (int)(((float)Timer / fullTimer) * 100); x = 100 - x; spriteBatch.DrawString(Bold, "Tiletype: Crop ", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); spriteBatch.DrawString(Bold, "Completion: " + x + "%", new Vector2(240, Size.Y * (tileSize + Spacing) + 82), Color.DarkBlue); } - if (Status != 4) + if (Status != 3) { spriteBatch.DrawString(Bold, "-------------", new Vector2(240, Size.Y * (tileSize + Spacing) + 82), Color.DarkRed); } @@ -219,13 +267,22 @@ class Crops spriteBatch.DrawString(Bold, "None", new Vector2(240, Size.Y * (tileSize + Spacing) + 62), Color.DarkBlue); } spriteBatch.DrawString(Bold, "Soil Properties:", new Vector2(240, Size.Y * (tileSize + Spacing) + 122), Color.DarkRed); - spriteBatch.DrawString(Bold, "Soil Type: " + soilProperties.soilType, new Vector2(240, Size.Y * (tileSize + Spacing) + 142), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Temparature: " + soilProperties.Temparature, new Vector2(240, Size.Y * (tileSize + Spacing) + 162), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Moisture: " + soilProperties.Moisture, new Vector2(240, Size.Y * (tileSize + Spacing) + 182), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Humidity: " + soilProperties.Humidity, new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Phosphorous: " + soilProperties.Phosphorous, new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Potassium: " + soilProperties.Potassium, new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Nitrogen: " + soilProperties.Nitrogen, new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Soil Type: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 142), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.soilType, new Vector2(370, Size.Y * (tileSize + Spacing) + 142), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Temparature: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 162), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Temperature.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 162), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Moisture: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 182), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Moisture.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 182), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Humidity: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Humidity.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Phosphorous: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Phosphorous.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Potassium: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Potassium.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Nitrogen: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Nitrogen.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Production Rate: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 282), Color.DarkRed); + spriteBatch.DrawString(Bold, getProductionRate().ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue); spriteBatch.End(); } } diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index ed4b416..09d2d6d 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -35,7 +35,8 @@ class Farm crops[i, j] = new Crops(); crops[i, j].setStatus(x); crops[i, j].setOriginalStatus(); - crops[i, j].setCropType(x = r.Next(0, 4)); + x = r.Next(0, 11); + crops[i, j].setCropType(x, PresetCrops.getPresetCropTypes(x)); crops[i, j].init(); } } @@ -58,7 +59,7 @@ class Farm { int x = (int)xfloat; int y = (int)yfloat; - if (crops[x, y].getStatus() >= 4) + if (crops[x, y].getStatus() >= 3) { crops[x, y].setStatus(2); } @@ -69,10 +70,6 @@ class Farm else if (crops[x, y].getStatus() == 2) { crops[x, y].setStatus(3); - } - else if (crops[x, y].getStatus() == 3) - { - crops[x, y].setStatus(4); crops[x, y].setCropTimer(); } } diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs index 1149557..6b241e7 100644 --- a/Game1/Sources/Crops/SoilProperties.cs +++ b/Game1/Sources/Crops/SoilProperties.cs @@ -11,12 +11,15 @@ class SoilProperties public string soilType = "potato"; - public float Temparature; + public float Temperature; public float Humidity; public float Moisture; public float Nitrogen; public float Potassium; public float Phosphorous; + public float NitrogenDegradeRate = 0.001f; + public float PotassiumDegradeRate = 0.001f; + public float PhosphorousDegradeRate = 0.001f; public void setSoilProperties() { @@ -41,8 +44,8 @@ class SoilProperties { soilType = "Clayey"; } - Temparature = GetRandomNumber(22, 30); - Humidity = Temparature * 2 + GetRandomNumber(1.9, 2.2); + Temperature = GetRandomNumber(22, 30); + Humidity = Temperature * GetRandomNumber(1.9, 2.1); Moisture = GetRandomNumber(20, 70); Nitrogen = GetRandomNumber(4 , 55); Potassium = GetRandomNumber(0, 28); diff --git a/Game1/Sources/Objects/DayNightCycle.cs b/Game1/Sources/Objects/DayNightCycle.cs index e111ea1..2efaa29 100644 --- a/Game1/Sources/Objects/DayNightCycle.cs +++ b/Game1/Sources/Objects/DayNightCycle.cs @@ -12,7 +12,7 @@ class DayNightCycle private int dayTime = 0; private int lengthOfDay = 20000; private int lengthOfNight = 20000; - private int Days; + private int Days = 1; public void updateTime(int Speed) { From 095ccc0fc6611fbf91a592ef962a9d0c9703b657 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 May 2020 13:53:07 +0200 Subject: [PATCH 2/6] Production System fixed --- Game1/Sources/Crops/CropTypesHolder.cs | 2 +- Game1/Sources/Crops/Crops.cs | 57 +++++++++++++------------- Game1/Sources/Crops/Farm.cs | 13 ++++-- Game1/Sources/Crops/SoilProperties.cs | 4 +- 4 files changed, 42 insertions(+), 34 deletions(-) diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs index 1b09922..f63e48b 100644 --- a/Game1/Sources/Crops/CropTypesHolder.cs +++ b/Game1/Sources/Crops/CropTypesHolder.cs @@ -75,7 +75,7 @@ class CropTypesHolder cropTypes[4].Humidity = 57.3f; cropTypes[4].Moisture = 38.5f; cropTypes[4].Nitrogen = 23.2f; - cropTypes[4].Potassium = 0; + cropTypes[4].Potassium = 0.1f; cropTypes[4].Phosphorous = 14.4f; //Oil Seeds diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 04e14b2..357864c 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -12,21 +12,23 @@ class Crops private int Status; private int originalStatus; private int cropType = 0; - private int Timer = 1; + private float Timer = 1; private int UpdateCrop; - private int fullTimer; + private float fullTimer; private bool housePos = false; private Vector2 Size; private CropTypes DataSet; SoilProperties soilProperties = new SoilProperties(); + private float ProductionRate = 0; public void updateCrop(Vector2 newSize) { + getProductionRate(); if (Status == 3 && Timer != 1) { - Timer--; + Timer = Timer - 1 * ProductionRate; } Size = newSize; UpdateCrop++; @@ -35,6 +37,10 @@ class Crops degradeSoil(); UpdateCrop = 0; } + if (Timer < 1) + { + Timer = 1; + } } @@ -43,7 +49,7 @@ class Crops return soilProperties; } - public int getCropTimer() + public float getCropTimer() { return Timer; } @@ -187,38 +193,33 @@ class Crops return housePos; } - public float getProductionRate() + public void getProductionRate() { + ProductionRate = 1; if (DataSet != null) { - int ProductionRate = 100; - ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature)); - ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Moisture , DataSet.Moisture)); - ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Humidity , DataSet.Humidity)); - ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Phosphorous , DataSet.Phosphorous)); - ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Potassium , DataSet.Potassium)); - ProductionRate = (int)(ProductionRate * compareToDatset(soilProperties.Nitrogen , DataSet.Nitrogen)); + ProductionRate = (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature)); + ProductionRate = (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture)); + ProductionRate = (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity)); + ProductionRate = (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous)); + ProductionRate = (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium)); + ProductionRate = (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen)); if (ProductionRate < 0) { - return 0; + ProductionRate = 0; } - else - { - return ProductionRate; - } - - } - else - { - return 0; } } public float compareToDatset(float i, float j) { - if (i < j) + if (i > j) { - return (i / j) * 0.2f; + return (i / j) * 0.15f; + } + else if (i < j / 2) + { + return (i / j) * 2f; } else { @@ -276,13 +277,13 @@ class Crops spriteBatch.DrawString(Bold, "Humidity: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkRed); spriteBatch.DrawString(Bold, soilProperties.Humidity.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue); spriteBatch.DrawString(Bold, "Phosphorous: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.Phosphorous.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round(soilProperties.Phosphorous,1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue); spriteBatch.DrawString(Bold, "Potassium: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.Potassium.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round(soilProperties.Potassium, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue); spriteBatch.DrawString(Bold, "Nitrogen: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.Nitrogen.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round(soilProperties.Nitrogen, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue); spriteBatch.DrawString(Bold, "Production Rate: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 282), Color.DarkRed); - spriteBatch.DrawString(Bold, getProductionRate().ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round((ProductionRate * 100), 1).ToString() + "%", new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue); spriteBatch.End(); } } diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index 09d2d6d..17997d4 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -11,6 +11,7 @@ class Farm private Crops[,] crops; private Random r; private CropTypesHolder PresetCrops = new CropTypesHolder(); + private int Update; //initializes the crops @@ -44,14 +45,20 @@ class Farm public void updateFarm(Vector2 Size) { - for (int i = 0; i < Size.X; i++) + Update++; + if (Update == 30) { - for (int j = 0; j < Size.Y; j++) + for (int i = 0; i < Size.X; i++) { + for (int j = 0; j < Size.Y; j++) + { - crops[i, j].updateCrop(Size); + crops[i, j].updateCrop(Size); + } } + Update = 0; } + } //Changes the properties of the tile when the tractor reaches this tile. diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs index 6b241e7..bf3e3b7 100644 --- a/Game1/Sources/Crops/SoilProperties.cs +++ b/Game1/Sources/Crops/SoilProperties.cs @@ -48,8 +48,8 @@ class SoilProperties Humidity = Temperature * GetRandomNumber(1.9, 2.1); Moisture = GetRandomNumber(20, 70); Nitrogen = GetRandomNumber(4 , 55); - Potassium = GetRandomNumber(0, 28); - Phosphorous = GetRandomNumber(0, 60); + Potassium = GetRandomNumber(0.01f, 28); + Phosphorous = GetRandomNumber(0.01f, 60); } public float GetRandomNumber(double minimum, double maximum) From 4ab4abaa89c82f535de44d5676febad20e17d042 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 May 2020 14:51:52 +0200 Subject: [PATCH 3/6] Last Images and at last fixed the Production System --- Game1/Content/BarleyIcon.png | Bin 0 -> 2177 bytes Game1/Content/Content.mgcb | 36 ++++++++++++++++++++++++++ Game1/Content/CottonIcon.png | Bin 0 -> 3613 bytes Game1/Content/GroundNutsIcon.png | Bin 0 -> 1612 bytes Game1/Game1.cs | 8 +++--- Game1/Sources/Crops/Crops.cs | 26 +++++++++---------- Game1/Sources/Crops/SoilProperties.cs | 6 ++--- 7 files changed, 56 insertions(+), 20 deletions(-) create mode 100644 Game1/Content/BarleyIcon.png create mode 100644 Game1/Content/CottonIcon.png create mode 100644 Game1/Content/GroundNutsIcon.png diff --git a/Game1/Content/BarleyIcon.png b/Game1/Content/BarleyIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..1c7b5af7595e73cf45d51abb5cc46ee8eabb726f GIT binary patch literal 2177 zcmV-{2!8j8P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&2o_01K~#8N?VQbv z97Pz$Yj!^NBiY>;*MN#BiU$=vcrXarORg&DL60Jc2MKr(h1~S!e~^IWpn?}YiTV#D zdoV%{#y~*uB50z-B%96d%ZH+t6p|oxFiwC6v@7s8fvE3u5S%2}xT#nIUD^O8U zN)g0H2+;*Ae}BluAoBEhu?$?l^T2zo+5d<2mS5w?MBp&hIo)v^aq;x~Uit zLJmoLOQ+-1n7yS_acT_43p6;k&i1AFXp(;W={PmM9t|tHNJKsdA>caQHB@K0-YQ&- znS~vaRSA;^L8C9-`JAy~kL@qK%yy2y8=qlp_2wDY7;N#h&OJx&oMY{spS1U)-alxa zm~sJyK$ChBS+22liZh3}5CcGr#^4@njP_WkdoeybX3%;fPAS|I_wGUKvG|A@>isGg zKpYz}Kvw=DPRZ?%w4161XI+d2t2f@C%$mTc8I?U6veDdvc934&{5mT07dAJzIcXr> zJ<{$?nB-BB<`z?@6n02f55NGsxcOzgH%9E8)U%1*qp!rNG2AV~`^s{N=Kfy^F#z2| zE?>O24pknx92IG9$>Wq<4$P~Y%0rlZ|s@9?yYE^aSu{V={BHHxb;=sd}` z9{O~=qd?WOsr>EZXQs~CpsS|}ol{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C`9`E-5mgy9iexIK%<2!~mrT62_AJ1cwyFr8_`rg3Ovr@{Av@#Q>!`V> zGQ@6%lglK*O>N=K+b7mY;XUDb=N z+wJoDRK@x8=au!SY6HT)@?fpo*|TSPeafb8A!q}_zVe_~n@fRw5kcI5u&+Gm{bnMP z>N+1cv97hxvI5DruYHykND>6`j39_-1VKC_2;vz*5YGsLct#M!GlC$V5d`s!Ac$uK zK|CV};u%2@&j^BeM&f%&pg!n($V8BUAB2$Q6^#7{ybyG4WYXGn00000NkvXXu0mjf D+t3C$ literal 0 HcmV?d00001 diff --git a/Game1/Content/Content.mgcb b/Game1/Content/Content.mgcb index c286d3c..2a9708d 100644 --- a/Game1/Content/Content.mgcb +++ b/Game1/Content/Content.mgcb @@ -13,6 +13,18 @@ #---------------------------------- Content ---------------------------------# +#begin BarleyIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:BarleyIcon.png + #begin BerriesIcon.png /importer:TextureImporter /processor:TextureProcessor @@ -37,6 +49,18 @@ /processorParam:TextureFormat=Color /build:CarronIcon.png;CarrotIcon.png +#begin CottonIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:CottonIcon.png + #begin Crop.png /importer:TextureImporter /processor:TextureProcessor @@ -56,6 +80,18 @@ /processorParam:TextureFormat=Compressed /build:Font.spritefont +#begin GroundNutsIcon.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:GroundNutsIcon.png + #begin house.png /importer:TextureImporter /processor:TextureProcessor diff --git a/Game1/Content/CottonIcon.png b/Game1/Content/CottonIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..eab2fb3aa0764629ee95811a551e89abf86f85a9 GIT binary patch literal 3613 zcmV+&4&w2NP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&4YEl@K~#8N?VM|@ z6;~C<_ocJ~O)IoeNv%9=CB#%}s$WQxN~pEaRE5y0_`yJI3}{mQVDJ)SfSBe&G=ZuS z5@RlsSV*uzT2nB6BvcbVXv%Gkxqy#@it?&}g#c-2kMp0i*I}J?_IqZ|IhT8X$X z%@>|9VM2b+iWMvJeG{^fX8i1-wigez1cyV;w`uqFUz`%gsYlRBs*B5@TZu`pIJTK%WIYlg%z;k?S+jrF)_x;!DF2SWg zo>Jo`j8_+4IUdw(mSqn?vb-!;Z>OfrI`ZEMrBN^5x4>qHwUEB8CZD<(Rzeo~9s3 zJ}Uui-Vr%UW$95T9-AC>w|-XI=3B&#_w-SAr@B#@_9n7 z1h9Q$W>Vr{zo@UKT4$@($PbMrv6cbLj&*JFd8C!_=iv#kePd=);*=RU4;?zB_u4@r zn4U$ZPFab3o}LjTq;{b;ZQi_D@7cjix(d|vET+^cQTRQ%AhtNduc>UtFr;UU;gcgr zj^w>~7Z_>*zVm!++_+J1bq+q7kaZySmYuFn;i8~33sHv;AJ#c`)~#C?bY2;(T)9%M zUAtEA7318lqk2oJzMH~|yUlD;la1lwVZCL>6>#}6+j*vEv8AfvLo<}P+mgqS0Bv`~ zLVTmFdhVaE=-hI_0BR9BB1n;u*12=%7LFYNV%+iV`_=JF zr}Ff@H-D;+lt;+yCnnfjbTx*A0IR_8dl66w5Q7h!FPrg@-YSP(yLMTvBPOu-ydc2U zI&#%YSO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NK zAI-#CNT1$7u5)U#aZMbH7cb67g<}UIZO?(>dMri@{r9WgfTp1_u!uEUnF#tw137&Q zc-faWV`ws4%$1b23It4h>f>s{y|+g#JaYkov2HiyyN^(48aig$mQ$J_zR998DEhJz z`nH2U$ms=269kh*A*(Ss2#TqgYIJOk=W`PfxhyLwLa-pdmISqqVp<$n85jef@G;fs z*cy+82)^I!G{J(%nK{z}Gc<)`X7CX3WAH7lNvZJ{U;DS-3cChYSmYZ*AHjmie*lAd zXDLe7EX?!Ky228FAF%;n)@Zc2I4L!L;=HMPtHIQ7%+p(D%5GRlqGAYlM<{%V#Pi^` zFyAg$qU_(lUoBm_G)N?0TzUJq*Q`K(pAMuINzo*7j=OJspR@MUqKuH=PO+jWLAX0Y z;rI9V2f3)MbC@sf_pMTK{m&`l?2ci*)hHARtmJ<$TwC}C(Odq^1*Kc@)(!Zsipod?l;1p`skyR74zS&8i$Ss|owsY^(S z=qph8nDuw8@Sc3D9#ZULeNL7_?4 z1yO3XTE1orRz%{21b2wxb5jymfe@wu?-Hf0ATxupU6X1BA#1YYZ7M@96a$D45C-Ei zlw8Y9Ap}H=6$6A8h&<0G9>E2~!ZzDAQaqpa5g`i!lLP?}C3d)*{z#l_S5VrT>3L;28g}4fq5)_W`3)5LxSegcPjFN^l=)*@Xu6Q7K3) zAq8u*667PGhknpHY6ani7eYwEaw|z)$T#Ymy#zIXQR8Dj$1WRQ_M=viUcxHK7~P{y jkTH6Lu~t@3q168Y(pYSWZ7ca&00000NkvXXu0mjfkkz;@ literal 0 HcmV?d00001 diff --git a/Game1/Content/GroundNutsIcon.png b/Game1/Content/GroundNutsIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..de2cf45481d4a35df73dcbaaa2a6a3a2679f146f GIT binary patch literal 1612 zcmb`I`#aMM0LH&tF5j8CRgTGG5`~;NB}*>*noI}PY)T0+=IJ4_W)gEPPmSD&VgV=#AwCM2ZnGCX!_tmpen{NPFKOT z+`aFDClM~mI%m4Yo}FQCaS$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cr;gWh_bImG2nU@P_tsk?=73zchc$jc!$fY_K7Q(4pSrA*HvUiWmC}y0)kkA^p zyY#LH5u3!%;CeeV_3mkXLtAZh%{YWL4_msEGW*=T|5(V5Zg%&NagFS2`2xGkgXxxZu1ucNnTn(HH7_?9Wec0tm{5k SQPNi)0Pyt=APAxGtbYMe|JmaJ literal 0 HcmV?d00001 diff --git a/Game1/Game1.cs b/Game1/Game1.cs index a1372d0..0fb937c 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -97,12 +97,14 @@ namespace Game1 tile[2] = Content.Load("Plantable"); tile[3] = Content.Load("Crop"); - Crops[0] = Content.Load("CarrotIcon"); - Crops[1] = Content.Load("WheatIcon"); - Crops[2] = Content.Load("BerriesIcon"); + + + Crops[0] = Content.Load("BarleyIcon"); + Crops[1] = Content.Load("CottonIcon"); + Crops[2] = Content.Load("GroundNutsIcon"); Crops[3] = Content.Load("MaizeIcon"); Crops[4] = Content.Load("MilletsIcon"); Crops[5] = Content.Load("SeedOilIcon"); diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 357864c..9e060c1 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -28,7 +28,7 @@ class Crops getProductionRate(); if (Status == 3 && Timer != 1) { - Timer = Timer - 1 * ProductionRate; + Timer = Timer - 1f * ProductionRate; } Size = newSize; UpdateCrop++; @@ -198,33 +198,31 @@ class Crops ProductionRate = 1; if (DataSet != null) { - ProductionRate = (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature)); - ProductionRate = (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture)); - ProductionRate = (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity)); - ProductionRate = (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous)); - ProductionRate = (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium)); - ProductionRate = (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen)); if (ProductionRate < 0) { ProductionRate = 0; } + ProductionRate = ProductionRate / 20; } } public float compareToDatset(float i, float j) { - if (i > j) + if (i < j) { - return (i / j) * 0.15f; - } - else if (i < j / 2) - { - return (i / j) * 2f; + return (i / j); } else { - return i / j; + return (j / i); } + } diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs index bf3e3b7..c8dcffe 100644 --- a/Game1/Sources/Crops/SoilProperties.cs +++ b/Game1/Sources/Crops/SoilProperties.cs @@ -17,9 +17,9 @@ class SoilProperties public float Nitrogen; public float Potassium; public float Phosphorous; - public float NitrogenDegradeRate = 0.001f; - public float PotassiumDegradeRate = 0.001f; - public float PhosphorousDegradeRate = 0.001f; + public float NitrogenDegradeRate = 0.01f; + public float PotassiumDegradeRate = 0.01f; + public float PhosphorousDegradeRate = 0.01f; public void setSoilProperties() { From a54a7f914cf752cfaa01fc563c6b889b43de0c32 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 May 2020 20:06:34 +0200 Subject: [PATCH 4/6] implemented getHighestProductionRate(x, y) per tile --- Game1/Game1.cs | 49 +++--- Game1/Sources/Crops/CropTypesHolder.cs | 232 +++++++++++++------------ Game1/Sources/Crops/Crops.cs | 18 +- Game1/Sources/Crops/Farm.cs | 28 ++- 4 files changed, 183 insertions(+), 144 deletions(-) diff --git a/Game1/Game1.cs b/Game1/Game1.cs index 0fb937c..b6ccf57 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -14,7 +14,7 @@ namespace Game1 SpriteBatch spriteBatch; SpriteFont Bold; private Texture2D[] tile = new Texture2D[5]; - private Texture2D[] Crops = new Texture2D[11]; + private Texture2D[] Crops = new Texture2D[12]; private Texture2D tractor; private Texture2D house; private Texture2D markers; @@ -50,17 +50,18 @@ namespace Game1 // TODO: Add your initialization logic here base.Initialize(); - cropTypesNames[0] = "Barley"; - cropTypesNames[1] = "Cotton"; - cropTypesNames[2] = "Ground Nuts"; - cropTypesNames[3] = "Maize"; - cropTypesNames[4] = "Millets"; - cropTypesNames[5] = "Oil Seeds"; - cropTypesNames[6] = "Paddy"; - cropTypesNames[7] = "Pulses"; - cropTypesNames[8] = "Sugarcane"; - cropTypesNames[9] = "Tobacco"; - cropTypesNames[10] = "Wheat"; + cropTypesNames[0] = "None"; + cropTypesNames[1] = "Barley"; + cropTypesNames[2] = "Cotton"; + cropTypesNames[3] = "Ground Nuts"; + cropTypesNames[4] = "Maize"; + cropTypesNames[5] = "Millets"; + cropTypesNames[6] = "Oil Seeds"; + cropTypesNames[7] = "Paddy"; + cropTypesNames[8] = "Pulses"; + cropTypesNames[9] = "Sugarcane"; + cropTypesNames[10] = "Tobacco"; + cropTypesNames[11] = "Wheat"; @@ -101,18 +102,18 @@ namespace Game1 - - Crops[0] = Content.Load("BarleyIcon"); - Crops[1] = Content.Load("CottonIcon"); - Crops[2] = Content.Load("GroundNutsIcon"); - Crops[3] = Content.Load("MaizeIcon"); - Crops[4] = Content.Load("MilletsIcon"); - Crops[5] = Content.Load("SeedOilIcon"); - Crops[6] = Content.Load("PaddyIcon"); - Crops[7] = Content.Load("PulsesIcon"); - Crops[8] = Content.Load("SugarcaneIcon"); - Crops[9] = Content.Load("TobaccoIcon"); - Crops[10] = Content.Load("WheatIcon"); + Crops[0] = Content.Load("Markers"); + Crops[1] = Content.Load("BarleyIcon"); + Crops[2] = Content.Load("CottonIcon"); + Crops[3] = Content.Load("GroundNutsIcon"); + Crops[4] = Content.Load("MaizeIcon"); + Crops[5] = Content.Load("MilletsIcon"); + Crops[6] = Content.Load("SeedOilIcon"); + Crops[7] = Content.Load("PaddyIcon"); + Crops[8] = Content.Load("PulsesIcon"); + Crops[9] = Content.Load("SugarcaneIcon"); + Crops[10] = Content.Load("TobaccoIcon"); + Crops[11] = Content.Load("WheatIcon"); ProgressionBar = Content.Load("ProgressionBar"); diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs index f63e48b..e6fa27a 100644 --- a/Game1/Sources/Crops/CropTypesHolder.cs +++ b/Game1/Sources/Crops/CropTypesHolder.cs @@ -7,152 +7,164 @@ using System.Threading.Tasks; class CropTypesHolder { - private CropTypes[] cropTypes = new CropTypes[11]; + private CropTypes[] cropTypes = new CropTypes[12]; public void init() { - // Barley + // None cropTypes[0] = new CropTypes(); - cropTypes[0].soilType[0] = "Sandy"; + cropTypes[0].soilType[0] = "None"; cropTypes[0].soilType[1] = null; cropTypes[0].soilType[2] = null; - cropTypes[0].Temparature = 30.1f; - cropTypes[0].Humidity = 59.0f; - cropTypes[0].Moisture = 41.7f; - cropTypes[0].Nitrogen = 12.6f; - cropTypes[0].Potassium = 5.3f; - cropTypes[0].Phosphorous = 26.0f; + cropTypes[0].Temparature = 0f; + cropTypes[0].Humidity = 0f; + cropTypes[0].Moisture = 0f; + cropTypes[0].Nitrogen = 0f; + cropTypes[0].Potassium = 0f; + cropTypes[0].Phosphorous = 0f; + + // Barley + cropTypes[1] = new CropTypes(); + cropTypes[1].soilType[0] = "Sandy"; + cropTypes[1].soilType[1] = null; + cropTypes[1].soilType[2] = null; + cropTypes[1].Temparature = 30.1f; + cropTypes[1].Humidity = 59.0f; + cropTypes[1].Moisture = 41.7f; + cropTypes[1].Nitrogen = 12.6f; + cropTypes[1].Potassium = 5.3f; + cropTypes[1].Phosphorous = 26.0f; // Cotton - cropTypes[1] = new CropTypes(); - cropTypes[1].soilType[0] = "Red"; - cropTypes[1].Times[0] = 5; - cropTypes[1].soilType[1] = "Black"; - cropTypes[1].Times[1] = 4; - cropTypes[1].soilType[2] = "Loamy"; - cropTypes[1].Times[2] = 3; - cropTypes[1].Temparature = 30.4f; - cropTypes[1].Humidity = 59.6f; - cropTypes[1].Moisture = 63.2f; - cropTypes[1].Nitrogen = 16.4f; - cropTypes[1].Potassium = 3.3f; - cropTypes[1].Phosphorous = 23.8f; - - // Ground Nuts cropTypes[2] = new CropTypes(); cropTypes[2].soilType[0] = "Red"; - cropTypes[2].soilType[1] = null; - cropTypes[2].soilType[2] = null; - cropTypes[2].Temparature = 30.1f; - cropTypes[2].Humidity = 59.1f; - cropTypes[2].Moisture = 33.1f; - cropTypes[2].Nitrogen = 23.3f; - cropTypes[2].Potassium = 2.0f; - cropTypes[2].Phosphorous = 21.6f; + cropTypes[2].Times[0] = 5; + cropTypes[2].soilType[1] = "Black"; + cropTypes[2].Times[1] = 4; + cropTypes[2].soilType[2] = "Loamy"; + cropTypes[2].Times[2] = 3; + cropTypes[2].Temparature = 30.4f; + cropTypes[2].Humidity = 59.6f; + cropTypes[2].Moisture = 63.2f; + cropTypes[2].Nitrogen = 16.4f; + cropTypes[2].Potassium = 3.3f; + cropTypes[2].Phosphorous = 23.8f; + + // Ground Nuts + cropTypes[3] = new CropTypes(); + cropTypes[3].soilType[0] = "Red"; + cropTypes[3].soilType[1] = null; + cropTypes[3].soilType[2] = null; + cropTypes[3].Temparature = 30.1f; + cropTypes[3].Humidity = 59.1f; + cropTypes[3].Moisture = 33.1f; + cropTypes[3].Nitrogen = 23.3f; + cropTypes[3].Potassium = 2.0f; + cropTypes[3].Phosphorous = 21.6f; // Maize - cropTypes[3] = new CropTypes(); - cropTypes[3].soilType[0] = "Sandy"; - cropTypes[3].soilType[1] = null; - cropTypes[3].soilType[2] = null; - cropTypes[3].Temparature = 29.0f; - cropTypes[3].Humidity = 57.3f; - cropTypes[3].Moisture = 42.2f; - cropTypes[3].Nitrogen = 18.3f; - cropTypes[3].Potassium = 5.7f; - cropTypes[3].Phosphorous = 18.7f; - - // Millets cropTypes[4] = new CropTypes(); cropTypes[4].soilType[0] = "Sandy"; - cropTypes[4].Times[0] = 7; - cropTypes[4].soilType[1] = "Black"; - cropTypes[4].Times[0] = 4; + cropTypes[4].soilType[1] = null; cropTypes[4].soilType[2] = null; - cropTypes[4].Temparature = 29.5f; + cropTypes[4].Temparature = 29.0f; cropTypes[4].Humidity = 57.3f; - cropTypes[4].Moisture = 38.5f; - cropTypes[4].Nitrogen = 23.2f; - cropTypes[4].Potassium = 0.1f; - cropTypes[4].Phosphorous = 14.4f; + cropTypes[4].Moisture = 42.2f; + cropTypes[4].Nitrogen = 18.3f; + cropTypes[4].Potassium = 5.7f; + cropTypes[4].Phosphorous = 18.7f; + + // Millets + cropTypes[5] = new CropTypes(); + cropTypes[5].soilType[0] = "Sandy"; + cropTypes[5].Times[0] = 7; + cropTypes[5].soilType[1] = "Black"; + cropTypes[5].Times[0] = 4; + cropTypes[5].soilType[2] = null; + cropTypes[5].Temparature = 29.5f; + cropTypes[5].Humidity = 57.3f; + cropTypes[5].Moisture = 38.5f; + cropTypes[5].Nitrogen = 23.2f; + cropTypes[5].Potassium = 0.1f; + cropTypes[5].Phosphorous = 14.4f; //Oil Seeds - cropTypes[5] = new CropTypes(); - cropTypes[5].soilType[0] = "Black"; - cropTypes[5].soilType[1] = null; - cropTypes[5].soilType[2] = null; - cropTypes[5].Temparature = 30.3f; - cropTypes[5].Humidity = 59.1f; - cropTypes[5].Moisture = 32.1f; - cropTypes[5].Nitrogen = 19.0f; - cropTypes[5].Potassium = 2.3f; - cropTypes[5].Phosphorous = 17.3f; - - //Paddys cropTypes[6] = new CropTypes(); - cropTypes[6].soilType[0] = "Clayey"; + cropTypes[6].soilType[0] = "Black"; cropTypes[6].soilType[1] = null; cropTypes[6].soilType[2] = null; - cropTypes[6].Temparature = 31.2f; - cropTypes[6].Humidity = 60.4f; - cropTypes[6].Moisture = 41.5f; - cropTypes[6].Nitrogen = 20.8f; - cropTypes[6].Potassium = 3.7f; - cropTypes[6].Phosphorous = 16.3f; + cropTypes[6].Temparature = 30.3f; + cropTypes[6].Humidity = 59.1f; + cropTypes[6].Moisture = 32.1f; + cropTypes[6].Nitrogen = 19.0f; + cropTypes[6].Potassium = 2.3f; + cropTypes[6].Phosphorous = 17.3f; - //Pulses + //Paddys cropTypes[7] = new CropTypes(); cropTypes[7].soilType[0] = "Clayey"; cropTypes[7].soilType[1] = null; cropTypes[7].soilType[2] = null; - cropTypes[7].Temparature = 27.8f; - cropTypes[7].Humidity = 54.9f; - cropTypes[7].Moisture = 34.1f; - cropTypes[7].Nitrogen = 18.4f; - cropTypes[7].Potassium = 4.2f; - cropTypes[7].Phosphorous = 17.5f; + cropTypes[7].Temparature = 31.2f; + cropTypes[7].Humidity = 60.4f; + cropTypes[7].Moisture = 41.5f; + cropTypes[7].Nitrogen = 20.8f; + cropTypes[7].Potassium = 3.7f; + cropTypes[7].Phosphorous = 16.3f; + + //Pulses + cropTypes[8] = new CropTypes(); + cropTypes[8].soilType[0] = "Clayey"; + cropTypes[8].soilType[1] = null; + cropTypes[8].soilType[2] = null; + cropTypes[8].Temparature = 27.8f; + cropTypes[8].Humidity = 54.9f; + cropTypes[8].Moisture = 34.1f; + cropTypes[8].Nitrogen = 18.4f; + cropTypes[8].Potassium = 4.2f; + cropTypes[8].Phosphorous = 17.5f; //Sugarcane - cropTypes[8] = new CropTypes(); - cropTypes[8].soilType[0] = "Loamy"; - cropTypes[8].Times[0] = 9; - cropTypes[8].soilType[1] = "Black"; - cropTypes[8].Times[0] = 4; - cropTypes[8].soilType[2] = null; - cropTypes[8].Temparature = 30.0f; - cropTypes[8].Humidity = 58.6f; - cropTypes[8].Moisture = 51.2f; - cropTypes[8].Nitrogen = 14.6f; - cropTypes[8].Potassium = 4.2f; - cropTypes[8].Phosphorous = 17.6f; + cropTypes[9] = new CropTypes(); + cropTypes[9].soilType[0] = "Loamy"; + cropTypes[9].Times[0] = 9; + cropTypes[9].soilType[1] = "Black"; + cropTypes[9].Times[0] = 4; + cropTypes[9].soilType[2] = null; + cropTypes[9].Temparature = 30.0f; + cropTypes[9].Humidity = 58.6f; + cropTypes[9].Moisture = 51.2f; + cropTypes[9].Nitrogen = 14.6f; + cropTypes[9].Potassium = 4.2f; + cropTypes[9].Phosphorous = 17.6f; //Tobacco - cropTypes[9] = new CropTypes(); - cropTypes[9].soilType[0] = "Red"; - cropTypes[9].soilType[1] = null; - cropTypes[9].soilType[2] = null; - cropTypes[9].Temparature = 31.9f; - cropTypes[9].Humidity = 62.4f; - cropTypes[9].Moisture = 31.6f; - cropTypes[9].Nitrogen = 19.1f; - cropTypes[9].Potassium = 4.9f; - cropTypes[9].Phosphorous = 19.3f; + cropTypes[10] = new CropTypes(); + cropTypes[10].soilType[0] = "Red"; + cropTypes[10].soilType[1] = null; + cropTypes[10].soilType[2] = null; + cropTypes[10].Temparature = 31.9f; + cropTypes[10].Humidity = 62.4f; + cropTypes[10].Moisture = 31.6f; + cropTypes[10].Nitrogen = 19.1f; + cropTypes[10].Potassium = 4.9f; + cropTypes[10].Phosphorous = 19.3f; //Wheat - cropTypes[10] = new CropTypes(); - cropTypes[10].soilType[0] = "Loamy"; - cropTypes[10].soilType[1] = null; - cropTypes[10].soilType[2] = null; - cropTypes[10].Temparature = 33.1f; - cropTypes[10].Humidity = 63.8f; - cropTypes[10].Moisture = 50.0f; - cropTypes[10].Nitrogen = 23.3f; - cropTypes[10].Potassium = 2.9f; - cropTypes[10].Phosphorous = 14.4f; + cropTypes[11] = new CropTypes(); + cropTypes[11].soilType[0] = "Loamy"; + cropTypes[11].soilType[1] = null; + cropTypes[11].soilType[2] = null; + cropTypes[11].Temparature = 33.1f; + cropTypes[11].Humidity = 63.8f; + cropTypes[11].Moisture = 50.0f; + cropTypes[11].Nitrogen = 23.3f; + cropTypes[11].Potassium = 2.9f; + cropTypes[11].Phosphorous = 14.4f; } diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 9e060c1..86c438c 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -19,29 +19,30 @@ class Crops private Vector2 Size; private CropTypes DataSet; SoilProperties soilProperties = new SoilProperties(); - private float ProductionRate = 0; + private float ProductionRate; public void updateCrop(Vector2 newSize) { getProductionRate(); + if (UpdateCrop == 60) + { + degradeSoil(); + UpdateCrop = 0; + } + if (Status == 3 && Timer != 1) { Timer = Timer - 1f * ProductionRate; } Size = newSize; UpdateCrop++; - if (UpdateCrop == 60) - { - degradeSoil(); - UpdateCrop = 0; - } + if (Timer < 1) { Timer = 1; } - } public SoilProperties getSoilProperties() @@ -193,7 +194,7 @@ class Crops return housePos; } - public void getProductionRate() + public float getProductionRate(CropTypes Sample) { ProductionRate = 1; if (DataSet != null) @@ -210,6 +211,7 @@ class Crops } ProductionRate = ProductionRate / 20; } + return ProductionRate; } public float compareToDatset(float i, float j) diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index 17997d4..6167cd7 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -36,7 +36,7 @@ class Farm crops[i, j] = new Crops(); crops[i, j].setStatus(x); crops[i, j].setOriginalStatus(); - x = r.Next(0, 11); + x = r.Next(0, 12); crops[i, j].setCropType(x, PresetCrops.getPresetCropTypes(x)); crops[i, j].init(); } @@ -98,6 +98,30 @@ class Farm public CropTypes getPresetCropTypes(int Index) { - return PresetCrops.getPresetCropTypes(Index); + return PresetCrops.getPresetCropTypes(Index - 1); + } + + public void setCropType(int x, int y, int Type) + { + crops[x, y].setCropType(Type, PresetCrops.getPresetCropTypes(Type)); + } + + public int getHighestProductionRate(int x, int y) + { + int i = 1, holder = 0, holderIndex; + do + { + if (getProductionRate(x, y, i) > holder); + { + holderIndex = i; + } + i++; + } while (i < 12); + return holderIndex; + } + + public float getProductionRate(int x, int y, int Type) + { + return crops[x, y].getProductionRate(PresetCrops.getPresetCropTypes(Type)); } } From bfad241a745007d5a7f62872793248a6db21e828 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 May 2020 20:07:11 +0200 Subject: [PATCH 5/6] fix --- Game1/Sources/Crops/Crops.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 86c438c..1be67d0 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -25,7 +25,7 @@ class Crops public void updateCrop(Vector2 newSize) { - getProductionRate(); + getProductionRate(DataSet); if (UpdateCrop == 60) { degradeSoil(); From fe35083968bcf05a7696a91b6ff91a9058b3b01f Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 7 May 2020 21:46:33 +0200 Subject: [PATCH 6/6] Final ProductionRate --- Game1/Sources/Crops/Crops.cs | 12 ++++++------ Game1/Sources/Crops/Farm.cs | 25 ++++++++++++++++++++----- Game1/Sources/Smart/AI.cs | 3 +-- Game1/Sources/Smart/SmartTractor.cs | 2 +- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 1be67d0..d99aa3b 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -199,12 +199,12 @@ class Crops ProductionRate = 1; if (DataSet != null) { - ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, DataSet.Temparature)); - ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, DataSet.Moisture)); - ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, DataSet.Humidity)); - ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Phosphorous, DataSet.Phosphorous)); - ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Potassium, DataSet.Potassium)); - ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Nitrogen, DataSet.Nitrogen)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Temperature, Sample.Temparature)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Moisture, Sample.Moisture)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Humidity, Sample.Humidity)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Phosphorous, Sample.Phosphorous)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Potassium, Sample.Potassium)); + ProductionRate = ProductionRate + (ProductionRate * compareToDatset(soilProperties.Nitrogen, Sample.Nitrogen)); if (ProductionRate < 0) { ProductionRate = 0; diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index 6167cd7..6340681 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -20,9 +20,9 @@ class Farm PresetCrops.init(); r = new Random(); crops = new Crops[100, 100]; - for (int i = 0; i < Size.X; i++) + for (int i = 0; i < 99; i++) { - for (int j = 0; j < Size.Y; j++) + for (int j = 0; j < 99; j++) { int x = r.Next(0, 3); if (x == 0) @@ -106,14 +106,29 @@ class Farm crops[x, y].setCropType(Type, PresetCrops.getPresetCropTypes(Type)); } - public int getHighestProductionRate(int x, int y) + public void UpdatePreferedCrops(Vector2 Size) { - int i = 1, holder = 0, holderIndex; + for (int i = 0; i < Size.X; i++) + { + for (int j = 0; j < Size.X; j++) + { + int x = getHighestProductionRate(i, j); + crops[i,j].setCropType(x, PresetCrops.getPresetCropTypes(x)); + } + } + } + + private int getHighestProductionRate(int x, int y) + { + int i = 1, holderIndex = 0; + float holder = 0, SampleHolder = 0; do { - if (getProductionRate(x, y, i) > holder); + holder = getProductionRate(x, y, i); + if (SampleHolder < holder) { holderIndex = i; + SampleHolder = holder; } i++; } while (i < 12); diff --git a/Game1/Sources/Smart/AI.cs b/Game1/Sources/Smart/AI.cs index 38410a7..34f7d0d 100644 --- a/Game1/Sources/Smart/AI.cs +++ b/Game1/Sources/Smart/AI.cs @@ -34,9 +34,8 @@ class AI inventory.addItem(7, 1); inventory.addItem(7, 1); inventory.addItem(10, 1); - inventory.addItem(10, 1); + inventory.addItem(10, 1); inventory.useItem(10, 1); - } diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs index 74f5dae..4a909d7 100644 --- a/Game1/Sources/Smart/SmartTractor.cs +++ b/Game1/Sources/Smart/SmartTractor.cs @@ -17,10 +17,10 @@ class SmartTractor public Path returnChoice() { ai.update(farm, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation); + farm.UpdatePreferedCrops(Size); farm = ai.changeCropStatus(); getTargetPosition(ai.newTarget()); astar.update(farm.getCrops(), Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target/(tileSize+Spacing), Rotation); - return astar.FindPath(); }