Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class PlaceDoor : MonoBehaviour
  6. {
  7. Room _room;
  8. public enum DOOR_TYPES
  9. {
  10. OPEN_DOOR = 0,
  11. CLOSED_DOOR = 1,
  12. LOCKED_DOOR = 2
  13.  
  14. }
  15.  
  16. [SerializeField]
  17. private DOOR_TYPES _roomType;
  18. [SerializeField]
  19. private Sprite _openDoor;
  20. private int AmountTypes = 0;
  21.  
  22. void Start()
  23. {
  24.  
  25. _room = GetComponent<Room>();
  26. Doors();
  27. }
  28.  
  29. void Doors()
  30. {
  31.  
  32. switch (AmountTypes)
  33. {
  34. case 0:
  35. Debug.Log("OpenDoor");
  36. SpawnDoor(_openDoor,new Vector2(this.transform.position.x /2,0));
  37. break;
  38. case 1:
  39. Debug.Log("Close");
  40. break;
  41. case 2:
  42. Debug.Log("locked");
  43. break;
  44.  
  45. default:
  46. Debug.Log("no doors");
  47. break;
  48. }
  49. }
  50.  
  51. void SpawnDoor(Sprite sprite, Vector2 Location)
  52. {
  53. Instantiate(sprite, Location, Quaternion.identity);
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement