| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
Tags
- 비주얼 스튜디오 다운로드
- 메이플스토리
- c언어 콘서트 배열 2번
- 온라인 비주얼 스튜디오
- c샾 헬로우 월드
- c++ 등차수열 합
- Lua란
- c sharp hello world
- c#온라인
- c언어 배열 programming
- lua download
- Lua language
- 루아다운로드
- N Queen Coordinates
- N Queen 문제
- 루아
- N Queens Problem
- c샾 hello world
- lua 다운로드
- 2중 반복문
- 유니티
- LUA
- c언어 버블정렬
- c언어 최대최소
- for문
- Lua 설명
- 게임제작
- 비주얼 스튜디오
- c언어 콘서트 배열
- C언어 달력
Archives
- Today
- Total
Ln Go
Boss 본문
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Boss : Enemy
{
public GameObject missile;
public Transform missilePortA;
public Transform missilePortB;
Vector3 lookVec;
Vector3 tauntVec;
public bool isLook;
// Awake() 함순는 자식 스크립트만 단독 실행!
void Awake()
{
rigid = GetComponent<Rigidbody>();
boxCollider = GetComponent<BoxCollider>();
// Material은 Mesh Renderer 컴포넌트에서 접근 가능!
// mav = GetComponentInChildren<MeshRenderer>().material;
meshs = GetComponentsInChildren<MeshRenderer>();
nav = GetComponent<NavMeshAgent>();
anim = GetComponentInChildren<Animator>();
nav.isStopped = true;
StartCoroutine(Think());
}
void Update()
{
if (isDead)
{
StopAllCoroutines();
return;
}
if (isLook)
{
float h = Input.GetAxisRaw("Horizontal");
float v = Input.GetAxisRaw("Vertical");
lookVec = new Vector3(h, 0, v) * 5f;
transform.LookAt(target.position + lookVec);
//Enemy target Variable can use
}
else
nav.SetDestination(tauntVec);
}
IEnumerator Think()
{
yield return new WaitForSeconds(0.1f);
int ranAction = Random.Range(0,5);
switch (ranAction)
{
case 0:
case 1:
StartCoroutine(MissileShot());
break;
case 2:
case 3:
StartCoroutine(RockShot());
break;
case 4:
StartCoroutine(Taunt());
break;
}
}
IEnumerator MissileShot()
{
anim.SetTrigger("doShot");
yield return new WaitForSeconds(0.2f);
GameObject instantMissileA = Instantiate(missile, missilePortA.position, missilePortA.rotation);
BossMissile bossMissileA = instantMissileA.GetComponent<BossMissile>();
bossMissileA.target = target;
yield return new WaitForSeconds(0.3f);
GameObject instantMissileB = Instantiate(missile, missilePortB.position, missilePortB.rotation);
BossMissile bossMissileB = instantMissileB.GetComponent<BossMissile>();
bossMissileB.target = target;
yield return new WaitForSeconds(2f);
StartCoroutine(Think());
}
IEnumerator RockShot()
{
isLook = false;
anim.SetTrigger("doBigShot");
Instantiate(bullet, transform.position, transform.rotation);
yield return new WaitForSeconds(3f);
isLook = true;
StartCoroutine(Think());
}
IEnumerator Taunt()
{
tauntVec = target.position + lookVec;
isLook = false;
nav.isStopped = false;
boxCollider.enabled = false;
anim.SetTrigger("doTaunt");
yield return new WaitForSeconds(1.5f);
meleeArea.enabled = true;
yield return new WaitForSeconds(0.5f);
meleeArea.enabled = false;
yield return new WaitForSeconds(1f);
isLook = true;
nav.isStopped = true;
boxCollider.enabled = true;
StartCoroutine(Think());
}
}
'Unity > Quad Action' 카테고리의 다른 글
| BossMissile (0) | 2021.06.04 |
|---|---|
| BossRock (0) | 2021.06.04 |
| Enemy (0) | 2021.06.04 |
| Player (0) | 2021.06.04 |
| GameManager (0) | 2021.06.04 |
Comments