Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am creating a project in Unity using C# and have to complete the following for spawning random cacti. Please help me with the coding
I am creating a project in Unity using C# and have to complete the following for spawning random cacti. Please help me with the coding for this, I have no experience and could use the help.
Spawning: A random cactus character prefab should be spawned every 3 seconds out of a pool of 2 prefabs in the project (Cactus1 and Cactus2). The spawn position should be selected randomly out of a pool of 4. The spawn positions can be found under the Environment GameObject in the Hierarchy (i.e., Enemy SpawnPos1 to EnemySpawnPos4). Each spawned cactus should be rotated towards the tank. Running: The cacti characters should run at 20 meters per second towards the tank. Hit: Whenever a rocket hits a cactus, the HitEffect particle prefab should be played once at the position of the rocket, and both the rocket and the cactus should be destroyed. Tank Damage: Whenever a cactus hits the tank (meaning that the user could not hit the cactus), the DamageEffect particle prefab should be played once at the position of the cactus with an offset of 3 in y-axis (for better visibility), and the cactus should be destroyed. Spawning: A random cactus character prefab should be spawned every 3 seconds out of a pool of 2 prefabs in the project (Cactus1 and Cactus2). The spawn position should be selected randomly out of a pool of 4. The spawn positions can be found under the Environment GameObject in the Hierarchy (i.e., Enemy SpawnPos1 to EnemySpawnPos4). Each spawned cactus should be rotated towards the tank. Running: The cacti characters should run at 20 meters per second towards the tank. Hit: Whenever a rocket hits a cactus, the HitEffect particle prefab should be played once at the position of the rocket, and both the rocket and the cactus should be destroyed. Tank Damage: Whenever a cactus hits the tank (meaning that the user could not hit the cactus), the DamageEffect particle prefab should be played once at the position of the cactus with an offset of 3 in y-axis (for better visibility), and the cactus should be destroyedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started