// Use this for initialization void Start() { turnScript = Player.GetComponent <Turning>(); kinectSensor = KinectSensor.GetDefault(); if (kinectSensor != null) { //몇 명있는지 bodyCount = kinectSensor.BodyFrameSource.BodyCount; //무엇을 하는지 bodyFrameReader = kinectSensor.BodyFrameSource.OpenReader(); //put the body in array make skeleton data out of it bodies = new Body[bodyCount]; //creating new list of gesture gestureDetectorList = new List <GestureDetector>(); for (int bodyIndex = 0; bodyIndex < bodyCount; bodyIndex++) { gestureDetectorList.Add(new GestureDetector(kinectSensor)); } kinectSensor.Open(); } else { //kinect sensor not connected } }
// Use this for initialization void Start() { distance = 2.5f; turning = GetComponentInParent <Turning>(); sounds = GetComponents <AudioSource>(); collect = sounds[0]; winning = sounds[1]; img_basket = GameObject.FindGameObjectWithTag("basket_img"); img_coconut1 = GameObject.FindGameObjectWithTag("coconut_img"); img_coconut2 = GameObject.FindGameObjectWithTag("coconut_img2"); img_orange = GameObject.FindGameObjectWithTag("orange_img"); img_blackberry1 = GameObject.FindGameObjectWithTag("blackberry_img"); img_blackberry2 = GameObject.FindGameObjectWithTag("blackberry_img2"); bubble_box = GameObject.FindGameObjectWithTag("bubble_box"); character = GameObject.FindGameObjectWithTag("character"); text = bubble_box.GetComponentInChildren <Text>(); bubble_box.SetActive(false); character.SetActive(false); img_basket.SetActive(false); img_coconut1.SetActive(false); img_coconut2.SetActive(false); img_orange.SetActive(false); img_blackberry1.SetActive(false); img_blackberry2.SetActive(false); text.enabled = false; pickup = true; basket = false; orange = false; coconut = false; coconutCount = 2; blackberry = false; blackberryCount = 2; win = false; StartCoroutine(ShowMessage("Trace the Code", 3)); }
public override NodeResult Execute() { int direction = Random.Range(0, 3); Turning newTurn = Turning.STRAIGHT; switch (direction) { case 0: { newTurn = Turning.STRAIGHT; break; } case 1: { newTurn = Turning.LEFT; break; } case 2: { newTurn = Turning.RIGHT; break; } } SwarmLeaderAI leaderAI = (SwarmLeaderAI)tree.GetValue(leaderAIKey); leaderAI.SetValue("TurnRequested", newTurn); return(NodeResult.SUCCESS); }
// Use this for initialization void Start() { distance = 3.5f; turning = GetComponentInParent <Turning>(); sounds = GetComponents <AudioSource>(); collect = sounds[0]; winning = sounds[1]; bubble_box = GameObject.FindGameObjectWithTag("bubble_box"); character = GameObject.FindGameObjectWithTag("character"); code_snippet = GameObject.FindGameObjectWithTag("code_snippet"); mobile = GameObject.FindGameObjectWithTag("mobile"); rope = GameObject.FindGameObjectWithTag("rope"); flashlight = GameObject.FindGameObjectWithTag("flashlight"); brown_img = GameObject.FindGameObjectWithTag("broown"); red_img = GameObject.FindGameObjectWithTag("rod"); black_img = GameObject.FindGameObjectWithTag("blackberry_img"); text = bubble_box.GetComponentInChildren <Text>(); code_snippetText = code_snippet.GetComponentInChildren <Text>(); bubble_box.SetActive(false); character.SetActive(false); code_snippet.SetActive(false); mobile.SetActive(false); rope.SetActive(false); flashlight.SetActive(false); brown_img.SetActive(false); red_img.SetActive(false); black_img.SetActive(false); text.enabled = false; pickup = true; //backpack = false; red = false; brown = false; black = false; win = false; }
private void Awake() { movementController = GetComponent <Movement>(); turningController = GetComponent <Turning>(); attack = GetComponent <IAttack>(); }
// Use this for initialization void Start() { distance = 3.5f; turning = GetComponentInParent <Turning>(); sounds = GetComponents <AudioSource>(); collect = sounds[0]; winning = sounds[1]; back_img = GameObject.FindGameObjectWithTag("basket_img"); brown_img = GameObject.FindGameObjectWithTag("brown_img"); red_img = GameObject.FindGameObjectWithTag("red_img"); black_img = GameObject.FindGameObjectWithTag("black_img"); bubble_box = GameObject.FindGameObjectWithTag("bubble_box"); character = GameObject.FindGameObjectWithTag("character"); mobile = GameObject.FindGameObjectWithTag("mobile"); rope = GameObject.FindGameObjectWithTag("rope"); flashlight = GameObject.FindGameObjectWithTag("flashlight"); text = bubble_box.GetComponentInChildren <Text>(); bubble_box.SetActive(false); character.SetActive(false); mobile.SetActive(false); rope.SetActive(false); flashlight.SetActive(false); back_img.SetActive(false); brown_img.SetActive(false); red_img.SetActive(false); black_img.SetActive(false); text.enabled = false; pickup = true; backpack = false; red = false; brown = false; black = false; win = false; StartCoroutine(ShowMessage("Trace the Code", 3)); }
protected override void Update() { if (firstRun) { biting = RegisterInteraction <Biting>(); eyes = RegisterInteraction <Eyesight>(); move = RegisterInteraction <MoveForward>(); turn = RegisterInteraction <Turning>(); } }
//RoboSnake Turning Actions Left & Right public void TurnTo(int turn) { //1 turns left, -1 turns right if (turn == 1) { dir = Turning.LEFT; } else if (turn == 2) { dir = Turning.RIGHT; } }
// Use this for initialization void Start() { distance = 3f; turning = GetComponentInParent <Turning>(); sounds = GetComponents <AudioSource>(); collect = sounds[0]; winning = sounds[1]; bubble_box = GameObject.FindGameObjectWithTag("bubble_box"); text = bubble_box.GetComponentInChildren <Text>(); pickup = true; win = false; }
public void TurnTo(Compas c) { int dirDiff = Mod(c - compas, 4); if (dirDiff == 1) { dir = Turning.RIGHT; } else if (dirDiff == 3) { dir = Turning.LEFT; } }
// Use this for initialization void Start() { // list[0].SetActive(false); turnScript = Player.GetComponent <Turning>(); // get the sensor object this.kinectSensor = KinectSensor.GetDefault(); if (this.kinectSensor != null) { this.bodyCount = this.kinectSensor.BodyFrameSource.BodyCount; // color reader this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader(); // create buffer from RGBA frame description var desc = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba); // body data this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader(); // body frame to use this.bodies = new Body[this.bodyCount]; // initialize the gesture detection objects for our gestures this.gestureDetectorList = new List <GestureDetector>(); for (int bodyIndex = 0; bodyIndex < this.bodyCount; bodyIndex++) { //PUT UPDATED UI STUFF HERE FOR NO GESTURE // GestureTextGameObject.text = "none"; //this.bodyText[bodyIndex] = "none"; this.gestureDetectorList.Add(new GestureDetector(this.kinectSensor)); } // start getting data from runtime this.kinectSensor.Open(); } else { //kinect sensor not connected } }
// called from ParabolaController public void EndOfTurn() { isTurning = false; currentDirection = nextDirection; nextDirection = Vector2.zero; // recenter car's rotation after the turn if (currentDirection == Vector2.up || currentDirection == Vector2.down) { transform.rotation = Quaternion.Euler(0f, 0f, 90f); } else { transform.rotation = Quaternion.Euler(0f, 0f, 0f); } turningDirection = Turning.None; isAccelerating = true; }
// Use this for initialization void Start() { turnScript = Player.GetComponent<Turning>(); // get the sensor object this.kinectSensor = KinectSensor.GetDefault(); if (this.kinectSensor != null) { this.bodyCount = this.kinectSensor.BodyFrameSource.BodyCount; // color reader this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader(); // create buffer from RGBA frame description var desc = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba); // body data this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader(); // body frame to use this.bodies = new Body[this.bodyCount]; // initialize the gesture detection objects for our gestures this.gestureDetectorList = new List<GestureDetector>(); for (int bodyIndex = 0; bodyIndex < this.bodyCount; bodyIndex++) { //PUT UPDATED UI STUFF HERE FOR NO GESTURE GestureTextGameObject.text = "none"; //this.bodyText[bodyIndex] = "none"; this.gestureDetectorList.Add(new GestureDetector(this.kinectSensor)); } // start getting data from runtime this.kinectSensor.Open(); } else { //kinect sensor not connected } }
// Use this for initialization void Start() { distance = 3f; turning = GetComponentInParent <Turning>(); sounds = GetComponents <AudioSource>(); collect = sounds[0]; winning = sounds[1]; bubble_box = GameObject.FindGameObjectWithTag("bubble_box"); character = GameObject.FindGameObjectWithTag("character"); code_snippet = GameObject.FindGameObjectWithTag("code_snippet"); c = GameObject.FindGameObjectWithTag("coconut_count"); text = bubble_box.GetComponentInChildren <Text>(); c_count = c.GetComponentInChildren <Text>(); bubble_box.SetActive(false); character.SetActive(false); code_snippet.SetActive(false); text.enabled = false; coconut = false; win = false; pickup = true; }
public override void PreGameStep() { ms = MoveScore.MOVE; switch (dir) { case Turning.FORWARD: break; case Turning.LEFT: compas = (Compas)Mod((int)compas - 1, 4); turns++; break; case Turning.RIGHT: compas = (Compas)Mod((int)compas + 1, 4); turns++; break; } dir = Turning.FORWARD; }
// Use this for initialization void Start() { distance = 3f; turning = GetComponentInParent <Turning>(); sounds = GetComponents <AudioSource>(); collect = sounds[0]; winning = sounds[1]; bubble_box = GameObject.FindGameObjectWithTag("bubble_box"); character = GameObject.FindGameObjectWithTag("character"); b = GameObject.FindGameObjectWithTag("blackberry_count"); c = GameObject.FindGameObjectWithTag("coconut_count"); text = bubble_box.GetComponentInChildren <Text>(); b_count = b.GetComponentInChildren <Text>(); c_count = c.GetComponentInChildren <Text>(); bubble_box.SetActive(false); character.SetActive(false); text.enabled = false; coconut = false; blackberry = false; win = false; pickup = true; StartCoroutine(ShowMessage("Trace the Code", 3)); }
// Update is called once per frame void Update() { float h = Input.GetAxisRaw("Horizontal"); float v = Input.GetAxisRaw("Vertical"); Command turning = new Turning(); Command movement = new Movement(); Command jump = new Jump(); animation(h, v); movement.execute(this.gameObject); anim.SetBool("isjumping", isjumping); if (Input.GetButtonDown("Jump")) { if (isjumping == false) { isjumping = true; jump.execute(this.gameObject); } } }
public Aim(GameContext context, Entity entity, ControllerData controllerData) : base(context, entity, controllerData) { _velocityLimit = Entity.GetBehaviors <VelocityLimit>().FirstOrDefault(); _thrust = Entity.GetBehavior <Thruster>(); _turning = Entity.GetBehavior <Turning>(); }
private void Form1_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Up: acc = Accelerating.Naprej; break; case Keys.Down: acc = Accelerating.Nazaj; break; case Keys.Left: Turn = Turning.Levo; break; case Keys.Right: Turn = Turning.Desno; break; case Keys.Space: fastForward = !fastForward; if (!fastForward) LoopFactor = DefaultLoopFactor; break; case Keys.Escape: end = true; break; } }
private void Form1_KeyUp(object sender, KeyEventArgs e) { if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down)) acc = Accelerating.Ne; if ((e.KeyCode == Keys.Left) || (e.KeyCode == Keys.Right)) Turn = Turning.Ne; }
public VelocityMatch(GameContext context, Entity entity, ControllerData controllerData) : base(context, entity, controllerData) { _context = context; _thrust = Entity.GetBehavior <Thruster>(); _turning = Entity.GetBehavior <Turning>(); }
void Start() { turning = this.GetComponent <Turning>(); player_Jump = this.GetComponent <Player_Jump>(); player = transform.GetChild(0); }
public override NodeResult Execute() { Turning dir = (Turning)tree.GetValue("TurnRequested"); if (dir != Turning.STRAIGHT) { // are we at a crossover node on the track? // if so, then turn to the other track, in the correct direction requested. // who sets the Turning value? The player does via keydown in another module. GameObject waypoint = (GameObject)tree.GetValue("Waypoint"); int wpi = (int)tree.GetValue("Index"); // is this a crossover point? (i.e is it on another track? TrackManager tm = (TrackManager)tree.GetValue("TrackManager"); int trackIndex = (int)tree.GetValue("TrackIndex"); // are we at a potential crossover on our track? Vector3 pos = waypoint.transform.position; for (int i = 0; i < 16; i++) { if (pos == tm.splines[trackIndex].points[i]) { // yes we are. Now is it on the other tracks?, and if so, which one, and where on the track? for (int s = 0; s < tm.splines.Length; s++) { if (s == trackIndex) { continue; } for (int j = 0; j < 16; j++) { if (pos == tm.splines[s].points[j]) { // we have a winner - player requested to turn, and is at a waypoint that crosses // track s at control point J // cross product and 8 if statements to manage the turn. Vector3 a1 = pos; Vector3 b1 = pos; Vector3 a2 = tm.splines[trackIndex].lanes[1, (wpi + 1) % 320]; Vector3 b2 = tm.splines[s].lanes[1, (j * 20 + 1) % 320]; // middle lane, add one to crossover Vector3 AV = a2 - a1; Vector3 BV = b2 - b1; float angleAB = Vector3.SignedAngle(AV, BV, Vector3.up); int ADir = (int)tree.GetValue("Direction"); int NDir = 1; // 8 ifs now... if (dir == Turning.LEFT) { //Debug.Log("LEFT. ADIR: " + ADir + " angle:" + angleAB); if (ADir == 1 && angleAB > 0) { NDir = -1; } else if (ADir == 1 && angleAB <= 0) { NDir = +1; } else if (ADir == -1 && angleAB > 0) { NDir = +1; } else if (ADir == -1 && angleAB <= 0) { NDir = -1; } //Debug.Log("LEFT:NDIR: " + NDir); } else // must be going right { //Debug.Log("Right. ADIR: " + ADir + " angle:" + angleAB); if (ADir == 1 && angleAB > 0) { NDir = 1; } else if (ADir == 1 && angleAB <= 0) { NDir = -1; } else if (ADir == -1 && angleAB > 0) { NDir = -1; } else if (ADir == -1 && angleAB <= 0) { NDir = 1; } //Debug.Log("Right:NDIR: " + NDir); } // now that we have a new direction, a new start point (j * 20+1)%320, and a spline to follow (index s, actual tm.splines[s]; // we can update the blackboard // and return sucess //Debug.Log("changing from " + trackIndex + " To " + s); //Debug.Log("direction from: " + ADir + " to "+ NDir); tree.SetValue("Direction", NDir); tree.SetValue("TrackIndex", s); tree.SetValue("Waypoints", tm.splines[s].sp); tree.SetValue("Waypoint", tm.splines[s].sp[(j * 20 + NDir + 320) % 320]); tree.SetValue("Index", (j * 20 + NDir + 320) % 320); //Debug.Log("Back to straight now that we have turned"); tree.SetValue("TurnRequested", Turning.STRAIGHT); return(NodeResult.SUCCESS); } } } } } } return(NodeResult.SUCCESS); }
// Start is called before the first frame update void Start() { // Road Check needs a reference to a Movement Script and Turning Script movement = gameObject.GetComponent <Movement>(); turning = gameObject.GetComponent <Turning>(); }