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 {
|
||||
|
||||
private Animator anim;
|
||||
|
||||
private bool isShooting;
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
@ -32,8 +34,12 @@ public class Animations : MonoBehaviour {
|
||||
} // if
|
||||
|
||||
|
||||
|
||||
anim.SetFloat("SpeedX", Mathf.Abs(mouvementX));
|
||||
anim.SetBool("isShooting", isShooting);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -5,12 +5,17 @@ public class Control : MonoBehaviour {
|
||||
|
||||
|
||||
public Transform thingsToMove;
|
||||
public int speed;
|
||||
|
||||
public float speed;
|
||||
|
||||
private int eulerAngle;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
eulerAngle = 0;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
@ -18,20 +23,11 @@ public class Control : MonoBehaviour {
|
||||
float mouvement = Input.GetAxis ("Horizontal");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
if ( mouvement!= 0)
|
||||
{
|
||||
thingsToMove.Translate(new Vector2(mouvement * speed, 0));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// aller vers la gauche
|
||||
if (mouvement > 0.0)
|
||||
{
|
||||
thingsToMove.Translate(new Vector2(mouvement * speed, 0));
|
||||
transform.eulerAngles = new Vector2(0, 0);
|
||||
thingsToMove.Translate(new Vector2(mouvement * speed, 0)); // bouger le player
|
||||
eulerAngle = 0;
|
||||
|
||||
} // if
|
||||
|
||||
@ -40,11 +36,11 @@ public class Control : MonoBehaviour {
|
||||
if (mouvement < 0.0)
|
||||
{
|
||||
|
||||
thingsToMove.Translate(new Vector2(-(mouvement * speed), 0));
|
||||
transform.eulerAngles = new Vector2(0, 180);
|
||||
thingsToMove.Translate(new Vector2(-(mouvement * speed), 0)); // bouger le player
|
||||
eulerAngle = 180;
|
||||
|
||||
} // 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 Character player;
|
||||
|
||||
void Start()
|
||||
{
|
||||
player = new Character(1, 10, 10, false);
|
||||
|
||||
@ -3,34 +3,58 @@ using System.Collections;
|
||||
|
||||
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
|
||||
void Start () {
|
||||
isJumping = false;
|
||||
timeJump = 0;
|
||||
isOnGround = false;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
if (Input.GetButton("Fire1") && isJumping == false)
|
||||
if (Input.GetButton("Fire1") && isOnGround == true)
|
||||
{
|
||||
timeJump = 10;
|
||||
isJumping = true;
|
||||
}
|
||||
|
||||
if (timeJump > 0) {
|
||||
player.Translate(0, 0.4f, 0);
|
||||
timeJump--;
|
||||
}
|
||||
else
|
||||
{
|
||||
isJumping = false;
|
||||
player.velocity = new Vector2(player.velocity.x, playerSpeedY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
guid: 14370da66867eeb479e470bd4bb068f7
|
||||
timeCreated: 1446690230
|
||||
timeCreated: 1446945412
|
||||
licenseType: Free
|
||||
TextureImporter:
|
||||
fileIDToRecycleName:
|
||||
@ -22,6 +22,7 @@ TextureImporter:
|
||||
21300030: Jumping3
|
||||
21300032: Jumping4
|
||||
21300034: Shooting
|
||||
21300036: Jump3
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
@ -148,56 +149,6 @@ TextureImporter:
|
||||
alignment: 0
|
||||
pivot: {x: .5, y: .5}
|
||||
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
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
@ -208,6 +159,36 @@ TextureImporter:
|
||||
alignment: 0
|
||||
pivot: {x: .5, y: .5}
|
||||
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:
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 5.2.1f1
|
||||
m_EditorVersion: 5.2.2f1
|
||||
m_StandardAssetsVersion: 0
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user