Skip to content
Snippets Groups Projects
Commit 1974c9f1 authored by v.bloch's avatar v.bloch
Browse files

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

parent 3b811a4e
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
{
public Transform target;
public float smoothing;
public Vector2 maxPosition;
public Vector2 minPosition;
// Start is called before the first frame update
void Start()
......@@ -18,6 +20,10 @@ public class CameraMouvement : MonoBehaviour
{
if(transform.position != target.position){
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);
}
}
......
......@@ -28,6 +28,6 @@ public class PlayerMovement : MonoBehaviour
}
void MoveCharacter(){
myRigidbody.MovePosition(transform.position + change * speed * Time.deltaTime);
}
myRigidbody.MovePosition(transform.position + change * speed * Time.deltaTime);
}
}
......@@ -21,14 +21,19 @@ public class PlayerNature : MonoBehaviour
// Update is called once per frame
void Update()
{
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);
if (Input.GetKeyDown(KeyCode.Space))
this.LooseNature(1);
}
public void LooseNature(int damage)
{
this.currentNature -= damage;
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:
......@@ -18,3 +18,23 @@ 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