Codility – Lesson 2 Arrays – CyclicRotation

プログラミング能力を評価するオンラインテスト、Codilityで、Lesson 2 Arrays – CyclicRotationに回答しました。

問題と結果画面
100%の評価。

Codility – Lesson 1 Iterations – BinaryGap

プログラミング能力を評価するオンラインテスト、Codilityで、Lesson 1 Iterations – BinaryGapに回答しました。

問題と結果画面
100%の評価。

Null Coalescing Operator

41q0omfytxl-_sx331_bo1204203200_

C# 5.0 in a Nutshell: The Definitive Reference by Definitive Reference Kindle Edition
by Joseph Albahari, Ben Albahari.

The ?? operator:
– can be used with both nullable types and reference types.
– says “If the operand is non-null, give it to me; otherwise, give me a default value.”
– equivalent to calling GetValueOrDefault with an explicit default value, except that the expression for the default value is never evaluated if the variable is not null.

Albahari & Albahari, C# 5.0 In a Nutshell: The Definitive Reference, 156-157.

Unity Shader Experiment – Sprite Sheets –

シェーダーの実験。
クリックすると、別ウィンドウが開きます。

Screen Shot 2013-11-04 at 21.51.33

※ブラウザはSafariを使用してください。

cube のテクスチャーに、スプライトシートによるアニメーションを投影する自作シェーダー。

ソースコード

Unity 使用。
Cg/HLSL で記述。

自動ドアの制御(3) Trigger Collision Detection

Unity勉強会用の資料として。
自動ドアの制御の3つのやり方、その3。

—————————————————
3つの衝突判定
・Collision Detection [detecting]:コライダーがぶつかっているかどうかで判定。
・Ray Casting [drawing]:コライダーがぶつかる前に、ベクターで対象を検知。
・Trigger Collision Detection [detecting]:コライダーの領域内にもう1つのコライダーが重なっているかどうかで判定。
—————————————————

Approach 3 : Trigger collision detection

Screen-Shot-2013-09-13-at-23.42

デモはこちら。

コライダーの領域内にもう1つのコライダーが重なっているかどうかで判定。
特徴:一定の距離に近づくとドアが開く。
欠点:特になし。

—————————————————
小屋に Box Collider で衝突領域を指定し、以下のスクリプト TriggerZone を適用する。

—————————————————
ドアにスクリプト DoorManager を適用する。(自動ドアの制御(2) Ray Casting と同様)

ページトップへ