Пример #1
0
    public void Setup(MyRoomData data)
    {
        this.mydata        = data;
        this.roomName.text = data.room_name;
        GameObject newOffice = (GameObject)GameObject.Instantiate(targetPrefab);

        newOffice.transform.position = new Vector3(mydata.xCoord, mydata.yCoord, mydata.zCoord);
        targetDestination            = newOffice.transform;
        RoomObject prefab = newOffice.GetComponent <RoomObject>();

        prefab.Setup(data);

        GameObject  child    = newOffice.transform.GetChild(0).gameObject;
        TextMeshPro roomName = child.GetComponent <TextMeshPro>();

        roomName.text = data.room_name;
        if (data.location == "B")
        {
            newOffice.layer = 12;
            child.layer     = 12;
        }
        else if (data.location == "G")
        {
            newOffice.layer = 13;
            child.layer     = 13;
        }
        else if (data.location == "S")
        {
            newOffice.layer = 14;
            child.layer     = 14;
        }
    }
Пример #2
0
    void Awake()
    {
        //Initialize references
        levMan   = transform.parent.gameObject;
        roomdata = gameObject.GetComponent <MyRoomData>();

        //Spawn parents to contain the various prefabs to be spawned, to keep the hierarchy clean
        SpawnFillerParents();
    }
Пример #3
0
 private void Assignpersonnel(MyRoomData roomData)
 {
     foreach (GameObject person in personObjects)
     {
         var personData = person.GetComponent <PersonPrefab>().data;
         if (roomData.room_name == personData.assigned_office_name)
         {
             person.transform.SetParent(activePanel, false);
         }
     }
 }
Пример #4
0
 private void RegisterMouseInput()
 {
     // Dragging me??
     if (IsSelected && MapEditor.IsDraggingSelectedRoomTiles())
     {
         // Update my RoomData's PosGlobal!!
         Vector2 newPosGlobal = MapEditor.MousePosWorldDraggingGrid(mouseClickOffset);
         MyRoomData.SetPosGlobal(newPosGlobal);
         ApplyPosition();
     }
 }
Пример #5
0
    void Awake()
    {
        //Initialize references
        myRoom   = transform.parent.gameObject;
        roomData = myRoom.GetComponent <MyRoomData>();

        //Set the number of lasers to be spawned in my room
        //Needs to be updated to the new refactoring standards
        spawnCount = roomData.howManyLasers /*10*/;

        //Spawn parents to contain the various prefabs to be spawned, to keep the hierarchy clean
        SpawnComponentParents();
    }
Пример #6
0
    void Awake()
    {
        levMan           = GameObject.Find("LevelManager").GetComponent <LevelManager>();
        myParentRoomData = transform.parent.GetComponent <MyRoomData>();
        pMove            = GameObject.FindWithTag("Player").GetComponent <PlayerMove> ();

        if (myParentRoomData.hasLasers)
        {
            laserParent = transform.parent.Find("LaserParent").gameObject;
        }
        else
        {
            lasersAlreadyDisabled = true;
        }
    }
Пример #7
0
 public void MoveToDestination(Transform target, MyRoomData data)
 {
     ReloadPersonnel();
     agent.isStopped = false;
     this.target     = target;
     this.roomData   = data;
     roomName.text   = data.room_name;
     roomDesc.text   = data.room_desc;
     agent.SetDestination(target.position);
     if (CheckPersonnelCount(data))
     {
         menuController.ShowPersonnelPanel();
         Assignpersonnel(data);
     }
     else
     {
         menuController.HidePersonnelPanel();
     }
 }
Пример #8
0
    private bool CheckPersonnelCount(MyRoomData data)
    {
        int count = 0;

        foreach (GameObject person in personObjects)
        {
            var personData = person.GetComponent <PersonPrefab>().data;
            if (data.room_name == personData.assigned_office_name)
            {
                count++;
            }
        }
        if (count > 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Пример #9
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         if (!done)
         {
             MyRoomData otherData = other.gameObject.GetComponent <RoomObject>().data;
             if (CheckPersonnelCount(otherData))
             {
                 foreach (GameObject person in personObjects)
                 {
                     MyPersonData personData = person.GetComponent <PersonPrefab>().data;
                     if (otherData.id == personData.id)
                     {
                         person.transform.SetParent(activePanel, false);
                     }
                 }
                 menuController.ShowPersonnelPanel();
             }
             else
             {
                 menuController.HidePersonnelPanel();
             }
             roomName.text = otherData.room_name;
             roomDesc.text = otherData.room_desc;
             menuController.ShowRoomInfo();
             done = true;
         }
     }
     else if (other.gameObject.tag == "GroundFloor")
     {
         if (groundF)
         {
             var newMask = oldMask & ~(1 << 13);
             newMask             = newMask & ~(1 << 9);
             newMask             = newMask | (1 << 8);
             newMask             = newMask | (1 << 12);
             miniMap.cullingMask = newMask;
             groundF             = false;
             ShowFurniture("Basement");
         }
         else
         {
             var newMask = oldMask & ~(1 << 8);
             newMask             = newMask & ~(1 << 12);
             newMask             = newMask | (1 << 9);
             newMask             = newMask | (1 << 13);
             miniMap.cullingMask = newMask;
             groundF             = true;
             ShowFurniture("Ground");
         }
     }
     else if (other.gameObject.tag == "SecondFloor")
     {
         if (secondF)
         {
             var newMask = oldMask & ~(1 << 10);
             newMask             = newMask & ~(1 << 14);
             newMask             = newMask | (1 << 9);
             newMask             = newMask | (1 << 13);
             miniMap.cullingMask = newMask;
             groundF             = true;
             secondF             = false;
             ShowFurniture("Ground");
         }
         else
         {
             var newMask = oldMask & ~(1 << 13);
             newMask             = newMask & ~(1 << 9);
             newMask             = newMask | (1 << 10);
             newMask             = newMask | (1 << 14);
             miniMap.cullingMask = newMask;
             groundF             = false;
             secondF             = true;
             ShowFurniture("Second");
         }
     }
     else if (other.gameObject.tag == "Entrance")
     {
         var newMask = oldMask & ~(1 << 8);
         newMask             = newMask & ~(1 << 12);
         newMask             = newMask | (1 << 9);
         newMask             = newMask | (1 << 13);
         miniMap.cullingMask = newMask;
         groundF             = true;
         ShowFurniture("Ground");
     }
 }
Пример #10
0
 public void Setup(MyRoomData data)
 {
     this.data = data;
 }
Пример #11
0
 void Awake()
 {
     //Initialize references
     levMan   = GameObject.FindWithTag("LevelManager").GetComponent <LevelManager>();
     roomData = transform.parent.GetComponentInParent <MyRoomData>();
 }