使用外部Script的方法

views

keywords: script outside, members variables and global variables

reference page

應用:打倒敵人 >金幣增加

 

Script: gotHit.cs

//attach this script to zombie

//onTriggerEnter()

//if collider with tag(“zombie”)

*//statusControl.score+=100;

 

Script: statusControl.cs

//attach this script to any GUI object

//重要: public static int lives = 3; 有static 才能從外部使用它

//onGUI()

This entry was posted in 遊戲文章 by Mr.M. Bookmark the permalink.


Leave a Reply

Your email address will not be published. Required fields are marked *