Combat & Visibility & Collisions
Converted entity materials to new fade shader Implemented visibility system Refactored per-instance entity code to run inside monobehavior on entity instances Created state machine AI for enemy ships with basic patrol and combat routines Removed legacy AI code (controller item behaviors) Added automatic trigger group assignment for matched weapons Created ship collision system Created shield VFX and colliders
This commit is contained in:
parent
8d4bd04891
commit
b53e4aec8c
204 changed files with 8182 additions and 1919 deletions
41
Assets/ShieldAnimation.cs
Normal file
41
Assets/ShieldAnimation.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class ShieldAnimation : MonoBehaviour
|
||||
{
|
||||
public AnimationCurve Alpha;
|
||||
public AnimationCurve Radius;
|
||||
public AnimationCurve AlbedoGamma;
|
||||
public AnimationCurve TextureGamma;
|
||||
public AnimationCurve GradientMultiplier;
|
||||
public float Duration;
|
||||
|
||||
private float _lerp;
|
||||
private Material _material;
|
||||
|
||||
public Vector3 Direction
|
||||
{
|
||||
set { _material.SetVector("_Impact", value); }
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
_material = GetComponent<MeshRenderer>().material;
|
||||
_material.SetFloat("_DitherSampleOffset", Random.value);
|
||||
_lerp = 0;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
_lerp += Time.deltaTime / Duration;
|
||||
if(_lerp > 1) GetComponent<Prototype>().ReturnToPool();
|
||||
_material.SetFloat("_Alpha", Alpha.Evaluate(_lerp));
|
||||
_material.SetFloat("_Radius", Radius.Evaluate(_lerp));
|
||||
_material.SetFloat("_AlbedoGamma", AlbedoGamma.Evaluate(_lerp));
|
||||
_material.SetFloat("_TextureGamma", TextureGamma.Evaluate(_lerp));
|
||||
_material.SetFloat("_GradientMul", GradientMultiplier.Evaluate(_lerp));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue