The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 871 - File: showthread.php PHP 7.4.28 (Linux)
File Line Function
/showthread.php 871 errorHandler->error



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unity อยากสอบถามเรื่องการทำ combo hit ครับ
#1
คือตามหัวข้อเลยนะครับ ผมอยากทำระบบเกมให้มีคอมโบ ด้วยตอนนี้ใช้แค่ melee attack ธรรมดา

นี่คือสคริปต์ที่ผมใช้ครับ
Quote:var TheDamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var weapons : Transform;

function Update ()
{
if (Input.GetButtonDown("Fire2"))
{
weapons.animation.Play ("Punch 2");
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward),hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDamage",TheDamage, SendMessageOptions.DontRequireReceiver);
}
}
}
}


ฝากขอบคุณล่วงหน้าเลนนะครับ ConfusedConfused
Y me gusta muchoY me gusta muchoY me gusta muchoY me gusta muchoY me gusta muchoY me gusta mucho
[-] The following 1 user says Thank You to lightwolfz for this post:
  • นิราจ
Reply


Messages In This Thread
อยากสอบถามเรื่องการทำ combo hit ครับ - by lightwolfz - 02-23-2014, 05:23 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)