mirror of
https://github.com/ConjureETS/Labo_2_Equ_1_a15.git
synced 2026-03-24 01:50:58 +00:00
Merge branch 'xavier_develop' of https://github.com/ConjureETS/Labo_2_Equ_1_a15
This commit is contained in:
commit
b860d7f90d
BIN
Assets/Animations/Jump0.anim
Normal file
BIN
Assets/Animations/Jump0.anim
Normal file
Binary file not shown.
8
Assets/Animations/Jump0.anim.meta
Normal file
8
Assets/Animations/Jump0.anim.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a078ad8c97314a34d9ecd3e37dae2156
|
||||||
|
timeCreated: 1446945210
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
Binary file not shown.
@ -4,8 +4,10 @@ using System.Collections;
|
|||||||
public class Animations : MonoBehaviour {
|
public class Animations : MonoBehaviour {
|
||||||
|
|
||||||
private Animator anim;
|
private Animator anim;
|
||||||
|
|
||||||
private bool isShooting;
|
private bool isShooting;
|
||||||
|
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
|
||||||
@ -32,8 +34,12 @@ public class Animations : MonoBehaviour {
|
|||||||
} // if
|
} // if
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
anim.SetFloat("SpeedX", Mathf.Abs(mouvementX));
|
anim.SetFloat("SpeedX", Mathf.Abs(mouvementX));
|
||||||
anim.SetBool("isShooting", isShooting);
|
anim.SetBool("isShooting", isShooting);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,16 @@ public class Control : MonoBehaviour {
|
|||||||
|
|
||||||
|
|
||||||
public Transform thingsToMove;
|
public Transform thingsToMove;
|
||||||
public int speed;
|
|
||||||
|
public float speed;
|
||||||
|
|
||||||
|
private int eulerAngle;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
|
||||||
|
eulerAngle = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -18,20 +23,11 @@ public class Control : MonoBehaviour {
|
|||||||
float mouvement = Input.GetAxis ("Horizontal");
|
float mouvement = Input.GetAxis ("Horizontal");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ( mouvement!= 0)
|
|
||||||
{
|
|
||||||
thingsToMove.Translate(new Vector2(mouvement * speed, 0));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// aller vers la gauche
|
// aller vers la gauche
|
||||||
if (mouvement > 0.0)
|
if (mouvement > 0.0)
|
||||||
{
|
{
|
||||||
thingsToMove.Translate(new Vector2(mouvement * speed, 0));
|
thingsToMove.Translate(new Vector2(mouvement * speed, 0)); // bouger le player
|
||||||
transform.eulerAngles = new Vector2(0, 0);
|
eulerAngle = 0;
|
||||||
|
|
||||||
} // if
|
} // if
|
||||||
|
|
||||||
@ -40,11 +36,11 @@ public class Control : MonoBehaviour {
|
|||||||
if (mouvement < 0.0)
|
if (mouvement < 0.0)
|
||||||
{
|
{
|
||||||
|
|
||||||
thingsToMove.Translate(new Vector2(-(mouvement * speed), 0));
|
thingsToMove.Translate(new Vector2(-(mouvement * speed), 0)); // bouger le player
|
||||||
transform.eulerAngles = new Vector2(0, 180);
|
eulerAngle = 180;
|
||||||
|
|
||||||
} // if
|
} // if
|
||||||
|
|
||||||
|
transform.eulerAngles = new Vector3(0, eulerAngle, 0); // gauche = sprite effet miroir, droite = sprite normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using System.Collections;
|
|||||||
public class Gravity : MonoBehaviour {
|
public class Gravity : MonoBehaviour {
|
||||||
|
|
||||||
public Character player;
|
public Character player;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
player = new Character(1, 10, 10, false);
|
player = new Character(1, 10, 10, false);
|
||||||
|
|||||||
@ -3,34 +3,58 @@ using System.Collections;
|
|||||||
|
|
||||||
public class Jump : MonoBehaviour {
|
public class Jump : MonoBehaviour {
|
||||||
|
|
||||||
public int timeJump;
|
public Rigidbody2D player; // le player
|
||||||
|
|
||||||
|
public float playerSpeedY; // la vitesse de saut
|
||||||
|
|
||||||
|
private bool isOnGround; // somme nous sur le sol?
|
||||||
|
|
||||||
public Transform player;
|
|
||||||
|
|
||||||
private bool isJumping;
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
isJumping = false;
|
isOnGround = false;
|
||||||
timeJump = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update () {
|
void Update () {
|
||||||
|
|
||||||
if (Input.GetButton("Fire1") && isJumping == false)
|
if (Input.GetButton("Fire1") && isOnGround == true)
|
||||||
{
|
{
|
||||||
timeJump = 10;
|
player.velocity = new Vector2(player.velocity.x, playerSpeedY);
|
||||||
isJumping = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (timeJump > 0) {
|
|
||||||
player.Translate(0, 0.4f, 0);
|
|
||||||
timeJump--;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
isJumping = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OnTriggerStay2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.gameObject.tag == "Floor")
|
||||||
|
{
|
||||||
|
isOnGround = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OnTriggerEnter2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.gameObject.tag == "Floor")
|
||||||
|
{
|
||||||
|
isOnGround = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OnTriggerExit2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.gameObject.tag == "Floor")
|
||||||
|
{
|
||||||
|
|
||||||
|
isOnGround = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
29
Assets/Scripts/MainCamera.cs
Normal file
29
Assets/Scripts/MainCamera.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class MainCamera : MonoBehaviour {
|
||||||
|
|
||||||
|
// le player
|
||||||
|
public Rigidbody2D player;
|
||||||
|
|
||||||
|
private float positionPlayerX; // position du player en X
|
||||||
|
private float positionPlayerY; // // position du player en Y
|
||||||
|
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
// definir la position du player
|
||||||
|
positionPlayerX = player.GetComponent<Rigidbody2D>().position.x;
|
||||||
|
positionPlayerY = player.GetComponent<Rigidbody2D>().position.y;
|
||||||
|
|
||||||
|
// ajuster la camera selon la position du player
|
||||||
|
transform.position = new Vector3(positionPlayerX, positionPlayerY + 3.5F, -10);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Scripts/MainCamera.cs.meta
Normal file
12
Assets/Scripts/MainCamera.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c729e4edf3bf65d4fa14333e02f090e0
|
||||||
|
timeCreated: 1446932586
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 14370da66867eeb479e470bd4bb068f7
|
guid: 14370da66867eeb479e470bd4bb068f7
|
||||||
timeCreated: 1446690230
|
timeCreated: 1446945412
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName:
|
fileIDToRecycleName:
|
||||||
@ -22,6 +22,7 @@ TextureImporter:
|
|||||||
21300030: Jumping3
|
21300030: Jumping3
|
||||||
21300032: Jumping4
|
21300032: Jumping4
|
||||||
21300034: Shooting
|
21300034: Shooting
|
||||||
|
21300036: Jump3
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
@ -148,56 +149,6 @@ TextureImporter:
|
|||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: .5, y: .5}
|
pivot: {x: .5, y: .5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
- name: Jumping0
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 261
|
|
||||||
y: 13
|
|
||||||
width: 16
|
|
||||||
height: 24
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: .5, y: .5}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
- name: Jumping1
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 313
|
|
||||||
y: 13
|
|
||||||
width: 12
|
|
||||||
height: 24
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: .5, y: .5}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
- name: Jumping2
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 361
|
|
||||||
y: 13
|
|
||||||
width: 17
|
|
||||||
height: 24
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: .5, y: .5}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
- name: Jumping3
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 408
|
|
||||||
y: 13
|
|
||||||
width: 21
|
|
||||||
height: 24
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: .5, y: .5}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
- name: Jumping4
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 458
|
|
||||||
y: 13
|
|
||||||
width: 21
|
|
||||||
height: 24
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: .5, y: .5}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
- name: Shooting
|
- name: Shooting
|
||||||
rect:
|
rect:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -208,6 +159,36 @@ TextureImporter:
|
|||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: .5, y: .5}
|
pivot: {x: .5, y: .5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
- name: Jump0
|
||||||
|
rect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 357
|
||||||
|
y: 107
|
||||||
|
width: 25
|
||||||
|
height: 30
|
||||||
|
alignment: 0
|
||||||
|
pivot: {x: .5, y: .5}
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
- name: Jump1
|
||||||
|
rect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 412
|
||||||
|
y: 123
|
||||||
|
width: 16
|
||||||
|
height: 17
|
||||||
|
alignment: 0
|
||||||
|
pivot: {x: .5, y: .5}
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
- name: Jump3
|
||||||
|
rect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 461
|
||||||
|
y: 112
|
||||||
|
width: 16
|
||||||
|
height: 22
|
||||||
|
alignment: 0
|
||||||
|
pivot: {x: .5, y: .5}
|
||||||
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
spritePackingTag:
|
spritePackingTag:
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
|
|||||||
Binary file not shown.
@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 5.2.1f1
|
m_EditorVersion: 5.2.2f1
|
||||||
m_StandardAssetsVersion: 0
|
m_StandardAssetsVersion: 0
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user