forked from cgvr/DeltaVR
		
	
		
			
				
	
	
		
			73 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using UnityEngine;
 | 
						|
 | 
						|
public enum ElevatorMoveState
 | 
						|
{
 | 
						|
    NotMoving,
 | 
						|
    Ascending,
 | 
						|
    Decending
 | 
						|
}
 | 
						|
 | 
						|
public class ElevatorStatusPlate : MonoBehaviour
 | 
						|
{
 | 
						|
    [System.Serializable]
 | 
						|
    public struct FloorNumbers
 | 
						|
    {
 | 
						|
        public int floorNumber;
 | 
						|
        public GameObject floorNumberSprite;
 | 
						|
    }
 | 
						|
 | 
						|
    public List<FloorNumbers> floorNumbers;
 | 
						|
 | 
						|
    public GameObject upArrow;
 | 
						|
    public GameObject downArrow;
 | 
						|
 | 
						|
    private ElevatorMoveState moveState;
 | 
						|
 | 
						|
 | 
						|
    // Start is called before the first frame update
 | 
						|
    void Start()
 | 
						|
    {
 | 
						|
        SetMoveState(ElevatorMoveState.NotMoving);
 | 
						|
    }
 | 
						|
 | 
						|
    public void SetMoveState(ElevatorMoveState newState)
 | 
						|
    {
 | 
						|
        if (newState == ElevatorMoveState.NotMoving)
 | 
						|
        {
 | 
						|
            upArrow.SetActive(false);
 | 
						|
            downArrow.SetActive(false);
 | 
						|
        }
 | 
						|
        else if (newState == ElevatorMoveState.Ascending)
 | 
						|
        {
 | 
						|
            upArrow.SetActive(true);
 | 
						|
            downArrow.SetActive(false);
 | 
						|
        }
 | 
						|
        else
 | 
						|
        {
 | 
						|
            upArrow.SetActive(false);
 | 
						|
            downArrow.SetActive(true);
 | 
						|
        }
 | 
						|
        this.moveState = newState;
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
    public void UpdateDisplayFloorNumber(int newValue)
 | 
						|
    {
 | 
						|
        foreach (var f in floorNumbers)
 | 
						|
        {
 | 
						|
            if (f.floorNumber != newValue)
 | 
						|
                f.floorNumberSprite.SetActive(false);
 | 
						|
            else
 | 
						|
                f.floorNumberSprite.SetActive(true);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    // Update is called once per frame
 | 
						|
    void Update()
 | 
						|
    {
 | 
						|
        
 | 
						|
    }
 | 
						|
}
 |