BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / Platform / Samples / VrBoardGame / Scripts / GamePiece.cs

GamePiece.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
GamePiece.cs 1010 B Download Raw
1namespace Oculus.Platform.Samples.VrBoardGame
2{
3 using UnityEngine;
4 using System.Collections;
5
6 public class GamePiece : MonoBehaviour
7 {
8 [SerializeField] private Piece m_type = Piece.A;
9
10 // Prefab for the game pieces
11 [SerializeField] private GameObject m_prefabA = null;
12 [SerializeField] private GameObject m_prefabB = null;
13 [SerializeField] private GameObject m_prefabPower = null;
14
15 public enum Piece { A, B, PowerBall }
16
17 private BoardPosition m_position;
18
19 public Piece Type
20 {
21 get { return m_type; }
22 }
23
24 public BoardPosition Position
25 {
26 get { return m_position; }
27 set { m_position = value; }
28 }
29
30 public GameObject Prefab
31 {
32 get
33 {
34 switch (m_type)
35 {
36 case Piece.A: return m_prefabA;
37 case Piece.B: return m_prefabB;
38 default: return m_prefabPower;
39 }
40 }
41 }
42
43 public GameObject PrefabFor(Piece p)
44 {
45 switch (p)
46 {
47 case Piece.A: return m_prefabA;
48 case Piece.B: return m_prefabB;
49 default: return m_prefabPower;
50 }
51 }
52
53 }
54}