IEnumerator IGodPress() { _godPress = true; self.state.canMove = false; float _velPlayerMoveX = 5; Vector2 _velPlayerMove = new Vector2(_velPlayerMoveX * self.state.dirX, self.velocity.y); yield return(StartCoroutine(UTILS.WaitForFrames(10))); while (Mathf.Abs(_velPlayerMove.x) > 0.75f) { // _velPlayerMove.x = self.ProcessVelocityX(_velPlayerMove.x, 0, .05f); // self.controller.Move(_velPlayerMove); self.MoveY(targetVelocityY: 0, velocity: ref self.velocity, timebeta: .05f); } yield return(StartCoroutine(UTILS.WaitForFrames(10))); switch (grabbedCol.tag) { case "Enemy": grabbedCol.GetComponent <Enemy.Grab>().Throw(new Vector2(self.state.dirX * 10, 0)); self.state.grabbing = false; break; default: break; } hitBox.enabled = false; grabbedCol = null; self.state.grabbing = false; self.state.canMove = true; _godPress = false; }
private void btn_Agregar_Click(object sender, RoutedEventArgs e) { bool val = validaciones(); if (val) { Cursos curso = new Cursos(); try { curso.id_programa = (int)cbPrograma.SelectedValue; curso.desc_curso = txtDesc.Text; curso.cupos = int.Parse(txtCupos.Text); List <Object> c = UTILS.POST("private/curso", "curso", AuthUser.token, curso.GetType(), curso); if (c != null && c.Count > 0) { VerCursos cursos = new VerCursos(); cursos.Show(); this.Close(); } } catch (Exception) { // nada } } }
public IEnumerator StartIFrames() { _isInvincible = true; yield return(StartCoroutine(UTILS.WaitForFrames(_iframes))); _isInvincible = false; }
IEnumerator IWaveDash() { self.state.wavedash = true; self.state.canMove = false; int dirX = self.state.dirX; int dirY = self.state.dirY; self.velocity = Vector2.zero; yield return(StartCoroutine(UTILS.WaitForFrames(2))); // delay after coming to senses self.velocity.x = dashspeed * dirX; self.velocity.y = dashspeed * dirY; int i = dashframes; while (i > 0) { self.MoveY(targetVelocityY: 0, velocity: ref self.velocity, timebeta: 1f); self.MoveX(targetVelocityX: 0, velocity: ref self.velocity, timebeta: 1f); i--; yield return(null); } self.velocity = Vector2.zero; yield return(StartCoroutine(UTILS.WaitForFrames(2))); // delay after coming to senses self.state.wavedash = false; self.state.canMove = true; }
public IEnumerator Detect() { self.state.setDetect(true); Vector3 detectOrigin = transform.position; for (int i = 0; i <= arcRayCount; i++) { Vector2 arcAngleVector = new Vector2(Mathf.Cos(((arcSightAngle / 2) - ((arcSightAngle / (arcRayCount - 1)) * i) + arcRotation) * Mathf.Deg2Rad), Mathf.Sin(((arcSightAngle / 2) - ((arcSightAngle / (arcRayCount - 1)) * i) + arcRotation) * Mathf.Deg2Rad)); if (!self.facingRight) { arcAngleVector.x *= -1; } RaycastHit2D hit = Physics2D.Raycast(detectOrigin, arcAngleVector, arcMaxSight, detectMask); Debug.DrawRay(detectOrigin, arcAngleVector * arcMaxSight, Color.green); if (hit && hit.collider.CompareTag(playerTag)) { detectedTransform = hit.transform; self.state.hasDetected = true; self.state.setDetect(false); yield break; } } yield return(StartCoroutine(UTILS.WaitForFrames(arcWaitForFrames))); self.state.setDetect(false); }
private void Btn_Aceptar_Click(object sender, RoutedEventArgs e) { try { if (postulacion != null) { postulacion.estado = "A"; postulacion.fech_respuesta = DateTime.UtcNow.Date; string id_postulacion = postulacion.id_postulacion.ToString(); Postulaciones post_aux = postulacion; List <Object> post = UTILS.PUT("private/postulacion/" + id_postulacion, "postulacion", AuthUser.token, postulacion.GetType(), postulacion); if (post != null && post.Count > 0) { Postulaciones p = (Postulaciones)post[0]; postulacionesPendientes.Items.Remove(postulacion); postulacionesPendientes.Items.Refresh(); postulacionesRespondidas.Items.Add(post_aux); postulacionesRespondidas.Items.Refresh(); Inscripcion ins = new Inscripcion(); ins.id_alumno = p.id_alumno; ins.id_programa = p.id_programa; UTILS.POST("private/inscripcion", "inscripcion", AuthUser.token, ins.GetType(), ins); Mail correo = new Mail(); correo.envioCorreo(p.id_alumno.ToString(), p.estado, post_aux.programaEstudio.nomb_programa, p.fech_respuesta); } } } catch (Exception) { // do nothing } }
IEnumerator Spark() { self.state.shinesparking = true; self.state.canMove = false; self.velocity = Vector2.zero; yield return(StartCoroutine(UTILS.WaitForFrames(20))); self.velocity.x = sparkspeed * directionX; self.velocity.y = sparkspeed * directionY; int i = sparkframes; while (i > 0) { self.MoveY(targetVelocityY: 0, velocity: ref self.velocity, timebeta: 1f); self.MoveX(targetVelocityX: 0, velocity: ref self.velocity, timebeta: 1f); i--; yield return(null); } canShineSpark = false; self.state.shinesparking = false; self.state.canMove = true; }
/// <summary> /// Appends to existing InteractionError /// </summary> /// <param name="id">Id of the Error. It replaces existing id only if the existing Id is ErrorsIds.UNINITIALIZED</param> /// <param name="description">| delimiter is Appended to existing description, followed by value of this parameter</param> public void Append(ErrorsIds id, string description) { if (this.ID == ErrorsIds.UNINITIALIZED) //Get the new one, otherwise keep the original { this.ID = id; } this.Description = UTILS.ConcatenateWithDelimiters("|", this.Description, description); }
/// <summary> /// Appends to existing InteractionError. It replaces existing id only if the existing Id is ErrorsIds.UNINITIALIZED. | delimiter is Appended to existing description, followed by description property of the appended InteractionError /// </summary> /// <param name="anotherError">InteractionError to Append</param> public void Append(InteractionError anotherError) { if (this.ID == ErrorsIds.UNINITIALIZED) { this.ID = anotherError.ID; } this.Description = UTILS.ConcatenateWithDelimiters("|", this.Description, anotherError.Description); this.Details = UTILS.Concatenate(this.Details, anotherError.Details); }
IEnumerator IInertiaThrow() { _inertiaThrow = true; self.state.canMove = false; yield return(StartCoroutine(UTILS.WaitForFrames(1))); float _velPlayerMoveX = 0; float _velPlayerMoveY = 0; float _velThrowX = 0; float _velThrowY = 0; if (self.InputManager.LastInputHold("RIGHT")) { _velThrowX = 20; _velThrowY = 5; _velPlayerMoveX = 2; } if (self.InputManager.LastInputHold("LEFT")) { _velThrowX = 20; _velThrowY = 5; _velPlayerMoveX = 2; } if (self.InputManager.LastInputHold("UP")) { _velThrowY = 15; _velPlayerMoveX = 0; } if (self.InputManager.LastInputHold("DOWN")) { _velThrowY = 10; _velPlayerMoveX = 0; } Vector2 _velPlayerMove = new Vector2(_velPlayerMoveX * -self.state.dirX, _velPlayerMoveY); Vector2 _velThrow = new Vector2(_velThrowX * self.state.dirX, _velThrowY * self.state.dirY); switch (grabbedCol.tag) { case "Enemy": grabbedCol.GetComponent <Enemy.Grab>().Throw(_velThrow); // _velPlayerMove.x = self.ProcessVelocityX(_velPlayerMove.x, 0, .05f); // self.controller.Move(_velPlayerMove); self.MoveY(targetVelocityY: 0, velocity: ref self.velocity, timebeta: .05f); self.state.grabbing = false; break; case "Wall": self.state.wallGrabbing = false; break; } hitBox.enabled = false; self.state.canMove = true; _inertiaThrow = false; }
IEnumerator ShineSparkTimer() { shineCountdown = true; yield return(StartCoroutine(UTILS.WaitForFrames(60))); // delay after coming to senses if (!self.state.shinesparking) { canShineSpark = false; } shineCountdown = false; }
IEnumerator IThrow(Vector2 velocity) { self.state.setThrown(true); self.state.setGrabbed(false); while ((((Mathf.Abs(velocity.x) >= 1f) && self.state.grounded) || !self.state.grounded) && !self.state.grabbed) { self.state.setThrown(true); self.Move(ref velocity, 0, (self.state.grounded) ? 1 : 4); yield return(null); } yield return(StartCoroutine(UTILS.WaitForFrames(40))); // delay after coming to senses self.state.setThrown(false); }
private void btn_borrar_Click(object sender, RoutedEventArgs e) { try { if (programa != null) { string id = programa.id_programa.ToString(); UTILS.DELETE("private/programa/" + id, "programa", AuthUser.token, programa.GetType()); lstVigentes.Items.Remove(programa); lstVigentes.Items.Refresh(); } } catch (Exception) { // do nothing } }
public IEnumerator Lag() { self.state.isAttackLagging = true; self.state.canMove = false; // Either incure the lag wait frames if not cancelled, or standard lag frames // This should really be a function itself to determine standard lag frames vs cancelled lag frames _attackLagWaitFrames = (self.state.attackLagCancelled) ? _cancelledLagWaitFrames : _lagWaitFrames; yield return(StartCoroutine(UTILS.WaitForFrames(_attackLagWaitFrames))); _canLagCancel = false; self.state.isAttackLagging = false; self.state.attackLagCancelled = false; self.state.attackLag = false; self.state.canMove = true; }
private void brn_borrar_Click(object sender, RoutedEventArgs e) { try { if (usuario != null) { string id = usuario.id_usuario.ToString(); UTILS.DELETE("private/usuario/" + id, "usuario", AuthUser.token, usuario.GetType()); lstUsuario.Items.Remove(usuario); lstUsuario.Items.Refresh(); } } catch (Exception) { // do nothing } }
private void btn_borrar_Click(object sender, RoutedEventArgs e) { try { if (curso != null) { string id = curso.id_curso.ToString(); UTILS.DELETE("private/curso/" + id, "curso", AuthUser.token, curso.GetType()); listCursos.Items.Remove(curso); listCursos.Items.Refresh(); } } catch (Exception) { // do nothing } }
private void Button_Click(object sender, RoutedEventArgs e) { try { Usuario usuario = new Usuario(); usuario.usuario = txtUser.Text; usuario.contrasena = txtPASS.Password; //UTILS uti = new UTILS(); string token = UTILS.Autenticar(usuario); if (token == null) { lblError.Content = " Usuario y/o contraseña incorrecta"; } else { bool success = UTILS.decodeToken(token); if (success && AuthUser.rol.Equals("Administrador")) { AuthUser.token = token; Menu menu = new Menu(); menu.Show(); this.Close(); } else { lblError.Content = "Acceso denegado."; AuthUser.id = null; AuthUser.nombre = null; AuthUser.rol = null; AuthUser.token = null; } } } catch (Exception) { // do nothing } }