Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("trigger");

        if (planeStatus == PlaneStatus.Move && other.CompareTag(formTag))
        {
            Debug.Log("collided");

            planeStatus = PlaneStatus.Return;

            transform.DOKill();
            issuedInterpolation = false;
            currentDelayTime    = 0.0f;

            if (GameController.Instance)
            {
                GameController.Instance.planeSequenceStatus = PlaneSequenceStatus.Collided;
            }

            if (LookAtCamera.Instance)
            {
                LookAtCamera.Instance.shakeCamera(0.3f, vibrato: 30);
            }
        }
    }
Ejemplo n.º 2
0
    private void Update()
    {
        if (planeStatus > PlaneStatus.Idle)
        {
            if (currentDelayTime <= 0.0f)
            {
                switch (planeStatus)
                {
                case PlaneStatus.Move:
                    issueInterpolation(this.endPosition, PlaneStatus.Return);
                    break;

                case PlaneStatus.Return:
                    issueInterpolation(this.startPosition, PlaneStatus.Ended);
                    break;

                case PlaneStatus.Ended:
                    planeStatus      = PlaneStatus.Idle;
                    currentDelayTime = 0.0f;
                    break;
                }
            }
            else
            {
                currentDelayTime -= Time.deltaTime;
            }
        }
    }
Ejemplo n.º 3
0
 private void FinishLanding()
 {
     status = PlaneStatus.Landed;
     OnMessage(string.Format("Самолет борт.№ {0} компании: {1} завершил посадку на: {2}",
                             number, firm, LandingStrip.Name));
     LandingStrip.FreeStrip();
 }
Ejemplo n.º 4
0
 public void StartLanding(strip landingStrip)
 {
     this.LandingStrip = landingStrip;
     landingStrip.OccupateStrip();
     status = PlaneStatus.Landing;
     OnMessage(string.Format("Самолет борт.№ {0} компании: {1} приступил к посадке на: {2}",
                             number, firm, landingStrip.Name));
 }
Ejemplo n.º 5
0
    private void issueInterpolation(Vector3 targetPosition, PlaneStatus targetStatus)
    {
        if (!issuedInterpolation)
        {
            issuedInterpolation = true;

            transform.DOMove(targetPosition, interpolationDuration)
            .SetEase(interpolationEase)
            .OnComplete(() => onInterpolationEnd(targetStatus));
        }
    }
    /// <summary>
    /// Event: Comfirming of plane detection
    /// </summary>
    private void OnConfirmDetection()
    {
                #if UNITY_EDITOR
        m_PreSettingUI.SetActive(false);
        m_GamingUI.SetActive(true);

        m_Scene.SetActive(true);
        float terrainSize_X = GameObject.FindWithTag("Ground").GetComponent <Terrain>().terrainData.size.x;
        float terrainSize_Z = GameObject.FindWithTag("Ground").GetComponent <Terrain>().terrainData.size.z;
        m_Scene.transform.position = Vector3.zero - new Vector3(terrainSize_X / 2, 0f, terrainSize_Z / 2);
        Debug.Log(string.Format("terrainSize.x: {0}, terrainSize.z: {1}", terrainSize_X, terrainSize_Z));

        isPlaneFound = isPlaneSet = true;
                #endif

                #if !UNITY_EDITOR && UNITY_IOS
        //	if the plane has not been found, can't display nothing
        if (!isPlaneFound)
        {
            //			gameUIElems.p_PlaneNotFounded.SetActive (true);
            Debug.Log("PlaneDetection: Have not found the plane yet, what are you trying to confirm???");
            return;
        }

        //	if the plane has already been confirmed, no need for reconfirming
        if (isPlaneSet)
        {
            //			gameUIElems.p_PlaneAlreadyConfirmed.SetActive (true);
            Debug.Log("PlaneDetection: You have confirmed already");
            return;
        }

        //	if the plane has been founded, and has not been confirmed, then confirm it.
        confirmedPlane = detectedPlane;               //	remember this founded plane
        planeStatus    = PlaneStatus.PLANE_CONFIRMED; //	update the status
        isPlaneSet     = true;

        m_GamingUI.SetActive(true);

        m_Scene.SetActive(true);
        float terrainSize_X = GameObject.FindWithTag("Ground").GetComponent <Terrain>().terrainData.size.x;
        float terrainSize_Z = GameObject.FindWithTag("Ground").GetComponent <Terrain>().terrainData.size.z;
        m_Scene.transform.position = confirmedPlane.position - new Vector3(terrainSize_X / 2, 0f, terrainSize_Z / 2);

        isPlaneFound = isPlaneSet = true;
        m_Scene.SetActive(true);

        Debug.Log("Host hit confirmPlane");

        //	reset session
        SessionSleep();
                #endif
    }
Ejemplo n.º 7
0
        public void TimeTick(int second)
        {
            if (Status == PlaneStatus.Fly)
            {
                fuel = fuel - fuelspeed * second;
            }

            if (Status != PlaneStatus.Crashed && fuel <= 0)
            {
                status = PlaneStatus.Crashed;
                OnMessage(string.Format("Самолет борт.№ {0} компании: {1} разбился", number, firm));
            }
            if (Status == PlaneStatus.Landing)
            {
                timeforland -= new TimeSpan(0, 0, second);
                if (timeforland.Ticks <= 0)
                {
                    FinishLanding();
                }
            }
        }
    //	Find a plane being referenced
    private void PlaneFinding()
    {
        if (isPlaneSet)
        {
            return;
        }

        curPlaneAnchorGO = generPlanesManager.GetARAnchorManager.GetCurrentPlaneAnchors();                      //	Get current <ARPlaneAnchorGameObject> List

        //	No plane has been detected so far
        if (curPlaneAnchorGO.Count == 0)
        {
            planeStatus = PlaneStatus.PLANE_SEARCHING;
            return;
        }

        GameObject curPlane = curPlaneAnchorGO [curPlaneAnchorGO.Count - 1].gameObject;
        MeshFilter mf       = curPlane.GetComponentInChildren <MeshFilter> ();

        if (curPlane == null || mf == null)
        {
            planeStatus = PlaneStatus.PLANE_FOUND_ERROR;
        }
        else
        {
            if (mf.transform.localScale.z >= planeSizeTrigger * 0.1f)
            {
                planeStatus   = PlaneStatus.PLANE_FOUND_OK;
                detectedPlane = mf.gameObject.transform;
                isPlaneFound  = true;
            }
            else
            {
                planeStatus = PlaneStatus.PLANE_EXPANDING;
            }
        }
    }
Ejemplo n.º 9
0
 public void SetPlane(PlaneStatus s)
 {
     _Plane = s;
 }
Ejemplo n.º 10
0
 private void onInterpolationEnd(PlaneStatus nextStatus)
 {
     planeStatus         = nextStatus;
     issuedInterpolation = false;
     currentDelayTime    = delayDuration;
 }