匿名質問者匿名質問者回答ポイント なしウォッチ

Unityではじめる2Dゲーム作りっていう本で勉強しています。

当方、ズブ素人で、分からない箇所があるので教えて下さい

以下のコードが書籍に載っているのですが
if (collition2d.gameObject == gameObject) の所で
collition2dのgameObject が、gameObjectと等しいならとありますが
この何もついていないgameObjectと等しいというのは、どういう意味でしょうか?
すいませんがよろしくお願いします。

----
using UnityEngine;
using System.Collections;

public class Tank : MonoBehaviour {

GameObject goShell = null;
bool action = false;

// Use this for initialization
void Start () {
// 砲弾のゲームオブジェクト取得と砲弾の非表示設定
goShell = transform.FindChild("Tank_Shell").gameObject;
goShell.SetActive (false);
}

// Update is called once per frame
void Update () {
// ボタンが押されたか?
if (Input.GetMouseButton(0)) {
// タンクがクリックされたか?
Vector2 tapPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Collider2D collition2d = Physics2D.OverlapPoint(tapPoint);
if (collition2d) {
if (collition2d.gameObject == gameObject) {
// アクションを有効にする
action = true;
}
}
・・・【以下略】
----

ログインして回答する

ベストアンサー

その他の回答

この質問へのコメント

コメントはありません

この質問への反応(ブックマークコメント)

質問の情報

登録日時
2015-04-11 01:17:02
終了日時
2015-04-18 01:20:03
回答条件
1人5回まで

この質問のカテゴリ

この質問に含まれるキーワード

オブジェクト658Unity20

人気の質問

メニュー

PC版