Unity學習筆記

2021-07-24 20:05:09 字數 3301 閱讀 3465

002 變數

usingsystem;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace

_002_變數

}}

003 變數的型別

namespace

_003_變數的型別

int: long:", mybyte, score, count);//多重標記

float myfloat = 12.5

f;//小數的預設輸出是賦值給double,如果想賦值給float則需要在小數後面加上f。

double mydouble = 12.6;

console.writeline("float: double", myfloat, mydouble);

char mychar = 'a';

string

mystring = "";

string

mystring2 = "a";

bool mybool = true;

console.writeline("mychar: mystring; mystring2; mybool;", mychar, mystring, mystring2, mybool);

console.readkey();}}

}

004 定義變數儲存主角的資訊

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace

_004_定義變數儲存主角的資訊

\"\n血量:\n等級:\n經驗:", name, hp, level, exp);

console.readkey();}}

}

005 在字串前面加上@字元

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace _005_在字串前面加_字元

}}

006 變數的宣告和賦值

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace

_006_變數的宣告和賦值

\n經驗:",mp,exp);

console.readkey();}}

}

007 數**算符

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace

_007_數**算符

\n減:\n乘:\n除:\n求餘數:", res1, res2, res3, res4,res5);

console.writeline(res6);

string

str1 = "123456abc";

string

str2 = "guoguo";

string

str = str1 + str2;//+號表示兩個字串連線起來,輸出字串

string

str3 = "123456";

int num6 = 789;

string

str4 = str3 + num6;//當乙個字串和數字相加,首先把數字轉化為字串,輸出字串。

console.writeline(str);

console.writeline(str4);

console.readkey();}}

}

008 數**算符的自加自減

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace

_008_數**算符自加自減

}}

009 從鍵盤上讀取輸入的字串符

using system;

using system.collections

.generic;

using system.linq;

using system.text;

using system.threading

.tasks;

namespace

_009_從鍵盤上讀取輸入的字串

}}

010 接受使用者輸入的兩個數字並且求和

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.threading.tasks;

namespace

_010_接受使用者輸入的兩個數字並且求和

}}

011 賦值運算子

012 運算子的優先順序

namespace _012__運算子的優先順序

;;", num, num1, num2);

console.readkey();}}

}013 練習1 2

namespace _013_練習1 2}}

014 練習3 4

namespace 練習3_4}}

015 練習5 6

namespace 練習5_6}}

Unity學習筆記

1.overlapsphere 這一類overlap 的函式返回附近物件的列表 2.sendmessage 函式 嘗試呼叫指定的函式,不管目標物件的型別 eg overlapsphere 返回乙個附近物件的列表 collider hitcolliders physics.overlapsphere ...

unity學習筆記

建立乙個自定義列表 如何建立乙個註腳 注釋也是必不可少的 katex數學公式 新的甘特圖功能,豐富你的文章 uml 圖表 flowchart流程圖 匯出與匯入 你好!這是你第一次使用markdown編輯器所展示的歡迎頁。如果你想學習如何使用markdown編輯器,可以仔細閱讀這篇文章,了解一下mar...

Unity學習筆記 1 認識Unity

unity是patterns practices團隊開發的乙個輕量級 可擴充套件的依賴注入容器,具有如下的特性 它提供了建立 或者裝配 物件例項的機制,而這些物件例項可能還包含了其它被依賴的物件例項。unity允許將預先配置的物件注入到類中,實現了inversion of control ioc 的...