Unity/Asset 분석

[RTS Engine] 유닛 추가하기(Unit Spawner)

lipnus 2021. 5. 28. 02:46
반응형

유닛 생성

이렇게 만들면 맵 위에 올려도 클릭도 안되고 조작도 안됨.

단지 Object를 하나 만드는 역할만 하는 듯 하다. -> [추가] GameManager에서 Faction 설정을 해줘야함 

 

흰색은 조작이 안됨

 

UnitSpawner라는 컴포넌트가 있는데, 이것을 이용해서 유닛을 Spawn해줘야 게임 시스템안에 녹아든다.

 

 

위의 흰색이 내가추가한유닛 

 

  1. Units: Drag and drop the unit prefabs (that have the main Unit component). Each time, one random unit will be chosen from this list to be spawned next.
  2. Player Faction: Check this field if you want to spawn the units for the player’s faction.
  3. Faction ID: If the above field is left unchecked, then the spawned units will be assigned to the faction whose ID is the value of this field.
  4. Free Units: Check this field if you want the spawned units to be free (not belong to any faction in the game).
  5. Update Population: The spawned units will occupy slots in their faction’s population, if this field is enabled.
  6. Spawn Positions: An array of Transform components placed in the map’s scene that represent the potential spawn positions of each unit. Each time a unit is spawned, a random element of this array is selected to spawn the units at.
  7. Destination: When assigned, unit that spawn will proceed to move towards the position represented by the Transform component.
  8. Amount Range: The minimum and maximum amount of instances of the units to spawn. A random value will be chosen at the beginning inside the assigned range.
  9. Spawn Reload Range: How long does it to spawn two consecutive units? Each time a unit spawns, the spawn reload value is chosen as a random value inside the assigned range.
  10. Game Manager: Since this component is not directly initialized by the Game Manager component, it has to be manually assigned through this field.

 

 

http://soumidelrio.com/docs/unity-rts-engine/units/unit-spawner/

 

반응형