스터디/Unity 2018. 12. 26. 23:56

[Unity] 작업노트 - Playmaker 연습하기 8, UI - Input field

181226

Openplay님의 강좌 
Playmaker tutorial - with Unity UI #3: input Field 1

인풋필드에 입력한 텍스트가 상단에 디스플레이 되게 하는 예제

UI 앵커포인트는 Sketch 앱 처럼 좌측상단을 0점으로 바꿔줘야 좀 편한듯


텍스트 입력후 엔터를 치면 text를 string값에 저장하기
Input finished 상태에 인풋필드 오브젝트를 드래그앤드랍하여 Get Property - text (string)

그리고 그 값을 InputMessage 오브젝트를 드래그앤드랍하여 Set Property - text(string) 저장되었던 값으로 지정해준다


1단계 완성!

두번째 영삿ㅇ에서는
입력된 텍스트가 없을 경우의 예외처리에 대한 구현

텍스트가 없는지를 판단하는 state를 하나 추가하고,
없는 것이 참일 경우 경고 메시지를 띄우는 state를 추가

판단 state에서는 인풋필드 오브젝트의 text.Length 값을 가져와 int값에 저장하고,
Int compare 액션으로 들어온 값에 대한 이벤트를 정의한다

입력된 텍스트가 없을때의 state에서 화면에 표시되는 메시지를 Set Property로 지정해준다

텍스트가 제대로 입력되면 괜히 랜덤 방향으로 턴하게 지정해서 마무리하려다가

타이핑할때마다 랜덤으로 바라보다가 입력이 끝나면 제자리로 돌아보는 효과를 낸고 싶어서 state를 하나 더 추가했다

완성 :)


👩‍💻 #100DaysOfCode Day12
Unity Input Field UI + Playmaker Practice




스터디/Unity 2018. 11. 16. 17:23

[Unity] Playmaker 플레이메이커 참고 북마크

Hutong 사 홈페이지

Hutong사 유튜브

여러 튜토리얼들 

템플릿 활용하기


디버그


디버그 중 State를 알트+클릭하면 임시로 트랜지션이 되도록 해볼 수 있다

트랜지션 부분을 알트+클릭하면 그 이벤트가 연결된 다음 스테이트로 넘어간다

Debug youtube

커스텀 액션 만들기

스크립트에서 커스텀 액션 접근하기

스크립트에서 플레이메이커 접근하기

팁!

State Machine 디자인하기
-FSM 디스크립션에 이 FSM이 어떤 behavior를 하게될지 서술해본다. 
-그래프뷰에서 대강 배치를 하면서 흐름을 크게 그려본다
-실제로 액션을 넣기 전에 스테이트에 Debug Log를 추가하면서 알트클릭으로 체크하며 테스트한다
-작은 여러 FSM들이 모여 큰 FSM이 되도록
-스탠다이즈된 이벤트 네임을 쓴다 “activate” “turnOn”

NoExit 예제


인벤토리 예제

애니메이션 기능 튜토리얼


스터디/Unity 2018. 11. 16. 17:22

[Unity] Playmaker 플레이메이커 공식 튜토리얼 리스트

스터디/Unity 2018. 11. 16. 14:08

[Unity] 플레이메이커 Playmaker 이벤트 리스트

System Events


Core Events

NOTE: "game object" refers to the game object that owns the FSM.

EventDescriptionUnity Docs
STARTSent when the state machine is enabled.N.A.
FINISHEDSent when all actions on the active state have finished. See Actions.N.A.
LEVEL LOADEDSent after a new level is loaded.OnLevelWasLoaded
BECAME VISIBLESent when the game object becomes visible by any camera.OnBecameVisible
BECAME INVISIBLESent when the game object is no longer visible by any camera.OnBecameInvisible

 

Physics Events

NOTE: After a COLLISION or TRIGGER event you can use GetCollisionInfoGetTriggerInfo, or GetControllerHitInfo to get more info on the collision/trigger event.

COLLISION ENTERSent when the game object first collides with another object.OnCollisionEnter
COLLISION EXITSent when the game object stops colliding with another object.OnCollisionExit
COLLISION STAYSent while the game object is colliding with another object.OnCollisionStay
TRIGGER ENTERSent when the game object enters a trigger volume.OnTriggerEnter
TRIGGER EXITSent when the game object exits a trigger volume.OnTriggerExit
TRIGGER STAYSent while the game object stays inside a trigger volume.OnTriggerStay
CONTROLLER COLLIDER HITSent when the character controller on the game object collides with an object.OnControllerColliderHit
COLLISION ENTER 2DSent when the game object first collides with a 2D Collider.OnCollisionEnter2D
COLLISION EXIT 2DSent when the game object stops colliding with a 2D Collider.OnCollisionExit2D
COLLISION STAY 2DSent while the game object is colliding with a 2D Collider.OnCollisionStay2D
TRIGGER ENTER 2DSent when the game object enters a 2D Trigger.OnTriggerEnter
TRIGGER EXIT 2DSent when the game object exits a 2D Trigger.OnTriggerExit
TRIGGER STAY 2DSent while the game object stays inside a 2D Trigger.OnTriggerStay
PARTICLE COLLISIONSent when a particle hits a Collider. See unity docs for more info.OnParticleCollision
JOINT BREAKSent when a Joint attached to the same game object breaks.OnJointBreak
JOINT BREAK 2DSent when a Joint2D attached to the same game object breaks.OnJointBreak2D

 

Mouse Events

TIP: Mouse events are useful in state machines that control GUIText or GUITexture components. See GUI Element Actions.

MOUSE DOWNSent when the mouse clicks on the game object.OnMouseDown
MOUSE DRAGSent while the mouse button is down and over the game object.OnMouseDrag
MOUSE ENTERSent when the mouse rolls over the game object.OnMouseEnter
MOUSE EXITSent when the mouse rolls off the game object.OnMouseExit
MOUSE OVERSent while the mouse is over the game object.OnMouseOver
MOUSE UPSent when the mouse button is released over the game object.OnMouseUp
MOUSE UP AS BUTTONSent when the mouse button is released over the same GUI Element or Collider it was pressed on.OnMouseUpAsButton

 

Application Events

APPLICATION FOCUSSent when the Application gets focus.
APPLICATION PAUSESent when the Application is paused.
APPLICATION QUITSent right before the Application quits.

 

UI Events

NOTE: The owner needs the appropriate UI Components to send UI Events. If you want to target other GameObjects use UI Actions.

UI CLICKSent when a Button is pressed. Game object needs a Button component.
UI BEGIN DRAGSent before a drag is started.
UI DRAGSent every time the pointer is moved during dragging.
UI END DRAGSent when a drag is ended.
UI DROPSent when an object accepts a drop.
UI POINTER UPSent when a mouse click is released.
UI POINTER CLICKSent when a click is detected.
UI POINTER DOWNSent during ongoing mouse clicks until release of the mouse button
UI POINTER ENTERSent when the mouse begins to hover over the GameObject.
UI POINTER EXITSent when the mouse stops hovering over the GameObject.
UI BOOL VALUE CHANGEDSent when a Toggle value changes. Game object needs a Toggle component. Use Get Event Bool Data to get the value.
UI FLOAT VALUE CHANGEDSent when a Slider or Scrollbar value changes. Game object needs a Slider or Scrollbar component. Use Get Event Float Data to get the value.
UI INT VALUE CHANGEDSent when a Dropdown selection changes. Game object needs a Dropdown component. Use Get Event Int Data to get the value.
UI VECTOR2 VALUE CHANGEDSent when a ScrollRect value changes. Game object needs a ScrollRect component. Use Get Event Vector2 Data to get the value.
UI END EDITSent when when editing of an InputField has ended. Owner needs an InputField component.

 



User Events

User events are usually named for clarity: Open Door, Turn On, Turn Off etc.

You can make/edit these events in the Event Manager.

Sending Events

There are a few ways to send events to an FSM:

  • Using Actions
  • Using Animation Events
  • Sending event from scripts.

Sending Events From Actions

The most basic Actions to send an event:

Other Actions send events based on conditions:

Events are essential to the flow of an FSM, so many actions send them.

Global Events

Events can be marked as Global in the Event Manager. Global events can be sent between FSMs.

Do not confuse Global Events with Global Transitions.

Event Data

You can associate data with an event using Set Event Data. For example, you could set the amount of damage to inflict with a Do Damage event.

You can get information and data associated with an event using Get Event Info. For example, you could read the amount of damage associated with a Do Damage event.


*콜리젼과 트리거 차이?


스터디/Unity 2018. 11. 16. 13:51

[Unity] 플레이메이커 Playmaker 액션 레퍼런스 리스트

Action Reference

https://hutonggames.fogbugz.com/default.asp?W2



Animate Variables Actions

These actions animate variable values over time using curves and easing. Use these actions to animate parameters in other actions.

Animation Actions

OTE: These actions use the Legacy Animation System in Unity. There is a newer animation system called Mecanim Animator that can be controlled with Animator Actions. However, in some situations it can be simpler to use these animation actions.
Most Animation Actions require an Animation Component on the game object. 
*가끔 옵션들이 히든되어있을수 있기 때문에 Debug 뷰 선택해야 될 수 있음
애니메이션과 애니메이션이벤트를 유니티 Animation View 에서 생성할 수 있다. 이렇게 만들어진 애니메이션은 PlaymakerFSM으로 animation events 형태로 전달 가능하다
- 게임오브젝트를 서택해서 Window>Animation에서 애니메이션을 추가하고, 타임라인에 애니메이션이벤트를 추가한다. 그리고 SendEvent(String) 함수를 선택하여 보낼 이벤트명 설정. 그러면 PlaymakerFSM에서 보내짐



유니티 Legacy Animation System


Animator Actions

Animator Actions use Unity's powerful Mecanim Animator System. Most Animator Actions require an Animator Component on the game object. 

유니티 Mecanim Animator System


Application Actions

https://hutonggames.fogbugz.com/default.asp?W671

High level actions to control the application.


Array Actions

https://hutonggames.fogbugz.com/default.asp?W1196

These actions are used with Array Variables. An Array lets you work with a collection of values.



Audio Actions

Audio actions control AudioSource components on game objects. Note, the AudioSource component provides a nice GUI to control advanced audio features. 


Camera Actions



Character Actions

Character Actions work with a Character Controller on a Game Object.


Color Actions

Color actions manipulate color variables.

https://hutonggames.fogbugz.com/default.asp?W417



Convert Actions

Convert Actions convert variables between different types.

NOTE: 1.9.0 can now auto-convert between many variable types.


Debug Actions



Device Actions

https://hutonggames.fogbugz.com/default.asp?W490

모바일 디바이스



Effects Actions

https://hutonggames.fogbugz.com/default.asp?W198


Enum Actions

https://hutonggames.fogbugz.com/default.asp?W1197


GameObject Actions

GameObject Actions deal with Unity Game Objects and the scene hierarchy.


GUI Actions

GUI actions require manual placement. For automatically laid out controls see GUI Layout Actions.

Unity also has a GUI Element system which uses GUIText and GUITexture components on game objects. See GUI Element Actions

See also PlayMakerGUI Inspector


GUI Element Actions

https://hutonggames.fogbugz.com/default.asp?W361

GUI Elements are set up in the Unity editor by adding GUIText or GUITexture components to a game object (Main Menu > Component > Rendering...).

These GUI Elements respond to mouse events in Playmaker (MOUSE OVER, MOUSE DOWN...), so it's very easy to set up their states.

GUI Element actions control the appearance of GUI Elements:


GUILayout Actions

https://hutonggames.fogbugz.com/default.asp?W414
GUILayout actions mirror Unity's GUILayout system. See Unity Docs.


 

Input Actions



Level Actions

Level actions deal with level loading and creation.


Lights Actions

https://hutonggames.fogbugz.com/default.asp?W384

Lights actions perform operations on Unity Lights.



Logic Actions

Logic actions perform comparisons and tests on variables. (Compare, Test, Switch...). They generally send events based on the results.


Material Actions


Mesh Actions



Unity Physics docs:

Vector3 Actions

Physics actions make heavy use of Vector3 variables. See Vector3 Actions.


Physics 2d Actions

https://hutonggames.fogbugz.com/default.asp?W1267


PlayerPrefs Actions

https://hutonggames.fogbugz.com/default.asp?W545


Quaternion Actions

https://hutonggames.fogbugz.com/default.asp?W1258



Rect Actions

https://hutonggames.fogbugz.com/default.asp?W673



Rect Transform Actions

https://hutonggames.fogbugz.com/default.asp?W1580



RenderSettings




Scene Actions




ScriptControl Actions




StateMachine Actions

https://hutonggames.fogbugz.com/default.asp?W15



String Actions







스터디/Unity 2018. 11. 12. 00:40

[Unity] 작업노트 - Playmaker 연습하기 7, get/set property 2- 환쟁이님 강좌

환쟁이(slee16) 강좌 따라 연습하기 계속
플레이메이커 액션 - Get/Set Property 두번째 파트

Rigid body의 gravity 옵션 켜기
Mesh Renderer에서 Cash Shadow 켜고 끄기

terrain에 큐브를 하나 만들어주고
게임오브젝트 manager_box 를 만들어 FSM 추가
Ready 스테이트에 <Get Key Up> 액션, ready_push 이벤트 추가

Result 스테이트에 cube 오브젝트를 프로젝트뷰에서 드래그앤드랍

플레이하면 큐브는 공중에 떠있고, 엔터를 누르면 Gravity가 적용되어 아래로 떨어진다 



위 예제의 큐브를 내가 만든 캐릭터 프리팹으로 교체해보고 싶었는데 생각보다 문제가 복잡해졌다

단순 큐브의 meshRender 오브젝트의 get/set property는 간단한데, 캐릭터는 상위폴더아래에 몇개의 메쉬/메쉬렌더러가 별도로 있기 때문
그래서 아래 링크를 참고해서 몇단계를 더 거쳤다

우선 변수형은 Object(게임오브젝트와의 차이를 이제서야 알았다)를 만들고 타입에서 갖가지 서브 요소타입을 정할 수 있다

 Player 1 게임오브젝트의 child인 yellowbody를 새 게임오브젝트 변수 get child에 저장하고, 
(플레이어를 구성하는 여러 파트가 있지만 그냥 몸통 부분만 일단 받아오고 나머지는 그림자 cast shadow를 아예 첨부터 꺼버렸다)
그 yellow body 게임오브젝트중 메시렌더러 부분을 아까 만든 object 변수에 저장한다


그리고 get/set property는 아까 드래그드랍을 바로 했던것과는 달리 리스트에서 변수를 불러온다

플레이!

엔터를 누르면 gravity가 활성화 되어 아래로 떨어졌다가 다시 초기 위치로 돌아가게 되고,
스페이스를 누르면 그림자가 생겼다가 없어졌다 하게 된다!


스터디/Unity 2018. 11. 11. 02:51

[Unity] 작업노트 - Playmaker 연습하기 6, get/set property - 환쟁이님 강좌

환쟁이(slee16) 강좌 따라 연습하기 계속
플레이메이커 액션 - Get/Set Property 첫번째 파트


Get / Set Property 를 유니티 UI와 연결하는 연습

Create Empty Object - UI에서 Image 선택 - 소스에서 Knob 선택 - Imagey Type Filled 를 선택 - Fill amount에 따라 원의 채워지는 퍼센트가 달라진다

-Property_Guage라는 게임오브젝트 만들고 
-circle_increase 스테이트에 아까 만든 UI 이미지를 드래그앤 드랍하면 이런 메뉴가 뜬다.
-Image에서 Set Property 선택



FillAmount 변수(0~1)에 따라 원의 채워짐이 달라지는데 이때 <animate float> <set float value>를 이용해 f_animfloat이 f_circleamunt까지 변화할때 curve곡선에 따라 변화도록 해준다



결과!


스페이스바를 누르면 값이 조금씩 증가하도록 변경
Stanby 스테이트에 <Get Key up> 추가하고 ready_to_push 이벤트

Circle_increse 스테이트에 <float add> 추가

숫자가 1이상이 되는지를 판단하는 스테이트를 추가하고 conf_no conf_yes 이벤트 추가하여 분기
1이상이 되면 reset 스테이트에 <set float value> 를 0으로 하고, 다시 standby 스테이트로 보낸다



플레이! 스페이스바 누를때마다 원이 커지고 1이상이 되면 reset 됨



스터디/Unity 2018. 11. 11. 01:29

[Unity] 작업노트 - Playmaker 연습하기 5, 두 플레이어의 이동 - 환쟁이님 강좌

환쟁이(slee16) 강좌 따라 연습하기 계속
플레이메이커 예제 #2 - 플레이어의 이동  2

-두개의 오브젝트에서 하나를 선택하여 GameObject에 변수에 저장
-변수에 저장된 오브젝트를 제어

1.Manager_Control 오브젝트. PlayerSelect FSM


Terrain,  플레이어 1, 2 추가 


Manager_Control 오브젝트에 PlayerSelect PlayerMove 두 FSM 추가



CheckObject 스테이트
클릭한 게임오브젝트를 Obj_Object 변수에 저장 <Mouse Pick>
LayerMask에서 Terrain, Invert Mask 선택하면 terrain빼고 다른 레이어만 인식
(Mouse Pick / Mouse Pick Event의 차이는 무엇일까 다음에)



Reset State
오른쪽클릭-Mouse_Cancel- 선택한 오브젝트를 변수에서 해제 

*문제점 

클릭해보면 변수 필드에 Obj_Object의 value가 Player2 오브젝트가 아니라 그 안에 있는 세부 캡슐 조각 Capsule(4)들이 선택딘다.
혹시나 해서 빈게임오브젝트를 상위에 두고 캡슐들을 그 아래로 묶어 다시 프리팹으로 만들보았지만 결과는 그대로.
나중에 실제 게임에서 '얼굴을 클릭하면, 몸을 클릭하면, '이렇게 분할조건을 만드는데는 쓸수있겠지만.. 가장 상위 단위의 오브젝트 (Capsule(8)이 아닌 Plyaer2 )를 선택되게 하려면 어떻게 하면 좋을까?collider 추가?
=> 환쟁님의 답변 : collider 추가 맞음

*오브젝트를 만들때는 위치값, 보는 방향 원점을 항상 첨부터 잘 조정해두자. 


2.Manager_Control 오브젝트. PlayerMove FSM

오브젝트에 PlayerSelect와는 별도로 PlayerMove FSM을 하나 더 생성한다

-Standby 스테이트에 Obj_Check 이벤트 추가 (global 체크). 이후에 PlayerSelect에서 이벤트를 보낼때 사용 
-Check Object 스테이트에 진행 분리
  • 1_PlayerSelectFSM으로부터 GameObject 변수를 받아와서 Obj_Selected 변수에 쌓는다 (global체크)  <Get Fsm Game Object>
  • Select_N Select_Y 이벤트 추가
  • <Get Object Is Null> 오브젝트가 Null 인지 판단하고
    • Null 이면 Select_N 이벤트로 이전 스테이트로 돌아가고
    • Null이 아니면 Select_Y로 Ready To Move 스테이트로 이동

-
-ReadyToMove 스테이트에 마우스 오른쪽/왼쪽 클릭 구분하여 분기
-Mouse_Click , Mouse_Cancel 이벤트 등록
-<Get Mouse Button Down> 액션 추가

-Set target 스테이트에는 MousePick 된 오브젝트를 Obj_Selected 변수에 넣고, 그 위치를 Vec3 변수인 Pos_Pick에 넣게된다
-이때 PlayerSelect와는 반대로 LayerMask 1 을 Terrain을 선택해서 TerraIn만 선택

*위 그림에서  실수를 했음. Obj_Select에 Store를 하는 바람에 Terrain이 움직여버림. 아래와 같이 Pos_Pick만 Store 하도록.




-Move 스테이트에는 <Move Towards> 추가하여 선택된 오브젝트를 Pos_Pick까지 이동하게 한다.
-Ignore Vertical은 Y값 이동 막음
-오브젝트 위치 0.5 거리까지 가면 FINISHED 이벤트가 발생하여 다시 ReadyToMove 스테이트로 이동


마지막으로 1_PlayerSelect FSM으로 가서 Check Object 스테이트에 Send Event Object_Check를 보내준다.

그러면 2_PlyaerMove 의 StandBy 스테이트가 이벤트를 받아 다음 스테이트로 넘어가게 된다.

플레이 결과!

원하는 캐릭터를 왼쪽 클릭하고 땅을 클릭하면 그쪽으로 이동, 우클릭하면 해제하고 다른 캐릭터 선택 가능!

*이걸 만약에 그냥 캐릭터를 좌클릭할때마다 이전에 선택된 캐릭터를 해제하고 해당 캐릭터를 선택하는 방식으로 메카닉을 바꾸려면..
PlayerSelect FSM에서 캐릭터를 우클릭시 Obj_Selected가 Null 인지 아닌지를 체크하는 과정을 한번 더 넣어야할듯


Move 스테이트에 <Smoothy Look At>을 추가하여 좀더 자연스럽게 바라보며 이동하도록 응용해보았다.
프리팹내의 캐릭터 오브젝트가 회전를 첨부터 잘 맞춰두는 것이 중요한것 같다..







스터디/Unity 2018. 11. 4. 01:11

[Unity] 작업노트 - Playmaker 연습하기 4, 플레이어의 이동 - 환쟁이님 강좌

환쟁이(slee16) 강좌 따라 연습하기 계속
플레이메이커 예제 #1 - 플레이어의 이동 1

-바닥을 클릭한 지점으로 이동하는 예제
-오브젝트에 FSM을 직접 심기보다는 Manager를 따로 두어 제어하는 방식
-Terrain 레이어를 지정하여 Layer Mask 활용


<준비>


Terrain 에 Tag, Layer 추가

Player에 Character Controller 추가

큐브 하나 만들어서 Target으로 이름 짓기

Manager_Move라는 빈 게임오브젝트

2.Manager_Move

StandBy 스테이트에 Mouse Pick Event 추가
GameObject에는 Terrain
Event 에 Clicked 생성하여
Mouse Down에 넣어줌
Clicked 트랜지션을 스테이트에 추가

Get Position 스테이트에 Mouse Pick 액션 추가
PickPosition 벡터3변수 만들기
Layer Mask 1로 지정해서 Element0을 Terrain으로
-Terrain을 클릭하면 - > 클릭한 지점 벡터값을 변수 pickposition에 저장 -> layermask를 통해 terrain 외의 오브젝트 클릭 이벤트는 무시 


Set Target 스테이트 추가
Set Position 액션에 Target의 포지션을 PickPositon 변수값을 받아와 그 위치로 옮김
Wait 액션을 추가하여 무한루프 방지 (on/off 다 해봤는데 어떤 차이가 있는지 잘 모르겠음)


3.Player
플레이어가 타겟을 따라가도록

Ignore Vertical On으로 함 : 수직 이동 무시. 켜놓지 않으면 플레이어가 땅속으로 묻히게 됨

4.Manager_Move에서 이벤트 보내기

Set Target 스테이트에 Send Event
Event Target을 Broadcast Call : 이벤트 받을수있는 모든 오브젝트에게 전달
Send Event : MoveTarget 이벤트로, 글로벌


*state 라벨 켜고 끄기 : FSM - Debug - Show State Labels



스터디/Unity 2018. 11. 4. 00:09

[Unity] 작업노트 - Playmaker 연습하기 3, 변수의 응용 - 환쟁이님 강좌

환쟁이(slee16) 강좌 따라 연습하기 계속
플레이메이커 기초 4 - 변수의 응용


-Find Game Object : 이름 또는 Tag 지정하여 오브젝트를 찾고 변수에 저장
-Move Towards : 타겟을 향해 오브젝트를 이동
-Int Compare : Int 변수의 차이에 따른 이벤트 처리
-Add FSM : 하나의 게임 오브젝트에 2 이상의 FSM 추가
-Send Event : FSM 선택하여 이벤트를 Call 한다
-Global Transition : 리니어 방식으로 이벤트 트랜지션이 아닌, 언제나 이벤트를 받도록
-iTween Move Add : itween 스크립트를 활용한 오브젝트 이동 관련 액션


  1. Add FSM
하나의 게임오브젝트에 여러개의 FSM 추가

마우스 우클릭하여 Add FSMComponent
상단 탭에서 한 오브젝트에 있는 여러 FSM들을 볼수있음 (여러개를 동시에 보는 뷰는 안되는건가?)

대안으로 FSM Browser에서 리스트뷰로 볼수있는데 FSM  많아지면 정말 헷갈릴듯!

1a. Game object 변수
Enemy_Move FSM에서 플레이어 오브젝트 저장할 GameObject 변수 Obj_Player’만들기

1b. Find game object action

tag로 설정시 랜덤한 검색

*확인하는 방법 (오!)

우측 변수에 Value none 이었는데 

플레이하면 Player 오브젝트가 쏙 들어가있음 

1c. Move towards action

Target position - None으로 눌러주기
적이 플레이어 위치 +1까지 도달하면 (Finish distance)
다음 이벤트로 넘어감

1d. Look at action

적이 이동할때 플레이어를 바라보게.
Y축으로 회전하여 , 적의 Z 방향이 플레이어를 향하도록.

1e. iTween move add
Knock Back이라는 스테이트 만들어 적이 플레이어를 향해 돌진하고, 플레이어에 의해 피해를 입고 뒤로 넉백.

원래는 itween으로 Space 좌표를 Self로 하며 Z축 -2로 해야 왔던길로 튕겨나가는데
Itween이 지원되지 않아 move towards로 대체했다. 그래서 일단 임시방편으로 그냥 X로 튕겨나가는척만 연출

2 set enemy color
튕겨나가는 넉백일때 빨갛게 바꿈

3.LOGIC
플레이어를 만날때 Enemy_HP연산되도록
Enemy_Damage FSM에 Enemy Alive?스테이트 추가하고 Yes No 이벤트 두개 추가


Enemy Alive로 경로 변경.
적이 피해를 입은 후, 적이 살아있는가’를 판단

3a. Int compare

Int 1이 2보다 같은지/작은지/큰지에 따라 컨디션 설정

적이 살아있지 않으면 Enemy Dead 상태로 보내고,
살아있으면 HP 값을 표시하고 처음으로 돌아가도록 설정

Enemy_Move FSM에 넉백할때 Send Event 하여 HP 줄어들도록


근데 0이 되어도 계속 움직이는 중

4.Global Transition

Enemy_Move FSM에 state와 글로벌 이벤트 Emeny Dead 추가.

Enemy_Damage FSM에도 Enemy Dead 스테이트에 dead 이벤트 추가


그리고 마지막으로 Move FSM에서 Dead 일때도 넉백 (Move Towards 추가)




*itween에 대한 환쟁이 님 블로그 질문/답변



*작업노트 적을때 티스토리에서 바로 적거나 메모장에서 적어서 옮겼었는데 사진 첨부하는게 너무 귀찮아서 에버노트 맥에서 작성해서 이미지는 바로 스크린캡쳐해서 붙여놓고 에버노트-티스토리 연동 플러그인을 설치해서 업로드하는걸로 바꿈
단점은 이미지의 폭이 들쑥날쑥..