1 00:00:03,970 --> 00:00:04,750 ‫Welcome back. 2 00:00:04,780 --> 00:00:10,720 ‫In this video, I would like you to add all the different models that we have created to your game. 3 00:00:10,960 --> 00:00:17,950 ‫So you can always compare it to the orange that we have created and actually to the orange prefab that 4 00:00:17,950 --> 00:00:18,780 ‫we have created. 5 00:00:18,790 --> 00:00:24,490 ‫So compare that and try to build the same thing for the watermelon, the banana, and whatever else 6 00:00:24,490 --> 00:00:25,480 ‫you have built. 7 00:00:25,780 --> 00:00:33,970 ‫All right, so post the video, try that and make it so and finish that so that you can randomly spawn 8 00:00:33,970 --> 00:00:36,040 ‫those different kind of fruits in your game. 9 00:00:36,040 --> 00:00:38,140 ‫And they all work as intended. 10 00:00:39,580 --> 00:00:40,030 ‫All right. 11 00:00:40,030 --> 00:00:41,230 ‫I hope you try to do that. 12 00:00:41,230 --> 00:00:43,990 ‫So let's go ahead and start with the watermelon. 13 00:00:44,080 --> 00:00:46,600 ‫So I'm going to drag the watermelon in there. 14 00:00:46,600 --> 00:00:48,970 ‫And as you see, it's quite big. 15 00:00:48,970 --> 00:00:51,760 ‫So I'm going to scale it down to 0.4. 16 00:00:52,750 --> 00:00:57,370 ‫So the model itself, so click on the model, scale it down and apply. 17 00:00:58,130 --> 00:01:01,330 ‫And next, the same thing with the watermelon cut. 18 00:01:01,330 --> 00:01:04,300 ‫So 0.4 and then apply that. 19 00:01:06,420 --> 00:01:09,270 ‫Now the watermelon needs several components. 20 00:01:09,420 --> 00:01:14,910 ‫For example, it needs a rigid body two DX with a collision detection, which is continuous. 21 00:01:15,000 --> 00:01:17,730 ‫And then, of course, it needs to tag interact table. 22 00:01:18,150 --> 00:01:22,440 ‫Now, next, it needs a Physics two DX Circle Collider. 23 00:01:22,770 --> 00:01:25,160 ‫And that's about the watermelon. 24 00:01:25,170 --> 00:01:29,460 ‫So of course needs to be as trigger as well because otherwise it won't trigger. 25 00:01:29,460 --> 00:01:33,570 ‫The event is trigger, which took care of slicing our watermelon. 26 00:01:33,840 --> 00:01:36,390 ‫And finally, it needs a script. 27 00:01:36,570 --> 00:01:40,950 ‫So let's go ahead and add that script called Fruit. 28 00:01:41,220 --> 00:01:46,500 ‫And the fruit script expects a sliced fruit prefab, which we, of course, will need to create in a 29 00:01:46,500 --> 00:01:47,100 ‫second. 30 00:01:47,520 --> 00:01:49,830 ‫So now let's go ahead to watermelon cut. 31 00:01:50,740 --> 00:01:59,200 ‫So our watermelon cut should get the intractable tag and those watermelon cut objects in here. 32 00:01:59,230 --> 00:02:03,460 ‫They need to get a physics, rigid body. 33 00:02:04,260 --> 00:02:09,600 ‫In this case, it's a3d rigid body, as you might know, as you might remember, about what we did for 34 00:02:09,600 --> 00:02:10,350 ‫the orange. 35 00:02:10,470 --> 00:02:14,440 ‫And it needs a physics box collider. 36 00:02:14,460 --> 00:02:15,930 ‫So I'm going to just keep it simple. 37 00:02:15,930 --> 00:02:17,310 ‫I'm going to use box colliders. 38 00:02:17,310 --> 00:02:21,690 ‫As you can see here, they are automatically created for me. 39 00:02:23,660 --> 00:02:25,790 ‫Now, those ones don't need to be triggers. 40 00:02:27,230 --> 00:02:33,790 ‫But what we can do now is we can take that watermelon cut and drag that into our prefabs folder. 41 00:02:33,800 --> 00:02:38,810 ‫So let's go to our prefabs folder and let's drag the watermelon cut. 42 00:02:39,200 --> 00:02:47,150 ‫And now let's go to our watermelon and drag that watermelon cut prefab into sliced fruit prefab. 43 00:02:47,420 --> 00:02:52,550 ‫And now we can drag the watermelon itself into our prefabs as well. 44 00:02:53,000 --> 00:02:54,780 ‫All right, so now we have the watermelon. 45 00:02:54,800 --> 00:02:57,670 ‫Let's go ahead and do the same thing with the banana. 46 00:02:57,680 --> 00:03:02,120 ‫So let's go to the objects here, to our models. 47 00:03:02,120 --> 00:03:09,890 ‫And now let's change the scale of the banana to 0.3 and apply that. 48 00:03:12,030 --> 00:03:14,540 ‫Now do the same thing with a banana cut. 49 00:03:14,550 --> 00:03:19,920 ‫So let's scale that to 0.3 as well and apply that as well. 50 00:03:21,060 --> 00:03:21,990 ‫And now. 51 00:03:22,820 --> 00:03:29,240 ‫As you might remember, we need to add a physics rigid body, which is continuous. 52 00:03:29,750 --> 00:03:31,880 ‫And in this case, I'm going to keep it simple. 53 00:03:31,910 --> 00:03:36,800 ‫I'm going to add a circle collider with the radius of 0.5. 54 00:03:37,220 --> 00:03:41,600 ‫Actually, seven should be good 0.7 with no offset. 55 00:03:42,440 --> 00:03:44,820 ‫And of course, this trigger is activated. 56 00:03:44,840 --> 00:03:48,050 ‫Now, the banana needs to get the tag intractable as well. 57 00:03:48,110 --> 00:03:50,240 ‫Now we need to add the component. 58 00:03:50,240 --> 00:03:52,400 ‫So let's add the script fruit. 59 00:03:53,330 --> 00:03:55,870 ‫And that one expects a sliced fruit prefab. 60 00:03:55,880 --> 00:03:58,640 ‫So let's create that banana cut. 61 00:03:58,670 --> 00:04:02,480 ‫Needs to get the tag intractable then it needs. 62 00:04:02,720 --> 00:04:08,510 ‫Well, actually, both banana left and banana right need to get the relevant components, which are 63 00:04:08,510 --> 00:04:17,120 ‫a rigid body and which are physics box colliders. 64 00:04:17,300 --> 00:04:21,470 ‫Now we create those two box colliders for the two different pieces. 65 00:04:21,470 --> 00:04:23,540 ‫So banana left and banana right. 66 00:04:24,020 --> 00:04:29,750 ‫Now that that is done, we can drag our banana cut into our prefabs folder. 67 00:04:29,750 --> 00:04:34,640 ‫So let's go to prefab or actually let's drag the banana just into the prefabs folder. 68 00:04:34,640 --> 00:04:40,880 ‫And in here the banana itself, not the banana cut, needs to get a sliced fruit prefab, of course. 69 00:04:40,880 --> 00:04:42,650 ‫So let's drag that in there. 70 00:04:43,220 --> 00:04:46,820 ‫And now let's drag the banana to our prefabs as well. 71 00:04:47,270 --> 00:04:53,090 ‫So if that was everything all right, we can get rid of those bananas, or actually, let's leave them 72 00:04:53,090 --> 00:04:53,450 ‫in there. 73 00:04:53,450 --> 00:04:55,730 ‫Maybe we should try to test them. 74 00:04:55,910 --> 00:04:57,410 ‫We can get rid of the cut one. 75 00:04:57,650 --> 00:05:04,010 ‫So let's delete watermelon cut and delete our banana cut. 76 00:05:04,340 --> 00:05:09,770 ‫Now, in our sponsor, we have the different objects to spawn. 77 00:05:09,770 --> 00:05:13,040 ‫And so far I only had one which was my orange. 78 00:05:13,040 --> 00:05:15,470 ‫And now I want to have two more. 79 00:05:15,470 --> 00:05:17,360 ‫So I'm going to enter three. 80 00:05:17,360 --> 00:05:19,430 ‫And as you can see, element zero is orange. 81 00:05:19,430 --> 00:05:21,920 ‫And I meant one is orange and two is orange as well. 82 00:05:21,920 --> 00:05:23,210 ‫And I would like to change that. 83 00:05:23,210 --> 00:05:28,190 ‫So I'm going to drag banana is element one and watermelon as element two. 84 00:05:28,190 --> 00:05:33,530 ‫And now if you have anything else such as whatever you come up with, then please go ahead and drag 85 00:05:33,530 --> 00:05:34,790 ‫that in there as well. 86 00:05:34,790 --> 00:05:38,180 ‫So if you have an apple or, I don't know, a peanut. 87 00:05:38,880 --> 00:05:40,590 ‫Or a coconut or something like that. 88 00:05:40,590 --> 00:05:42,450 ‫Please add that in here as well. 89 00:05:43,510 --> 00:05:44,190 ‫Okay. 90 00:05:44,430 --> 00:05:46,380 ‫So now let's see if that works. 91 00:05:46,410 --> 00:05:47,520 ‫Let's start the game. 92 00:05:48,060 --> 00:05:50,970 ‫Let's see if we get all those random objects. 93 00:05:50,970 --> 00:05:52,620 ‫And as you can see, I can. 94 00:05:53,520 --> 00:05:55,020 ‫Well, I screwed that up. 95 00:05:55,290 --> 00:05:56,850 ‫I can destroy bananas. 96 00:05:56,850 --> 00:06:02,160 ‫I can destroy my little peanut or watermelons. 97 00:06:02,550 --> 00:06:04,170 ‫Well, yeah, so I think. 98 00:06:04,930 --> 00:06:14,380 ‫It works fine and all of my objects get destroyed whenever I dash through them and if I lose the game. 99 00:06:14,380 --> 00:06:15,460 ‫So let's try that. 100 00:06:16,000 --> 00:06:23,620 ‫As soon as a bomb comes up and the we are game over, let's see all the objects at the site and restart 101 00:06:23,620 --> 00:06:25,660 ‫and all of them get destroyed. 102 00:06:25,900 --> 00:06:26,590 ‫Great. 103 00:06:27,320 --> 00:06:32,570 ‫So now we have a game which is already pretty much like fruit ninja. 104 00:06:32,630 --> 00:06:34,160 ‫There's not that much missing. 105 00:06:34,160 --> 00:06:40,250 ‫And in the next video, we are going to have a look at some preparation for Android. 106 00:06:40,250 --> 00:06:44,480 ‫So we're going to prepare the game so that it can run on an Android device. 107 00:06:44,480 --> 00:06:46,130 ‫So see you in the next video.