特定のタグを持つColliderがぶつかるたびにint attackの値を10から50の範囲の値にランダムに変えてダメージ計算をしたいのですが書き方がよくわかりません....
###該当のソースコード
public class statusren : MonoBehaviour {
public int HP = 100;
public int attack = 10;
private Animator animator; // Use this for initialization void Start () { animator = GetComponent<Animator>();
}
// Update is called once per frame void Update () { } void OnTriggerEnter(Collider col)//ぶつかった時実行 { if (col.gameObject.tag == "Player") HP = HP - attack; if (HP <= 0) { animator.SetTrigger("death"); } } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/03/11 03:06