Update
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
namespace Invector.vShooter
|
||||
{
|
||||
public class vBotRifleAnimationControl : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
public float pulseSpeed;
|
||||
void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
animator.SetFloat("PulseSpeed", pulseSpeed);
|
||||
}
|
||||
public void OnChangePowerChanger(float value)
|
||||
{
|
||||
animator.SetFloat("PowerCharger", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e210168abfb6f04da4d02b8ac9cba3e
|
||||
timeCreated: 1512581958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vShooter
|
||||
{
|
||||
[vClassHeader("PowerCharge Projectile", openClose = false)]
|
||||
public class vPowerChargeProjectileControl : vMonoBehaviour
|
||||
{
|
||||
public List<vProjectilePerPower> projectiles;
|
||||
private vShooterWeapon weapon;
|
||||
private vProjectilePerPower lastProjectilePerPower;
|
||||
|
||||
void Start()
|
||||
{
|
||||
weapon = GetComponent<vShooterWeapon>();
|
||||
if (weapon)
|
||||
{
|
||||
weapon.onPowerChargerChanged.AddListener(OnChangerPower);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnChangerPower(float value)
|
||||
{
|
||||
if (value <= 0) return;
|
||||
|
||||
if (weapon)
|
||||
{
|
||||
var projectilePerPower = projectiles.Find(projectile => value >= projectile.min && value <= projectile.max);
|
||||
|
||||
if (projectilePerPower != null && projectilePerPower.projectile && lastProjectilePerPower != projectilePerPower)
|
||||
{
|
||||
lastProjectilePerPower = projectilePerPower;
|
||||
weapon.projectile = projectilePerPower.projectile;
|
||||
projectilePerPower.OnValidatePower.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class vProjectilePerPower
|
||||
{
|
||||
public float min;
|
||||
public float max;
|
||||
public GameObject projectile;
|
||||
[Tooltip("Called when power is between min and max value")]
|
||||
public UnityEngine.Events.UnityEvent OnValidatePower;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0789346e3d9498e4eb933da262f9a4f3
|
||||
timeCreated: 1512583517
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user