first
This commit is contained in:
8
Assets/Project Files/Scripts/JoonasP.meta
Normal file
8
Assets/Project Files/Scripts/JoonasP.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60ce99a0af04f934190ce18ee4f567b6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
Assets/Project Files/Scripts/JoonasP/FlyWand.cs
Normal file
44
Assets/Project Files/Scripts/JoonasP/FlyWand.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
public class FlyWand : MonoBehaviour
|
||||
{
|
||||
private GameObject player;
|
||||
private bool isFlying;
|
||||
|
||||
public ParticleSystem particles;
|
||||
public float flySpeed = 10f;
|
||||
public float testForce;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player");
|
||||
isFlying = false;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isFlying)
|
||||
{
|
||||
//player.transform.position += transform.up * flySpeed * Time.deltaTime;
|
||||
player.GetComponent<Rigidbody>().AddForce(-transform.up * testForce * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void EnableFly()
|
||||
{
|
||||
isFlying = true;
|
||||
particles.Play();
|
||||
}
|
||||
|
||||
public void DisableFly()
|
||||
{
|
||||
isFlying = false;
|
||||
particles.Stop();
|
||||
particles.Clear();
|
||||
}
|
||||
}
|
||||
11
Assets/Project Files/Scripts/JoonasP/FlyWand.cs.meta
Normal file
11
Assets/Project Files/Scripts/JoonasP/FlyWand.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ee8103568a01d804d89cb1fc1dff91eb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Project Files/Scripts/JoonasP/VignetteController.cs
Normal file
32
Assets/Project Files/Scripts/JoonasP/VignetteController.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
|
||||
public class VignetteController : MonoBehaviour
|
||||
{
|
||||
private Rigidbody player;
|
||||
public Volume vignette;
|
||||
public float threshold = 5f;
|
||||
public float maxValue = 1f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(vignette.profile.TryGet(out Vignette vig)) //https://www.youtube.com/watch?v=8S22Qt_-nY8
|
||||
{
|
||||
float value = (Mathf.Abs(player.velocity.x) + Mathf.Abs(player.velocity.y) + Mathf.Abs(player.velocity.z)) / threshold;
|
||||
if (value > maxValue) value = maxValue;
|
||||
|
||||
vig.intensity.Override(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25d8a8d9dfb3e574f952521e9883724f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user