Exemple #1
0
    void Update()
    {
        GetRangeType       = RangeGenerator.GetComponent <RangeGeneratorManager>().RangeType;
        localLightPathType = PM.GetComponent <ClonePlane>().LightPathorNot;
        Debug.Log("Type is " + GetRangeType);



        if ((SizeButtonCollection.SizeButtonState != SizeButtonType.NULLL) && (StartFlag == true))
        {
            StartFlag = false;
            StartTime = Time.time;
            //Debug.Log("SSSS Time is " + StartTime);
            if (SizeButtonCollection.SizeButtonState == SizeButtonType.SMALL)
            {
                ChooseScale = "SMALL";
            }
            else if (SizeButtonCollection.SizeButtonState == SizeButtonType.MEDIUM)
            {
                ChooseScale = "MEDIUM";
            }
            else if (SizeButtonCollection.SizeButtonState == SizeButtonType.LARGE)
            {
                ChooseScale = "LARGE";
            }
        }


        if ((ButtonInteraction.PosState == PosButtonType.DONE) && (DoneFlag == true))
        {
            PATH = Application.dataPath + "/" + NameID + "_" + GetRangeType + "_" + ChooseScale + ".png";

            DoneFlag     = false;
            DoneTime     = Time.time;
            CompleteTime = DoneTime - StartTime;
            WayPointNum  = PM.transform.childCount;

            for (int i = 0; i < WayPointNum - 1; i++)
            {
                distance += Vector3.Distance(PM.gameObject.transform.GetChild(i).gameObject.transform.position, PM.gameObject.transform.GetChild(i + 1).gameObject.transform.position);
                //Debug.Log("DD is : " + distance);
            }

            //Debug.Log("Finish Time is " + CompleteTime);


            //Debug.Log("AAAAAAA");
            Invoke("ButtonSetInActive", 1.0f);

            //Debug.Log("BBBBBBB");
            Invoke("CapturePicture", 5.0f);

            /*
             * if(localLightPathType == LightPathorNot.LightPathOff)
             * {
             *  if(distance >= FullDistance)
             *  {
             *      FinalScore = "76.18561";
             *  }
             *  else
             *  {
             *      FinalScore = ((distance/FullDistance) * 100).ToString("0.0000");
             *  }
             *
             *
             *  Debug.Log("OFF is " + FinalScore);
             *  msg = "Date Time: " + NowDateTime +" , Name: " + NameID + " , Scale: " + ChooseScale + " , RangeType: " + GetRangeType
             + " , Time: " + CompleteTime + " , WayPoint: " + WayPointNum + " , Distance: " + distance + " Score: " + FinalScore + ", PathType: " + localLightPathType ;
             +  Debug.Log(msg);
             +  WriteData(msg);
             + }
             + else
             + {
             +  if(GetRangeType == RangeType.L)
             +  {
             +      Invoke("NoAuguCallPythonLVersion", 7.0f);
             +  }
             +  else
             +  {
             +      Invoke("NoAuguCallPython", 7.0f);
             +  }
             + }*/

            if (GetRangeType == RangeType.L)
            {
                Invoke("NoAuguCallPythonLVersion", 7.0f);
            }
            else
            {
                Invoke("NoAuguCallPython", 7.0f);
            }
        }


        LocalClear = ClearManager.GetComponent <ClearAll>().clear;
        //Debug.Log("LLLLL: " + LocalClear);
        if (LocalClear == true)
        {
            DoneFlag   = true;
            StartFlag  = true;
            FinalScore = "";
            //Debug.Log("LLLLL");
            Invoke("ButtonSetActive", 0.5f);
        }
    }
    // Update is called once per frame
    void Update()
    {
        LMChildCount = LightManager.transform.childCount;
        Debug.Log("Light Count: " + LMChildCount);
        PMChildCount       = this.transform.childCount;
        localLightPathType = this.GetComponent <ClonePlane>().LightPathorNot;
        Debug.Log("LightPath Type: " + localLightPathType);
        //LineValid = this.GetComponent<ClonePlane>().LineCollision;
        //CollisionNum = this.GetComponent<ClonePlane>().LineCollisionNum;
        //Debug.Log("Line ID: " + LineValid + " NUM: " + CollisionNum);


        if (ButtonInteraction.PosState == PosButtonType.DONE)
        {
            ALLLightSetActive(LMChildCount);
        }



        if ((localLightPathType == LightPathorNot.LightPathOff) && (ButtonInteraction.PosState != PosButtonType.DONE) && (PMChildCount > 1))
        {
            //Debug.Log("OOOFFFFFFFFFF");
            ALLLightSetNOTActive(LMChildCount);
        }
        else if (localLightPathType == LightPathorNot.LightPathOn)
        {//Debug.Log("OoooooNNNN");
            for (int i = 0; i < PMChildCount; i++)
            {
                bool val = this.gameObject.transform.GetChild(i).gameObject.GetComponent <DroneSizeButtonDistance>().DroneValid;
                if ((val == false) && (i > 0) /*||( (i > 0) && CollisionNum != -1 (LineValid == false))*/)
                {
                    LightSetNOTActive(i);
                    //if(CollisionNum >= 0) LightSetNOTActive(CollisionNum);
                    //Debug.Log("FFFFFF: " + i );
                }
                else if ((val == true) && (i > 0) /*&& (LineValid == true)*/)
                {
                    LightSetActive(i);
                    //Debug.Log("OOOOOO: " + i);
                }



                //Debug.Log("i: " + i + "  CurrentNotValidNum: " +this.gameObject.transform.GetChild(i).gameObject.GetComponent<DroneSizeButtonDistance>().DroneValid);
            }
        }

        //for(int i = 0; i < PMChildCount; i ++)
        //{
        //  bool val = this.gameObject.transform.GetChild(i).gameObject.GetComponent<DroneSizeButtonDistance>().DroneValid;
        //if((val == false) && (i > 0) /*||( (i > 0) && CollisionNum != -1 (LineValid == false))*/ )
        //{
        //  LightSetNOTActive(i);
        //if(CollisionNum >= 0) LightSetNOTActive(CollisionNum);
        //Debug.Log("FFFFFF: " + i );
        //}
        //else if((val == true) && (i > 0 ) /*&& (LineValid == true)*/)
        //{
        //  LightSetActive(i);
        //Debug.Log("OOOOOO: " + i);
        //}



        //Debug.Log("i: " + i + "  CurrentNotValidNum: " +this.gameObject.transform.GetChild(i).gameObject.GetComponent<DroneSizeButtonDistance>().DroneValid);


        //}
    }