Labels

Friday, April 1, 2016

Unity入门教程之ROLL-A-BALL 学习笔记 Part I

Unity入门教程

之ROLL-A-BALL 学习笔记

1     环境和PLAYER设置

1.1    环境Environnement 设置

创建新场景:File->New Scene(Ctrl + S)
创建Gameboard/Play Field: GameObject->3D Object -> Plane
重命名新建Plane名称 :点击Plane,按下Enter重命名
Reset Object:单击右上方的 Context sensitive gear menu -> Reset
Reset Object 使object的Postion调整在x=0, y=0, z=0
To see the entire game object in the Scene View: Edit -> Frame Selected (F)
显示/关闭Grid lines:在Scene View的Gizmo菜单下选择或取消选择Show Grid
Rescale object有三种方法:

1.      快捷键R,拉动三个坐标轴
2.      在inspector菜单下的Transform栏里拖动Scale
3.      在inspector菜单下的Transform栏里填写Scale数值
注意:Rescale plane时要注意plane没有volume所以scale plane的y坐标轴没有意义,通常y=1
创建objet三部曲:
1.      Rename
2.      Reset position
3.      Frame Selected
更改objet颜色三部曲:
1.      创建Materials文件夹,选中Materials文件下,Project栏Create->Material
2.      inspector菜单下Aibedo栏更改颜色
3.      拖动Material 到Scene View中需要着色的object
转动the main directional light : 选中Directional Ligth在Transform Component中更爱Rotation x=50 y=60 z=0,以达到更好的光照效果

1.2    PLAYER设置

给object增加physics属性:先选择object,Component ->Physics ->Rigidbody ;或者是在inspector菜单下点击Add Component->Physics ->Rigidbody 
如何让player得到外界input:
1.      新建Scripts放置C# scripts
2.      inspector菜单下点击Add Component->New Scripts (both create and attach script in one step), 重命名script为PlayerController
3.      把新建的script拖入scripts文件夹中
Start:is called on the first frame that the script is active,放置初始化code
Update:is called before rendering a frame,放置一般code
FixUpdate:is called just before performing any physics calculations,放置physics code
LateUpdate:it is guaranteed to run after all items have been processed in update,for follow cameras, procedural animation and gathering last known states
注意:Script里的public变量可以在Inspector菜单里直接赋值,方便调试
数据结构:
·        Rigidbody,为object增加物理属性,使用AddForce(Vector3)方法使object移动
·        Vector3, 三个方向的数据结构

Wednesday, March 23, 2016

英语月份简写与法语月份简写对比

英语月份简写与法语月份简写对比

最近在改CV发现了不少Typo,比如月份简写时不小心就会英法混淆,特将英法月份简写总结如下,以供大家查阅

English
Français
Janauary, Jan.
Janvier, Janv.
February, Feb.
Févier, Févr.
March, Mar.
Mars, Mars
April, Apr.
Avril, Avr.
May, May
Mai, Mai
June, June
Juin, Juin
July, July
Juillet, Juil. ou Juill.
August Aug.
Août, Août
September, Sept.
Septembre, Sept.
Ocotober, Oct.
Octobre, Oct.
November, Nov.
Novembre, Nov.
December, Dec.
Décembre, Déc.

Monday, March 21, 2016

Comment Mettre un ducument PDF sur blogger

Comment Mettre un ducument PDF sur blogger

Étape 1:


Accédez au Google Drive, se positionnez dans un dossier et cliquez sur NOUVEAU->Importer un fichier, téléversez le PDF fichier, et puis faites un clic droit sur Partager.

Étape 2:



En bas à droit, cliquez sur Avancé, et puis cliquez Modifier.

Étape 3:



Par Default, votre fichiers sont privés, mais pour les partager sur Internet, il faut activer Partage par lien afin que votre PDF puisse accéder par autres personnes. Ensuite, copiez le lien de partage.

Étape 4:

Accédez au votre Blogger, entrez dans le mode HTML, insérez le code comme ci-dessous
<iframe height="800" src="https://drive.google.com/file/d/0B44cKhxG8yavbU1nVTYzejdkQW8/preview" width="600">Rapport ESH431</iframe>
Remplacez le lien en rough par votre lien de partage, et noubliez pas d'effacez le lien après le dernier slash et ajoutez preview

ESH 431: Politique Marketing Rapport du Bureau d'Étude

Sunday, March 6, 2016

JAVA基础回顾 Part IV:JAVA数据结构

Jinhai‘s JAVA cheat sheet

Codecademy学习笔记 Part IV

for循环 for loop

for (int counter = 0; counter < 5; counter++) {

    System.out.println("The counter value is: " + counter);

}

for循环里有以下几个部分
  • 初始化(initialization): the int variable named counter is initialized to the value of 0 before the loop is run.
  • 测试条件(test condition): the Boolean expression counter < 5 is a conditional statement that is evaluated before the code inside the control statement is run every loop. If the expression evaluates to true, the code in the block will run. Otherwise, if the expression evalutes to false, the for loop will stop running.
  • 增量(increment): Each time the loop completes, the increment statement is run. The statement counter++ increases the value of counter by 1 after each loop.

ArrayList

声明ArrayList (Declaring an ArrayList)
ArrayList<Integer> quizGrades = new ArrayList<Integer>();
对ArrayList的操作(Manipulation)
增加元素add
ArrayList<Integer> quizGrades = new ArrayList<Integer>();
quizGrades.add(95);
quizGrades.add(87);
quizGrades.add(83);
取出(Access)元素
System.out.println( quizGrades.get(0));
插入(Insertion)元素
quizGrades.add(0, 100);//add(index,data)


注意:在原本index为0的地方插入
遍历ArrayList(Iterating over an ArrayList)
for (int i = 0; i < quizGrades.size(); i++) {

    System.out.println( quizGrades.get(i) );

}

或者使用for each loop
取出(Access)元素
for (Integer temperature : weeklyTemperatures) {

    System.out.println(temperature);

}

散列表(HashMap)

类似于Python里的dictionary
声明 HashMap (Declaring a HashMap)
HashMap<String, Integer> myFriends = new HashMap<String, Integer>();
增加元素put
HashMap<String, Integer> myFriends = new HashMap<String, Integer>();
myFriends.put("Mark", 24);
myFriends.put("Cassandra", 25);
myFriends.put("Zenas", 21);
取出(Access)元素
System.out.println( myFriends.get("Zenas") );//output is 21

遍历HashMap(Iterating over a HashMap)
HashMap的keySet方法返回一个键值列表(a list of keys)
System.out.println( myFriends.size() );
for (String name: myFriends.keySet()) {
    System.out.println(name + " is age: " + myFriends.get(name));
}

JAVA数据结构总结

  • for循环 For Loops: used to repeatedly run a block of code
  • for each循环 For Each Loops: a concise version of a for loop 
  • ArrayList: stores a list of data 
  • HashMap: stores keys and associated values like a dictionary

JAVA基础回顾 Part III:JAVA面向对象

Jinhai‘s JAVA cheat sheet

Codecademy学习笔记 Part III

类句法 class syntax

class Car {

    int modelYear;//instance variable

    public Car(int year) {//constructor

        modelYear = year;

    }
    public void startEngine() {//method without parameter or returned value
        System.out.println("Vroom!");
    }

    public void drive(int distanceInMiles) {//method with parameter but no returned value

        System.out.println("Miles driven: " + distanceInMiles);

    }
    public int numberOfTires() {//method without parameter but a returned value

        return 4;

    }

    public static void main(String[] args){//the main method

        Car myFastCar = new Car(2007);
        myFastCar.startEngine();
        myFastCar.drive(1628);


    }
}

JAVA面向对象总结

  • 类 Class: a blueprint for how a data structure should function
  • 构造函数 Constructor: instructs the class to set up the initial state of an object
  • 对象 Object: instance of a class that stores the state of a class
  • 方法 Method: set of instructions that can be called on an object
  • 参数 Parameter: values that can be specified when creating an object or calling a method
  • 返回值 Return value: specifies the data type that a method will return after it runs
  • 继承 Inheritance: allows one class to use functionality defined in another class

public static void main(String[] args ) 解释

  • public 表示可见度(visibility),它可以是 public, private, protected 或者 (如果省略的话) default.
  • static 是一个特殊的(可选的)关键字,表示接下来的方法可在不创建实例(instance)的情况下被调用。如果没有static的话,需要 实例化(instantiate)这个类,然后从这个类的对象(object)调用该方法。
  • void 表示该方法的返回值类型(return type), void表示该函数返回值为空。方法必须有返回值。
  • main( ... ) 表示该方法的名称。方法需要命名。具有参数也表明了它是一个方法
  • String[] args 是该方法的唯一参数(parameter)。 String[] 是该参数的类型, 表示字符串数组(array of Strings)。 args 是该参数的名字。参数需要命名。

JAVA基础回顾 Part II:Java条件语句以及控制流

Jinhai‘s JAVA cheat sheet

Codecademy学习笔记 Part II

布尔操作符boolean operators
  1. &&: and
  2. ||: or
  3.  !  : not
if语句
比较,等价,布尔操作符都可以用在控制流中
int shoeSize = 10;

if (shoeSize > 12) {
    System.out.println("Sorry, your shoe size is currently not in stock.");
} else if (shoeSize >= 6) {
    System.out.println("Your shoe size is in stock!");
} else {
    System.out.println("Sorry, this store does not carry shoes smaller than a size 6.");
}
三元表达式ternary expression
int pointsScored = 21;

char gameResult = (pointsScored > 20) ? 'W' : 'L';
System.out.println(gameResult);
条件语句conditional statements
int restaurantRating = 3;

switch (restaurantRating) {
    case 1: System.out.println("This restaurant is not my favorite.");
      break;
    case 2: System.out.println("This restaurant is good.");
      break;
    case 3: System.out.println("This restaurant is fantastic!");
      break;
    default: System.out.println("I've never dined at this restaurant.");
      break;
}