Skip to content

Instantly share code, notes, and snippets.

View pmarinr's full-sized avatar

Pedro Marín Ramos pmarinr

View GitHub Profile
@pmarinr
pmarinr / galeria.html
Last active December 29, 2015 16:19
Curso DEMI - ESCAV. Ejemplo de galería sencilla de imágenes HTML y CSS
< div id="galeria" >
< div class="item">
<img src="" alt="" >
<p>texto.</p>
</div>
< div class="item">
<img src="" alt="" >
<p>texto.</p>
@pmarinr
pmarinr / Coche.cs
Created January 10, 2014 18:35
Ejemplo de Creación de una clase en C#
using System.IO;
using System;
class Coche
{
public Coche(string numero, string color, int ruedas, int gasoil){
this.marca = marca;
this.color = color;
@pmarinr
pmarinr / TankController.cs
Created January 23, 2014 09:13
TankController
using UnityEngine;
using System.Collections;
public class TankController : MonoBehaviour {
[HideInInspector]
public bool jump = false;
public float moveForce = 365f;
public float maxSpeed = 5f;
@pmarinr
pmarinr / CannonController.cs
Created January 23, 2014 09:50
CannonController
using UnityEngine;
using System.Collections;
public class CannonController : MonoBehaviour {
private Vector3 mouse_pos;
private Vector3 object_pos;
private float angle;
// Use this for initialization
@pmarinr
pmarinr / CannonController.cs
Created January 23, 2014 11:12
CannonController2
using UnityEngine;
using System.Collections;
public class TurretController : MonoBehaviour {
private Vector3 mouse_pos;
private Vector3 object_pos;
private float angle;
private float bulletSpeed = 500;
public GameObject[] ammo; // Array of enemy prefabs.
@pmarinr
pmarinr / moveScript.cs
Created October 20, 2014 13:32
3 modos de mover un objeto 2D
using UnityEngine;
using System.Collections;
public class moveScript : MonoBehaviour {
public int horizontalSpeed = 20;
public int verticalSpeed = 20;
private Vector3 mousePosition;
@pmarinr
pmarinr / ReSkinAnimation.cs
Created October 22, 2014 13:38
Cambia el spritesheet de una animación
using UnityEngine;
using System;
public class ReSkinAnimation : MonoBehaviour {
public string spriteName;
// Update is called once per frame
void LateUpdate () {
@pmarinr
pmarinr / claustrofobiaScript.cs
Created February 11, 2015 15:49
Ejemplo de cambio dinámico del campo de visión de una cámara ( camera.fieldOfView )
/*
Ejemplo de cambio dinámico del campo de visión de una cámara
*/
using UnityEngine;
using System.Collections;
public class clautrofobia : MonoBehaviour {
Camera camara;
public int factor_miedo = 1; // El factor muiedo indicará la velocidad con la que se reduce el campo de visión
// Use this for initialization
@pmarinr
pmarinr / visionScript.cs
Last active August 29, 2015 14:15
Script de visión a IA
using UnityEngine;
using System.Collections;
public class vistaScript : MonoBehaviour {
RaycastHit hit;
public float angulo; // Angulo de vision de la IA
public float distancia; // Distancia max de vision
public GameObject player; // Objetivo
void Update () {
@pmarinr
pmarinr / rotateJump.cs
Last active August 29, 2015 14:15
Script para saltar y rotar un objeto
using UnityEngine;
using System.Collections;
public class SaltoScript : MonoBehaviour {
public int angulo = -90;
public float lSpeed = 10.0f; // Set this to a value you like
public int salto = 200;
public float rotate_speed = 0.2f;
float rotate = 0;
bool isRotating = false;