Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1010 B

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