2019年5月21日 星期二

Week14 +1 notes

分開碰撞物件(把一個物件套一個程式) \文字版面






第一顆球 程式
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bom : MonoBehaviour
{
    GameObject realBoard=null;
    public GameObject board;
    public GameObject BAT; //BAT手把
    // Start is called before the first frame update
    void Start()
    {
   
    }

    // Update is called once per frame
    float x=0;
    void Update()
    {
 

    }
    void OnTriggerEnter(Collider collision)
    {
        print("collision");
        if(realBoard==null)  realBoard = Instantiate(board); //碰撞後秀出文字板
    }
}




第二顆球 程式
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bom2 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
     
    }

    // Update is called once per frame
    void Update()
    {
     
    }
    void OnTriggerEnter(Collider collision)
    {
        print("collision22222");
    } 
}



沒有留言:

張貼留言