Skip to content
Snippets Groups Projects
Commit d42355f5 authored by GIMENEZ TANGUY's avatar GIMENEZ TANGUY
Browse files

Merge branch 'master' into 'master'

personage caler dans l'air de jeu, camera bounder, script de generation de...

See merge request chirz/cityescape!11
parents b3b7acb9 a9ef095d
No related merge requests found
This diff is collapsed.
File moved
fileFormatVersion: 2
guid: bdf7662389bf8487c9a7909d08af8c3e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -6,6 +6,8 @@ public class CameraMouvement : MonoBehaviour ...@@ -6,6 +6,8 @@ public class CameraMouvement : MonoBehaviour
{ {
public Transform target; public Transform target;
public float smoothing; public float smoothing;
public Vector2 maxPosition;
public Vector2 minPosition;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
...@@ -18,6 +20,10 @@ public class CameraMouvement : MonoBehaviour ...@@ -18,6 +20,10 @@ public class CameraMouvement : MonoBehaviour
{ {
if(transform.position != target.position){ if(transform.position != target.position){
Vector3 targetPosition = new Vector3(target.position.x, target.position.y,transform.position.z); Vector3 targetPosition = new Vector3(target.position.x, target.position.y,transform.position.z);
targetPosition.x = Mathf.Clamp(targetPosition.x, minPosition.x, maxPosition.x);
targetPosition.y = Mathf.Clamp(targetPosition.y, minPosition.y, maxPosition.y);
transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing); transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing);
} }
} }
......
...@@ -21,6 +21,7 @@ public class PlayerMovement : MonoBehaviour ...@@ -21,6 +21,7 @@ public class PlayerMovement : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
change = Vector3.zero; change = Vector3.zero;
change.x = Input.GetAxisRaw("Horizontal"); change.x = Input.GetAxisRaw("Horizontal");
change.y = Input.GetAxisRaw("Vertical"); change.y = Input.GetAxisRaw("Vertical");
...@@ -29,8 +30,12 @@ public class PlayerMovement : MonoBehaviour ...@@ -29,8 +30,12 @@ public class PlayerMovement : MonoBehaviour
{ {
MoveCharacter(); MoveCharacter();
} }
}
Vector3 pos = Camera.main.WorldToViewportPoint(transform.position);
pos.x = Mathf.Clamp01(pos.x);
pos.y = Mathf.Clamp01(pos.y);
transform.position = Camera.main.ViewportToWorldPoint(pos);
}
void MoveCharacter() void MoveCharacter()
{ {
myRigidbody.MovePosition(transform.position + change * speed * Time.deltaTime); myRigidbody.MovePosition(transform.position + change * speed * Time.deltaTime);
......
...@@ -34,12 +34,12 @@ public class PlayerNature : MonoBehaviour ...@@ -34,12 +34,12 @@ public class PlayerNature : MonoBehaviour
if (Input.GetKeyDown(KeyCode.Space)) if (Input.GetKeyDown(KeyCode.Space))
this.LooseNature(1); this.LooseNature(1);
} }
// Perd un certain nombre de points de nature // Perd un certain nombre de points de nature
public void LooseNature(int damage) public void LooseNature(int damage)
{ {
this.currentNature -= damage; this.currentNature -= damage;
this.natureBar.SetValue(this.currentNature); this.natureBar.SetValue(this.currentNature);
} }
......
fileFormatVersion: 2
guid: b37f61ddf32ef4514918459a6df9a7f6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CreationItem : MonoBehaviour
{
// Start is called before the first frame update
// Reference to the Prefab. Drag a Prefab into this field in the Inspector.
public GameObject myPrefab;
// This script will simply instantiate the Prefab when the game starts.
void Start()
{
// Instantiate at position (0, 0, 0) and zero rotation.
Instantiate(myPrefab, new Vector3(0, 0, 0), Quaternion.identity);
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: e6d8a296b7e734d5ea35c2a9887d5e17
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
[api-updater (non-obsolete-error-filter)] 26/03/2021 18:38:19 : Starting C:/Program Files/Unity/Hub/Editor/2020.3.1f1/Editor/Data/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 398,5131ms
moved types parse time: 50ms
candidates parse time : 1ms
C# parse time : 207ms
candidates check time : 27ms
console write time : 0ms
[api-updater (non-obsolete-error-filter)] 26/03/2021 19:06:40 : Starting /Applications/Unity/Hub/Editor/2020.3.1f1/Unity.app/Contents/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 219,598ms
moved types parse time: 86ms
candidates parse time : 2ms
C# parse time : 464ms
candidates check time : 51ms
console write time : 1ms
[api-updater (non-obsolete-error-filter)] 26/03/2021 22:19:52 : Starting /Applications/Unity/Hub/Editor/2020.3.1f1/Unity.app/Contents/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 297,35ms
moved types parse time: 109ms
candidates parse time : 2ms
C# parse time : 622ms
candidates check time : 78ms
console write time : 2ms
[api-updater (non-obsolete-error-filter)] 26/03/2021 22:20:15 : Starting /Applications/Unity/Hub/Editor/2020.3.1f1/Unity.app/Contents/Tools/ScriptUpdater/APIUpdater.NonObsoleteApiUpdaterDetector.exe
[api-updater (non-obsolete-error-filter)]
----------------------------------
jit/startup time : 120,606ms
moved types parse time: 131ms
candidates parse time : 5ms
C# parse time : 407ms
candidates check time : 64ms
console write time : 0ms
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment