Inheritance: MonoBehaviour
Esempio n. 1
0
 public Clock()
 {
     // 初回生成時は実行時の前フレームの時間分減らして補正する。
     // フレームに入ってからの誤差の補正はこのフレームではできないのでしない。
     dateTime = System.DateTime.Now.AddSeconds(-Time.deltaTime);
     frame    = Time.frameCount;
     ClockBehaviour.GetInstance().clocks.Add(this);
 }
	// Use this for initialization
	void Start () 
    {
        clock = GameObject.Find("Clock").GetComponent<ClockBehaviour>();

        acamera = Camera.main.GetComponent<AdvancedCamera>();
        bigEventTimer = 0;
        bigEventMaxTimer = Random.Range(200, 400);
        bigEventObject = Global.getChildGameObject(Camera.main.gameObject, "Clash Event");
	}
Esempio n. 3
0
 void Awake()
 {
     clockBehaviour = GameObject.Find("Clock").GetComponent<ClockBehaviour>();
     onClickChange = GameObject.Find("Main Camera").GetComponent<OnClickChange>();
     randomAllocation = GameObject.Find("ListController").GetComponent<RandomAllocation>();
     controlLists = GameObject.Find("ListController").GetComponent<ControlLists>();
     wrong = false;
     show = false;
 }
    // Use this for initialization
    void Start()
    {
        clock = GameObject.Find("Clock").GetComponent <ClockBehaviour>();

        acamera          = Camera.main.GetComponent <AdvancedCamera>();
        bigEventTimer    = 0;
        bigEventMaxTimer = Random.Range(200, 400);
        bigEventObject   = Global.getChildGameObject(Camera.main.gameObject, "Clash Event");
    }
Esempio n. 5
0
 public static ClockBehaviour GetInstance()
 {
     if (instance == null)
     {
         var g = new GameObject("ClockBehaviour");
         instance = g.AddComponent <ClockBehaviour>();
         DontDestroyOnLoad(g);
     }
     return(instance);
 }
Esempio n. 6
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (hasEnteredBefore == false)
        {
            hasEnteredBefore = true;

            clockBehaviour = new ClockBehaviour();
            clockBehaviour.executionTimerFinish          += executionTimerFinish;
            clockBehaviour.executionTimerStart           += executionTimerStart;
            clockBehaviour.pauseBetweenRepetitionsStart  += pauseBetweenRepetitionsStart;
            clockBehaviour.pauseBetweenRepetitionsFinish += pauseBetweenRepetitionsFinish;
        }
        if (this._BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            return;
        }
        defaultAnimationLength = stateInfo.length;

        //Está la animación en caché
        if (PreparedExercises.tryGetPreparedExercise(new Exercise(movement, limb), out this._timeAndAngles, stateInfo.length))
        {
            //Repetición de preparación
            if (this._BehaviourState != AnimationBehaviourState.PREPARING_DEFAULT && this._BehaviourState != AnimationBehaviourState.PREPARING_WEB)
            {
                this.StartLerp();
            }

            else if (this._BehaviourState == AnimationBehaviourState.PREPARING_DEFAULT)
            {
                //OnRepetitionEnd();
                _BehaviourState  = AnimationBehaviourState.PREPARING_WITH_PARAMS;
                timeSinceCapture = 0;
                this.StartLerp();
            }

            else if (this._BehaviourState == AnimationBehaviourState.PREPARING_WEB)
            {
                OnRepetitionEnd();
                Stop();
            }
        }
        //No está la animación en caché
        else
        {
            if (this._BehaviourState == AnimationBehaviourState.PREPARING_DEFAULT || this._BehaviourState == AnimationBehaviourState.PREPARING_WEB)
            {
                this._timeAndAngles = new List <AnimationInfo>();
                this.StartLerp();
            }
            else
            {
                throw new Exception("Animation not prepared");
            }
        }
    }
Esempio n. 7
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (_BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            if (this.IsCentralNode)
            {
                animator.speed = 0;
            }
            return;
        }

        if (this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS && !IsCentralNode && !IsWeb)
        {
            this.CentralNode.OnRepetitionReallyStart();
        }

        if (!this.IsCentralNode && this.CentralNode.randomAnimations[0] == this.movement)
        {
            IsRewinding = false;
        }

        if (this.IsCentralNode && hasEnteredBefore == false)
        {
            hasEnteredBefore = true;

            clockBehaviour = new ClockBehaviour();
            clockBehaviour.executionTimerFinish          += executionTimerFinish;
            clockBehaviour.executionTimerStart           += executionTimerStart;
            clockBehaviour.pauseBetweenRepetitionsStart  += pauseBetweenRepetitionsStart;
            clockBehaviour.pauseBetweenRepetitionsFinish += pauseBetweenRepetitionsFinish;
        }

        if (this._BehaviourState == AnimationBehaviourState.PREPARING_WEB || this._BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS)
        {
            OnRepetitionEnd();
            Stop();
        }
        else if (this._BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS || this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS ||
                 this._BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            //Como en este behaviour se utiliza animation.Play para cada repetición, se entra más de una vez al metodo OnStateEnter,
            //por lo que si ya se ha entrado alguna vez, la velocidad se asigna como 0 para que se respete el tiempo entre ejecución
            //antes de comenzar la siguiente repetición.

            //Se asume que si el ejercicio utiliza solo un tipo de velocidad, el forwardspeed y backwardspeed serán iguales.

            animator.speed = this.CentralNode._RealParams.ForwardSpeed;
        }/*
          * if (IsCentralNode)
          * Debug.Log("entre central ");
          * else
          * Debug.Log("entre ");*/
    }
    private void OnEnable()
    {
        if (textObj != null)
        {
            text = textObj.GetComponent <TextMeshProUGUI>();
        }

        c = new ClockBehaviour();

        s = new StopwatchBehaviour();

        //t = new TimerBehaviour();

        AddBehaviour(c);

        AddBehaviour(s);

        //AddBehaviour(t);
    }
Esempio n. 9
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) 
    {
        if (hasEnteredBefore == false)
        {
            hasEnteredBefore = true;

            clockBehaviour = new ClockBehaviour();
            clockBehaviour.executionTimerFinish += executionTimerFinish;
            clockBehaviour.executionTimerStart += executionTimerStart;
            clockBehaviour.pauseBetweenRepetitionsStart += pauseBetweenRepetitionsStart;
            clockBehaviour.pauseBetweenRepetitionsFinish += pauseBetweenRepetitionsFinish;

        }
        if (this._BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            return;
        }
        defaultAnimationLength = stateInfo.length;
       
        //Está la animación en caché
        if(PreparedExercises.tryGetPreparedExercise(new Exercise(movement, limb), out this._timeAndAngles, stateInfo.length))
        {
            //Repetición de preparación
            if (this._BehaviourState != AnimationBehaviourState.PREPARING_DEFAULT && this._BehaviourState != AnimationBehaviourState.PREPARING_WEB)
            {
                this.StartLerp();
            }

            else if (this._BehaviourState == AnimationBehaviourState.PREPARING_DEFAULT)
            {
                //OnRepetitionEnd();
                _BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS;
                timeSinceCapture = 0;
                this.StartLerp();
            }

            else if (this._BehaviourState == AnimationBehaviourState.PREPARING_WEB)
            {
                OnRepetitionEnd();
                Stop();
            }
        }
        //No está la animación en caché
        else
        {
            if (this._BehaviourState == AnimationBehaviourState.PREPARING_DEFAULT || this._BehaviourState == AnimationBehaviourState.PREPARING_WEB)
            {
                this._timeAndAngles = new List<AnimationInfo>();
                this.StartLerp();
            }
            else
            {
                throw new Exception("Animation not prepared");
            }
        }
	}
    //    private bool allowSelect;
    void Start()
    {
        clockBehaviour = GameObject.Find("Clock").GetComponent<ClockBehaviour>();

        //if(Application.loadedLevelName=="SelectTask")
        //	clockBehaviour.StartTimer=true;
    }
Esempio n. 11
0
    void Start()
    {
        guiS3 = GameObject.Find("Main Camera").GetComponent<GUIS3>();
        clockBehaviour = guiS3.clockBehaviour;
        Debug.Log("clockb " + clockBehaviour);
        scene1 = GetComponent<Scene1>();
        scene2 = GetComponent<Scene2>();
        scene3 = GameObject.Find("Main Camera").GetComponent<Scene3>();

        company = GameObject.Find("Company");
        left = GameObject.Find("Left");
        bottomLeft = GameObject.Find("BottomLeft");
        extraBottomLeft = GameObject.Find("ExtraBottomLeft");
        top = GameObject.Find("Top");
        middle = GameObject.Find("Middle");
        bottom = GameObject.Find("Bottom");
        topRight = GameObject.Find("TopRight");
        right = GameObject.Find("Right");
        bottomRight = GameObject.Find("BottomRight");
        extraTopRight = GameObject.Find("ExtraTopRight");;

        terrain = GameObject.Find("HGVTerrain");
        //terrainHint = GameObject.Find("TerrainHint");

        //		time = 0;
        //
        startPosition = transform.position;
        startRotation = transform.eulerAngles;
        //
        //		initialRotation = 90;
        //		rotation = initialRotation;

        rotSecond = 3;

        moveAmount = 40;

        moveSecond = 0;

        nonDiagonalTime = 1;

        diagonalTime = Mathf.Sqrt(nonDiagonalTime * nonDiagonalTime * 2);

        //		clicked = false;
        //
        //		x = -40;
        //		z = 40;
        //
        //		xCounter = 0;
        //		zCounter = 0;
        //
        locationCounter = new int[2];
        //
        //		locationCounter[0] = 0;
        //
        //		locationCounter[1] = 0;

        arrivedLocation = new List<int[]>();

        //arrivedLocation.Add(new int[]{locationCounter[0], locationCounter[1]});

        scene = Scene.scene1;
    }
Esempio n. 12
0
    void Start()
    {
        clockBehaviour = GameObject.Find("Clock").GetComponent<ClockBehaviour>();

        onClickChange = GameObject.Find("Main Camera").GetComponent<OnClickChange>();

        rctQuestionLabel=new Rect(Screen.width/2-250,275,500,100);

        rctButtonRectOne=new Rect(Screen.width/2-100,375,50,50);
        rctButtonRectTwo=new Rect(Screen.width/2+50,375,50,50);
        rctButtonRectThree=new Rect(760,210,50,50);

        rctSubmitButton=new Rect(Screen.width/2-100,475,200,50);

        rctAnswerlabel = new Rect(Screen.width/2-250,525,500,50);

        strQ1Exp = "Dyslexia is not associated with IQ, but a difference between IQ and reading ability.  ";
        strQ2Exp = "Though there is a limited understanding as to why, dyslexia is commonly reported to run in families. ";
        strQ3Exp = "People with dyslexia can have success in any career if the right support and accomodations are put in place. ";

        rctQ1label = new Rect(Screen.width/2-150,440,150,50);
        strA1 = "True ";

        rctQ2label = new Rect(Screen.width/2,440,150,50);
        strA2 = "False ";

        rctQ3label = new Rect(760,210,150,50);

        response = new bool[3];

        checkMark=new string[3];
        for(int i=0;i<checkMark.Length;i++)
            checkMark[i]=strUnchecked;

        QsComplete = new bool[3];

        Invoke("PlayClip",1);

        Invoke("StartClock",2);

        orderTasksDone = new int[3];

        orderAnswers1 = new int[3];

        //Email: 2, Phone: 0, Report: 1.

        orderAnswers1[0]=2;
        orderAnswers1[1]=0;
        orderAnswers1[2]=1;

        orderAnswers2 =new int[3];

        orderAnswers2[0]=0;
        orderAnswers2[1]=1;
        orderAnswers2[2]=2;

        orderAnswers3=new int[3];

        orderAnswers3[0]=1;
        orderAnswers3[1]=2;
        orderAnswers3[2]=0;
    }
Esempio n. 13
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (_BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            if (this.IsCentralNode)
                animator.speed = 0;
            return;
        }

        if(this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS && !IsCentralNode && !IsWeb)
        {
            this.CentralNode.OnRepetitionReallyStart();
        }
        
        if (!this.IsCentralNode && this.CentralNode.randomAnimations[0] == this.movement)
            IsRewinding = false;

        if (this.IsCentralNode && hasEnteredBefore == false)
        {
            hasEnteredBefore = true;

            clockBehaviour = new ClockBehaviour();
            clockBehaviour.executionTimerFinish += executionTimerFinish;
            clockBehaviour.executionTimerStart += executionTimerStart;
            clockBehaviour.pauseBetweenRepetitionsStart += pauseBetweenRepetitionsStart;
            clockBehaviour.pauseBetweenRepetitionsFinish += pauseBetweenRepetitionsFinish;

        }
        
        if (this._BehaviourState == AnimationBehaviourState.PREPARING_WEB || this._BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS)
        {
            OnRepetitionEnd();
            Stop();
        }
        else if (this._BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS || this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS
                 || this._BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            //Como en este behaviour se utiliza animation.Play para cada repetición, se entra más de una vez al metodo OnStateEnter, 
            //por lo que si ya se ha entrado alguna vez, la velocidad se asigna como 0 para que se respete el tiempo entre ejecución 
            //antes de comenzar la siguiente repetición.

            //Se asume que si el ejercicio utiliza solo un tipo de velocidad, el forwardspeed y backwardspeed serán iguales.

            animator.speed = this.CentralNode._RealParams.ForwardSpeed;

        }/*
        if (IsCentralNode)
            Debug.Log("entre central ");
        else
            Debug.Log("entre ");*/

    }