61 lines
1.6 KiB
C#
61 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Saltosion.OneWeapon {
|
|
public class PlayerFun : MonoBehaviour {
|
|
|
|
public Player Player;
|
|
|
|
public float MaxFun = 100;
|
|
public float FunDegradeSpeed = 5;
|
|
public float StandingStillMultiplier = 1.5f;
|
|
|
|
public float WeaponFun = 20;
|
|
public float EnemyExplosionFun = 2f;
|
|
public float FurnitureExplosionFun = 1f;
|
|
|
|
public float CurrentFun { private set; get; }
|
|
|
|
public bool DebugAdd10Fun = false;
|
|
|
|
public float CurrentDamageBoost { private set; get; }
|
|
|
|
void Start() {
|
|
CurrentFun = MaxFun;
|
|
}
|
|
|
|
void Update() {
|
|
float Delta = FunDegradeSpeed * Time.deltaTime;
|
|
if (!Player.IsMoving) {
|
|
Delta *= StandingStillMultiplier;
|
|
}
|
|
float NewFun = CurrentFun - Delta;
|
|
|
|
if (DebugAdd10Fun) {
|
|
NewFun += 10;
|
|
DebugAdd10Fun = false;
|
|
}
|
|
|
|
CurrentFun = Mathf.Clamp(NewFun, 0, MaxFun);
|
|
|
|
CurrentDamageBoost = Mathf.Floor((CurrentFun / 100) * 12) / 12;
|
|
}
|
|
|
|
public void ReceiveNewWeapon() {
|
|
float NewFun = CurrentFun + WeaponFun;
|
|
CurrentFun = Mathf.Min(MaxFun, NewFun);
|
|
}
|
|
|
|
public void Explosion(bool isFurniture) {
|
|
float NewFun = CurrentFun;
|
|
if (isFurniture) {
|
|
NewFun += FurnitureExplosionFun;
|
|
} else {
|
|
NewFun += EnemyExplosionFun;
|
|
}
|
|
CurrentFun = Mathf.Min(MaxFun, NewFun);
|
|
}
|
|
}
|
|
}
|