示例#1
0
    // Use this for initialization
    void Start()
    {
        gameObject.GetComponent <SpriteRenderer>().sprite = sprites[Random.Range(0, sprites.Length)];
        frozen = false;

        controller = GameObject.Find("Game Controller").GetComponent <GameController>();
        init       = GameObject.Find("Game Controller").GetComponent <Initialize>();
        elevator   = controller.GetElevator();

        cardManager = controller.GetCardManager();

        passengerName = NameGenerator.Name();
        job           = NameGenerator.Job();
        rage          = 0;
        timeAlive     = -1.0f;

        positionOnLift = Random.Range(-0.9f, 1.1f);

        do
        {
            floor = Random.Range(1, init.NoOfFloors() + 1);
        } while (floor == elevator.GetFloor());
        elevator.Lock();

        card = cardManager.ConstructCard(this);

        StartCoroutine(MoveToPosition(new Vector3(positionOnLift, -0.25f, -1), 1.0f, false));
    }
示例#2
0
 private void LeaveElevator()
 {
     timeAlive = -1.0f;
     cardManager.DismissCard(card);
     elevator.Lock();
     controller.RemovePassenger(this);
     StartCoroutine(MoveToPosition(new Vector3(6, -0.25f, -1), 1.0f, true));
 }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        if (isRunning)
        {
            timePlaying += Time.deltaTime * 6.0f;
            bool isAm;
            timeText.text = ToClockString(timePlaying, out isAm, 540.0f);
            if (isAm)
            {
                aMPMText.text = "AM";
            }
            else
            {
                aMPMText.text = "PM";
            }
        }
        else
        {
            if (!isRunning)
            {
                if (Input.GetKeyDown(KeyCode.RightArrow) && !isEnding)
                {
                    isRunning = true;
                    StopCoroutine(a);
                    StartCoroutine(FadeOutMessageOfTheDay());
                }
            }
            else
            {
                if (Input.GetKeyUp(KeyCode.Space) && isOver)
                {
                    RequestGameRestart();
                }
            }
        }

        if (isRunning && timePlaying >= 480)
        {
            isRunning = false;
            isEnding  = true;
            StartCoroutine(FlashClock());
        }

        if (isEnding && passengers.Count == 0)
        {
            isEnding = false;
            elevator.Lock();
            StartCoroutine(EndDayFadeOut());
        }
    }