示例#1
0
    void Update()
    {
        if (spawnedIn && setCourse && Vector2.Distance(transform.position, destination) < 2)         //If shuttle arrived
        {
            arrivedAtStation = true;
            GameManager.Instance.shuttleArrived = true;
            setCourse = false;

            mm.SetPosition(destination);

            mm.StopMovement();
            mm.RotateTo(Orientation.Right);             //Rotate shuttle correctly so doors are facing correctly
            mm.ChangeDir(Orientation.Left);             //Reverse into station evac doors.
            StartCoroutine(ReverseIntoStation(mm));
        }

        if (arrivedAtStation && !departed)
        {
            waitAtStationTime += Time.deltaTime;
            if (waitAtStationTime > 60f)
            {
                DepartStation();
            }
        }

        if (departed && !roundEnded)
        {
            departingFlightTime += Time.deltaTime;
            if (departingFlightTime > 60f)
            {
                roundEnded = true;
                GameManager.Instance.RoundEnd();
            }
        }
    }
示例#2
0
    void Update()
    {
        if (GameManager.Instance.GetRoundTime <= 150f && spawnedIn == false && setCourse == false)        // Warp close to station 2.5 mins before round ends
        {
            SpawnNearStation();
            setCourse = true;
        }

        if (spawnedIn && setCourse && Vector2.Distance(transform.position, destination) < 2)        //If shuttle arrived
        {
            arrivedAtStation = true;
            GameManager.Instance.shuttleArrived = true;
            setCourse = false;

            mm.SetPosition(destination);

            mm.StopMovement();
            mm.RotateTo(Orientation.Right);             //Rotate shuttle correctly so doors are facing correctly
            mm.ChangeDir(Orientation.Left);             //Reverse into station evac doors.
            StartCoroutine(ReverseIntoStation(mm));
        }

        if (GameManager.Instance.GetRoundTime <= 30f && arrivedAtStation == true)         // Depart the shuttle
        {
            mm.ChangeDir(Orientation.Right);
            mm.StartMovement();
        }
    }
示例#3
0
    private void Update()
    {
        if (!CustomNetworkManager.Instance._isServer)
        {
            return;
        }

        if (moving && Vector2.Distance(transform.position, destination) < 2)            //arrived to dest
        {
            moving = false;
            mm.SetPosition(destination);
            mm.StopMovement();
            mm.RotateTo(Orientation.Up);

            if (CargoManager.Instance.ShuttleStatus == CargoShuttleStatus.OnRouteStation)
            {
                mm.ChangeDir(Orientation.Down);
                StartCoroutine(ReverseIntoStation());
            }
        }
        if (CargoManager.Instance.CurrentFlyTime <= 0f &&
            CargoManager.Instance.ShuttleStatus == CargoShuttleStatus.OnRouteCentcom)
        {
            UnloadCargo();
            CargoManager.Instance.OnShuttleArrival();
        }
    }
示例#4
0
    [Server]     //Asigns random rotation to each asteroid at startup for variety.
    public void RandomRotation()
    {
        int rand = Random.Range(0, 4);

        switch (rand)
        {
        case 0:
            mm.RotateTo(Orientation.Up);
            break;

        case 1:
            mm.RotateTo(Orientation.Down);
            break;

        case 2:
            mm.RotateTo(Orientation.Right);
            break;

        case 3:
            mm.RotateTo(Orientation.Left);
            break;
        }
    }