Add fun when shooting
This commit is contained in:
parent
c18d1177e2
commit
58947a4583
@ -157,7 +157,7 @@ SpriteRenderer:
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: -947994997
|
||||
m_SortingLayer: 3
|
||||
m_SortingLayer: 4
|
||||
m_SortingOrder: 5
|
||||
m_Sprite: {fileID: -3565353366220660933, guid: 0aff57dccbcba5d4db39143523f7b1eb,
|
||||
type: 3}
|
||||
@ -342,7 +342,7 @@ SpriteRenderer:
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: -947994997
|
||||
m_SortingLayer: 3
|
||||
m_SortingLayer: 4
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 1687475652488265116, guid: 0aff57dccbcba5d4db39143523f7b1eb,
|
||||
type: 3}
|
||||
@ -497,8 +497,9 @@ MonoBehaviour:
|
||||
FunDegradeSpeed: 5
|
||||
StandingStillMultiplier: 1.5
|
||||
WeaponFun: 20
|
||||
EnemyExplosionFun: 2
|
||||
FurnitureExplosionFun: 1
|
||||
EnemyExplosionFun: 6
|
||||
FurnitureExplosionFun: 4
|
||||
ShootingFunAmount: 0.5
|
||||
DebugAdd10Fun: 0
|
||||
--- !u!1 &8489029732599905358
|
||||
GameObject:
|
||||
@ -568,7 +569,7 @@ SpriteRenderer:
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: -947994997
|
||||
m_SortingLayer: 3
|
||||
m_SortingLayer: 4
|
||||
m_SortingOrder: 10
|
||||
m_Sprite: {fileID: -6198316879909490977, guid: 0aff57dccbcba5d4db39143523f7b1eb,
|
||||
type: 3}
|
||||
|
@ -9,8 +9,16 @@ namespace Saltosion.OneWeapon {
|
||||
public Bullet Bullet;
|
||||
public SpriteRenderer Sprite;
|
||||
public Transform BulletHole;
|
||||
public float Cooldown = 0.5f;
|
||||
|
||||
private bool IsHeld = false;
|
||||
private float CurrCooldown = 0;
|
||||
|
||||
void Update() {
|
||||
if (CurrCooldown > 0) {
|
||||
CurrCooldown -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D collider) {
|
||||
if (IsHeld) {
|
||||
@ -24,15 +32,20 @@ namespace Saltosion.OneWeapon {
|
||||
}
|
||||
}
|
||||
|
||||
public void Shoot(Vector2 direction, float rotation) {
|
||||
public bool Shoot(Vector2 direction, float rotation) {
|
||||
if (Bullet == null) {
|
||||
Debug.LogError("THERE IS NO BULLET");
|
||||
} else {
|
||||
if (CurrCooldown <= 0) {
|
||||
CurrCooldown = Cooldown;
|
||||
Bullet ShotBullet = Instantiate(Bullet, BulletHole.position, new Quaternion());
|
||||
ShotBullet.Direction = direction.normalized;
|
||||
ShotBullet.InitialRotation = rotation;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void FlipGun(bool flipped) {
|
||||
Sprite.flipY = flipped;
|
||||
|
@ -105,13 +105,16 @@ namespace Saltosion.OneWeapon {
|
||||
bool Shoot = Input.GetButtonDown("Shoot");
|
||||
if (Shoot) {
|
||||
if (Gun != null) {
|
||||
Gun.Shoot(LookDirection, Rotation);
|
||||
if (Gun.Shoot(LookDirection, Rotation)) {
|
||||
CameraFX.StopFor(0.03f);
|
||||
CameraFX.ScreenShake(4f);
|
||||
PlayerFun.ShootingFun();
|
||||
}
|
||||
} else if (CurrentHandDistance <= 0) {
|
||||
CurrentHandDistance = 1.5f;
|
||||
CurrentHandRotation = 55;
|
||||
PunchingHand.Punching = true;
|
||||
PlayerFun.ShootingFun();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,9 @@ namespace Saltosion.OneWeapon {
|
||||
public float StandingStillMultiplier = 1.5f;
|
||||
|
||||
public float WeaponFun = 20;
|
||||
public float EnemyExplosionFun = 2f;
|
||||
public float FurnitureExplosionFun = 1f;
|
||||
public float EnemyExplosionFun = 6f;
|
||||
public float FurnitureExplosionFun = 3f;
|
||||
public float ShootingFunAmount = 0.5f;
|
||||
|
||||
public float CurrentFun { private set; get; }
|
||||
|
||||
@ -42,19 +43,27 @@ namespace Saltosion.OneWeapon {
|
||||
CurrentDamageBoost = Mathf.Floor((CurrentFun / 100) * 12) / 12;
|
||||
}
|
||||
|
||||
public void ReceiveNewWeapon() {
|
||||
float NewFun = CurrentFun + WeaponFun;
|
||||
private void AddFun(float fun) {
|
||||
float NewFun = CurrentFun + fun;
|
||||
CurrentFun = Mathf.Min(MaxFun, NewFun);
|
||||
Debug.Log("Added " + fun + " fun, " + CurrentFun);
|
||||
}
|
||||
|
||||
public void ReceiveNewWeapon() {
|
||||
AddFun(WeaponFun);
|
||||
}
|
||||
|
||||
public void ShootingFun() {
|
||||
AddFun(ShootingFunAmount);
|
||||
}
|
||||
|
||||
public void Explosion(bool isFurniture) {
|
||||
float NewFun = CurrentFun;
|
||||
if (isFurniture) {
|
||||
NewFun += FurnitureExplosionFun;
|
||||
AddFun(FurnitureExplosionFun);
|
||||
} else {
|
||||
NewFun += EnemyExplosionFun;
|
||||
AddFun(EnemyExplosionFun);
|
||||
}
|
||||
CurrentFun = Mathf.Min(MaxFun, NewFun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user