[Unity Tutorial Roll-a-ball 01] Creating a new project and Setting up the Game

1. 새 프로젝트 생성

2. 새로운 게임 씬 저장

File -> Save Scenes -> Assets 폴더에 _Scene 폴더 생성 -> MiniGame 저장

3. 게임 보드 (플레이 필드) 생성

GameObject -> 3D Object -> Plane 생성

Hierachy -> Plane을 Ground로 이름 변경

Transform -> 설정 (톱니바퀴 모양) -> Reset ( 오브젝트를 (0,0,0) 위치에 배치 )

Edit -> Frame Selected - 단축키 F  (씬 뷰에서 게임 오브젝트가 전체적으로 보이도록 시점 변환)

Gizmos -> Show Grid 체크 해제 (백그라운드의 눈금 표시 제거)

Transform -> Scale -> X : 2, Z : 2 로 수정 (오브젝트 크기 늘리기)

4. 플레이어 오브젝트 생성

Hierachy -> Create -> Sphere 생성

Sphere를 Player로 이름 변경 -> Transform Selection -> 설정 (톱니바퀴) -> Reset

Transform Selection -> Position -> Y : 0.5 로 수정 -> Edit -> Frame Selected (단축키 F)

5. 플레이 필드의 색상 변경하기

Project -> Create -> Folder -> Materials 폴더 생성

Materials 폴더 선택 -> Project -> Create -> Material 생성 -> Material을 Background로 이름 변경

Background -> Albido -> Color -> RGB (0, 32, 64) 로 수정

우하측의 Background 탭을 눌러서 Material 미리보기 활성화

Background material을 씬 뷰의 플레이 필드로 마우스 드로우 업

6. 플레이어가 선명하게 보이도록 조명 수정

Hireachy -> Directional Light -> Transform -> Rotation -> Y : 60 으로 수정

 

 

- Reference

[Roll-a-ball tutorial] https://unity3d.com/kr/learn/tutorials/projects/roll-ball-tutorial

[Setting up the Game] https://unity3d.com/kr/learn/tutorials/projects/roll-ball-tutorial/setting-game?playlist=17141


- Reference


xaml

        <Button x:Name="g_1" HorizontalAlignment="Left" Height="100" Margin="220,27,0,0" VerticalAlignment="Top" Width="90" Background="Black" Foreground="Lime" Content="1" FontSize="36" Click="btn_ClickL" MouseRightButtonDown="btn_ClickR"/>
        <Button x:Name="g_2" HorizontalAlignment="Left" Height="100" Margin="340,27,0,0" VerticalAlignment="Top" Width="90" Background="Black" Foreground="Lime" Content="1" FontSize="36" Click="btn_ClickL" MouseRightButtonDown="btn_ClickR"/>
        <Button x:Name="g_3" HorizontalAlignment="Left" Height="100" Margin="460,27,0,0" VerticalAlignment="Top" Width="90" Background="Black" Foreground="Lime" Content="1" FontSize="36" Click="btn_ClickL" MouseRightButtonDown="btn_ClickR"/>
        <Button x:Name="g_4" HorizontalAlignment="Left" Height="100" Margin="580,27,0,0"  VerticalAlignment="Top" Width="90" Background="Black" Foreground="Lime" Content="1" FontSize="36" Click="btn_ClickL" MouseRightButtonDown="btn_ClickR"/> 

C# 코드

 

- xaml

        <ToggleButton x:Name="move1_g" Content="1" HorizontalAlignment="Left" Margin="15,50,0,0" VerticalAlignment="Top" Width="43" Height="65" FontSize="36" BorderBrush="White" Background="Black" Foreground="White" Checked="move1_g_Checked"/>
        <ToggleButton x:Name="move2_g" Content="2" HorizontalAlignment="Left" Margin="65,50,0,0" VerticalAlignment="Top" Width="43" Height="65" FontSize="36" Background="Black" BorderBrush="White" Foreground="White" Checked="move2_g_Checked"/>
        <ToggleButton x:Name="move3_g" Content="3" HorizontalAlignment="Left" Margin="115,50,0,0" VerticalAlignment="Top" Width="43" Height="65" FontSize="36" Background="Black" BorderBrush="White" Foreground="White" Checked="move3_g_Checked"/>
        <ToggleButton x:Name="move4_g" Content="4" HorizontalAlignment="Left" Margin="165,50,0,0" VerticalAlignment="Top" Width="43" Height="65" FontSize="36" Background="Black" BorderBrush="White" Foreground="White" Checked="move4_g_Checked"/>
        <Button x:Name="ok_g" Content="MOVE" HorizontalAlignment="Left" Margin="220,50,0,0" VerticalAlignment="Top" Width="50" RenderTransformOrigin="-0.288,1.109" Height="65" Background="White" Foreground="Black" BorderBrush="Black" Click="ok_g_Click" FontWeight="Bold" />

 

- c# code

 

 

-  result

 

<Title="xaml_code" Height="200" Width="300" MinHeight="200" MinWidth="300" MaxHeight="400" MaxWidth="600">

MinWidth : 윈도우의 최소 너비

MinHeight : 윈도우의 최소 높이

MaxWidth : 윈도우의 최대 너비

MaxHeight : 윈도우의 최대 높이

- MinWidth와 MaxWidth를 같은 값으로 지정하면 윈도우의 너비가 고정이 된다.

- MinHeight와 MaxHeight를 같은 값으로 지정하면 윈도우의 높이가 고정이 된다.

1. 프로젝트에 아이콘 파일 (.ico) 추가하기


2. xaml에 Icon 추가하기

        Title="ASCII Code v.1.0.0" Height="200" Width="400" Background="Black" Icon="ascii.ico">


3. 프로젝트 Properties ->Application -> Resources -> Icon and manifest 에 Icon 변경하기


+ Recent posts