void Troll() { ClockAnimator clock = clocks[random].GetComponent <ClockAnimator>(); //Sameklē pūlksteni pie kura stāv izmantojot waypoint indexu clock.setRandomTroll(); // izsauc ClockAnimator metodi, kas uzstāda random ciparu, ko izmanto lai pārmainītu laiku uz nepareizu random = UnityEngine.Random.Range(0, waypoints.Length); //izvēlas jaunu waypoint state = basicAI.State.WONDERING; //maina state uz wondering }
// Use this for initialization void Start() { theEngineChapel = GameObject.Find ("Dialogue Engine Chapel Object"); externalScriptChapel = theEngineChapel.GetComponent<dialogueEngineChapel>(); isColliding = false; sceneStarted = false; activeTrigger = true; clockObj = GameObject.Find ("Clock"); clockScript = clockObj.GetComponent<ClockAnimator>(); }
void Cast() { RaycastHit hit; // Izveido mainīgo kas satur informāciju par objektu, kuram trāpija Raycast if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range)) // ja Raycast trāpa range attālumā { ClockAnimator target = hit.transform.GetComponent <ClockAnimator>(); //izveido ClockAnimator, kuram piesaista trāpītā objekta parametrus if (target != null) //ja ir target { target.resetTime(); // izsauc ClockAnimator metodi resetTime(), kas izlabo laiku } } }
// Start is called before the first frame update void Start() { cam = GetComponent <Camera>(); timeLookingAtCurrentObject = 0f; startingYRotation = gameObject.transform.rotation.y; animator = clock.GetComponent <ClockAnimator>(); animator.AnimationEnded += OnAnimationEnded; recognizer = new GestureRecognizer(); recognizer.SetRecognizableGestures(GestureSettings.Tap | GestureSettings.Hold); recognizer.Tapped += OnGestureTapped; recognizer.HoldStarted += OnGestureHoldStart; recognizer.HoldCompleted += OnGestureHoldComplete; recognizer.HoldCanceled += OnGestureHoldCanceled; recognizer.StartCapturingGestures(); }