2024-12-15 01:39:39 +00:00
|
|
|
using CodeStage.AntiCheat.ObscuredTypes;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
|
|
|
|
// 1리 : 픽업트럭 3대, 수확기 1대, 구트랙터 2대, 트랙터 0대, 트레일러 탱크 2대
|
|
|
|
|
// 2리 : 픽업트럭 3대, 수확기 2대, 구트랙터 3대, 트랙터 3대, 트레일러 탱크 1대
|
|
|
|
|
// 3리 : 픽업트럭 4대, 수확기 2대, 구트랙터 4대, 트랙터 4대, 트레일러 탱크 0대
|
|
|
|
|
|
|
|
|
|
public class CarActor : Actor
|
|
|
|
|
{
|
|
|
|
|
List<Transform> list_wheeltf = new List<Transform>(); // 바퀴
|
|
|
|
|
List<Vector3> list_wheelpos = new List<Vector3>();
|
|
|
|
|
ChapterQuestObjType m_CarType;
|
|
|
|
|
|
|
|
|
|
protected override void Awake()
|
|
|
|
|
{
|
|
|
|
|
if (name.Contains("Pickup")) m_CarType = ChapterQuestObjType.PickUp;
|
|
|
|
|
else if (name.Contains("Harvester")) m_CarType = ChapterQuestObjType.Harvester;
|
|
|
|
|
else if (name.Contains("TractorOld")) m_CarType = ChapterQuestObjType.TractorOld;
|
|
|
|
|
else if (name.Contains("Tractor")) m_CarType = ChapterQuestObjType.Tractor;
|
|
|
|
|
else m_CarType = ChapterQuestObjType.Trailer_Tank;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < transform.childCount; i++)
|
|
|
|
|
{
|
|
|
|
|
var child = transform.GetChild(i);
|
|
|
|
|
if (child.name.Contains("Wheel"))
|
|
|
|
|
{
|
|
|
|
|
list_wheeltf.Add(child);
|
|
|
|
|
list_wheelpos.Add(child.position);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//m_Stat = new ActorStatInfo();
|
|
|
|
|
//m_Stat.Set_StatValue(eStat.HP, list_wheeltf.Count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnInitStage()
|
|
|
|
|
{
|
|
|
|
|
StopAllCoroutines();
|
|
|
|
|
m_Stat.Set_Stat(eStat.HP, list_wheeltf.Count);
|
|
|
|
|
DeadStatus = false;
|
|
|
|
|
for (int i = 0; i < list_wheeltf.Count; i++)
|
|
|
|
|
list_wheeltf[i].position = list_wheelpos[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Get_Damage(DamageInfo _dinfo)
|
|
|
|
|
{
|
|
|
|
|
if (!IsDead())
|
|
|
|
|
{
|
|
|
|
|
m_Stat.Set_Stat(false, eStat.HP, 1);
|
|
|
|
|
DeadStatus = m_Stat.Get_Stat(eStat.HP) <= 0d;
|
|
|
|
|
StartCoroutine(Roll_Wheel((int)m_Stat.Get_Stat(eStat.HP)));
|
|
|
|
|
if (IsDead())
|
|
|
|
|
{
|
|
|
|
|
MyValue.MyPC.Del_Target();
|
|
|
|
|
Set_Outline(false);
|
|
|
|
|
}
|
2025-03-17 00:08:46 +00:00
|
|
|
//GameUI.Ins.IngameUI.m_ChapterQuest.Add_PurposeCount(new ChapterQuestAddData { purpose = ePurpose.GetItem, objtype = m_CarType });
|
2024-12-15 01:39:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IEnumerator Roll_Wheel(int index)
|
|
|
|
|
{
|
|
|
|
|
var wheel = list_wheeltf[index];
|
|
|
|
|
var y = list_wheelpos[index].y;
|
|
|
|
|
float t = 0f, rot, time = Random.Range(0.025f, 0.05f);
|
|
|
|
|
Vector3 dir;
|
|
|
|
|
if (wheel.name.Contains("fl") || wheel.name.Contains("fr"))
|
|
|
|
|
{
|
|
|
|
|
rot = 0.1f;
|
|
|
|
|
dir = Vector3.forward * 0.1f;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rot = -0.1f;
|
|
|
|
|
dir = Vector3.back * 0.1f;
|
|
|
|
|
}
|
|
|
|
|
while (t < time)
|
|
|
|
|
{
|
|
|
|
|
wheel.Translate(dir);
|
|
|
|
|
wheel.position = new Vector3(wheel.position.x, y, wheel.position.z);
|
|
|
|
|
wheel.Rotate(rot, 0f, 0f);
|
|
|
|
|
t += 0.0016f;
|
|
|
|
|
yield return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|