updated
This commit is contained in:
8
Assets/Scripts/Darkness.meta
Normal file
8
Assets/Scripts/Darkness.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a790bc1f421c79948b8379e14ea3907d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
42
Assets/Scripts/Darkness/VectorFieldHandler.cs
Normal file
42
Assets/Scripts/Darkness/VectorFieldHandler.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
public class VectorFieldHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private float avoidanceDist;
|
||||
[SerializeField]
|
||||
private List<Vector3> avoidances;
|
||||
[SerializeField]
|
||||
private Vector3 size;
|
||||
|
||||
private Texture3D vField;
|
||||
[SerializeField]
|
||||
private VisualEffect effect;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
vField = new Texture3D((int)size.x, (int)size.y, (int)size.z, TextureFormat.RFloat, 0);
|
||||
for(int x = 0;x<size.x;x++)
|
||||
{
|
||||
for(int y = 0; y < size.y; y++)
|
||||
{
|
||||
for(int z = 0; z<size.z; z++)
|
||||
{
|
||||
vField.SetPixel(x, y, z, new Color(1, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
//vField.SetPixel(0, 0, 0, new Color(1, 0, 0, 0));
|
||||
effect.SetTexture("VectorField", vField);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Darkness/VectorFieldHandler.cs.meta
Normal file
11
Assets/Scripts/Darkness/VectorFieldHandler.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72a473445b963b24abc84791b0ffacaa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
74
Assets/Scripts/Enemies/SwarmAnimator.cs
Normal file
74
Assets/Scripts/Enemies/SwarmAnimator.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
[ExecuteAlways]
|
||||
public class SwarmAnimator : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private VisualEffect vfx;
|
||||
|
||||
private Vector3 currentPosition;
|
||||
private Vector3 previousPosition;
|
||||
[SerializeField]
|
||||
private Rigidbody rb;
|
||||
[SerializeField]
|
||||
private string parameterName = "DeltaVector";
|
||||
|
||||
[SerializeField]
|
||||
private Vector3 avoidancePosDefault;
|
||||
|
||||
[SerializeField]
|
||||
private float explodeDuration = 1.0f;
|
||||
private float dur = 0f;
|
||||
private bool isExploding = false;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
previousPosition = currentPosition;
|
||||
currentPosition = transform.position;
|
||||
Vector3 velocity = (currentPosition - previousPosition) ;
|
||||
vfx.SetVector3("DeltaVector", velocity);
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
Explode();
|
||||
}
|
||||
if (isExploding)
|
||||
{
|
||||
if(dur> explodeDuration)
|
||||
{
|
||||
StopExplode();
|
||||
}
|
||||
dur += Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Explode()
|
||||
{
|
||||
vfx.SetVector3("Avoid", transform.position);
|
||||
this.isExploding = true;
|
||||
dur = 0;
|
||||
|
||||
//Wait a sec then stop.
|
||||
}
|
||||
void StopExplode()
|
||||
{
|
||||
vfx.SetVector3("Avoid", avoidancePosDefault);
|
||||
this.isExploding = false;
|
||||
vfx.Stop();
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Enemies/SwarmAnimator.cs.meta
Normal file
11
Assets/Scripts/Enemies/SwarmAnimator.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 735497967e6cfdf4090b8092757c54a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/Experimental.meta
Normal file
8
Assets/Scripts/Experimental.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7708026c94d9bda419e2135a5d117af1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
44
Assets/Scripts/Pistol/PistolAnimationAimAssist.cs
Normal file
44
Assets/Scripts/Pistol/PistolAnimationAimAssist.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PistolAnimationAimAssist : MonoBehaviour
|
||||
{
|
||||
public Transform leftShoulder;
|
||||
public Transform rightShoulder;
|
||||
[SerializeField]
|
||||
private bool isEnabled = false;
|
||||
|
||||
Vector3 lTarget;
|
||||
Vector3 rTarget;
|
||||
private Animator anim;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
lTarget = new Vector3(72.9f, 122.2f, -129.9f);
|
||||
rTarget = new Vector3(82f, 11f, -88f);
|
||||
anim =GetComponent<Animator>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (isEnabled)
|
||||
{
|
||||
anim.StopPlayback();
|
||||
leftShoulder.transform.eulerAngles = lTarget;
|
||||
rightShoulder.transform.eulerAngles = rTarget;
|
||||
print("Applying!");
|
||||
anim.StartPlayback();
|
||||
}
|
||||
}
|
||||
public void Enable()
|
||||
{
|
||||
isEnabled = true;
|
||||
}
|
||||
public void Disable()
|
||||
{
|
||||
isEnabled = false;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Pistol/PistolAnimationAimAssist.cs.meta
Normal file
11
Assets/Scripts/Pistol/PistolAnimationAimAssist.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4463cddde602cde4b8fab345649839c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -13,7 +13,7 @@ public class CameraController : MonoBehaviour
|
||||
private Camera cam;
|
||||
[SerializeField]
|
||||
private Transform target;
|
||||
|
||||
|
||||
private Vector3 offset;
|
||||
|
||||
private Vector3 forward= Vector3.zero;
|
||||
@ -25,7 +25,10 @@ public class CameraController : MonoBehaviour
|
||||
private float newDist = 0;
|
||||
[SerializeField]
|
||||
private bool isChild = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
@ -25,6 +25,8 @@ public class PlayerMovementController : MonoBehaviour
|
||||
|
||||
[SerializeField]
|
||||
private float animatedRotationSpeed = 5f;
|
||||
[SerializeField]
|
||||
private Camera cam;
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user