Add shotgun

This commit is contained in:
Sofia 2019-08-18 20:44:12 +03:00
parent 035f6a41a3
commit 6960cf93f2
15 changed files with 9866 additions and 19 deletions

View File

@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
@ -31,27 +31,27 @@ TextureImporter:
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
filterMode: 0
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spritePixelsToUnits: 32
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
@ -63,7 +63,31 @@ TextureImporter:
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
@ -76,7 +100,7 @@ TextureImporter:
outline: []
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:

View File

@ -0,0 +1,65 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6729850174041497321
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 759232294440115550}
- component: {fileID: 4094504807648883912}
- component: {fileID: 1148105897601366517}
m_Layer: 0
m_Name: ShotgunBullet
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &759232294440115550
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6729850174041497321}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -19.990198, y: 7.5981717, z: -12.029297}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4094504807648883912
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6729850174041497321}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 87f191de6fc4120448f19d49e9afb751, type: 3}
m_Name:
m_EditorClassIdentifier:
Direction: {x: 0, y: 0}
InitialRotation: 0
HasExploded: 0
--- !u!114 &1148105897601366517
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6729850174041497321}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f9edcbf3e93102449b08e0213772089f, type: 3}
m_Name:
m_EditorClassIdentifier:
SubBullet: {fileID: 4482402865533696887, guid: 6895e4efeafdc3a4f8f4296856a389fc,
type: 3}
BulletsShot: 5
TotalArc: 90

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3e6dd1945fe63a74bb9e9ef31a661b65
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6895e4efeafdc3a4f8f4296856a389fc
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -123,6 +123,7 @@ MonoBehaviour:
PossibleGuns:
- {fileID: 4462327694118370270, guid: 7b3529c1a7d22d143a060281857bbca5, type: 3}
- {fileID: 2523517584660005062, guid: 15e91d59183ba524bb3bc46b402b722d, type: 3}
- {fileID: 4462327694118370270, guid: 32eb78b5f736d064e80ea3e74749ba29, type: 3}
SpriteChanger: {fileID: 0}
DebugExpelGun: 0
--- !u!1 &2707968752687241717

View File

@ -123,6 +123,7 @@ MonoBehaviour:
PossibleGuns:
- {fileID: 4462327694118370270, guid: 7b3529c1a7d22d143a060281857bbca5, type: 3}
- {fileID: 2523517584660005062, guid: 15e91d59183ba524bb3bc46b402b722d, type: 3}
- {fileID: 4462327694118370270, guid: 32eb78b5f736d064e80ea3e74749ba29, type: 3}
SpriteChanger: {fileID: 0}
DebugExpelGun: 0
--- !u!1 &2707968752687241717

View File

@ -158,6 +158,7 @@ MonoBehaviour:
PossibleGuns:
- {fileID: 4462327694118370270, guid: 7b3529c1a7d22d143a060281857bbca5, type: 3}
- {fileID: 2523517584660005062, guid: 15e91d59183ba524bb3bc46b402b722d, type: 3}
- {fileID: 4462327694118370270, guid: 32eb78b5f736d064e80ea3e74749ba29, type: 3}
SpriteChanger: {fileID: 4165805474229086665}
DebugExpelGun: 0
--- !u!50 &11699643827672084

View File

@ -126,11 +126,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c80190f5b43dadf47ae89f04f092d1ff, type: 3}
m_Name:
m_EditorClassIdentifier:
Bullet: {fileID: 4482402865533696887, guid: 50f6c5e97c249214f87af25e7f537a09, type: 3}
Bullet: {fileID: 4094504807648883912, guid: 3e6dd1945fe63a74bb9e9ef31a661b65, type: 3}
Sprite: {fileID: 4462327695001662280}
BulletHole: {fileID: 427857587156450783}
MaxCooldown: 0.3
MinCooldown: 0.3
MaxCooldown: 0.6
MinCooldown: 0.6
Bobbing: {fileID: 3522608540502111974}
--- !u!114 &3522608540502111974
MonoBehaviour:

View File

@ -111006,7 +111006,7 @@ Transform:
- {fileID: 1822937580}
- {fileID: 1619207830}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1616078557 stripped
Transform:
@ -112825,7 +112825,7 @@ PrefabInstance:
- target: {fileID: 11699643827672082, guid: 254d8b252b63a6547810dd3729ddc91b,
type: 3}
propertyPath: m_RootOrder
value: 8
value: 7
objectReference: {fileID: 0}
- target: {fileID: 11699643827672082, guid: 254d8b252b63a6547810dd3729ddc91b,
type: 3}

View File

@ -8,7 +8,7 @@ using Saltosion.OneWeapon.Environment;
namespace Saltosion.OneWeapon.Guns {
[RequireComponent(typeof(Bullet))]
public class RevolverBullet : MonoBehaviour {
public class RegularBullet : MonoBehaviour {
public Rigidbody2D Body;
public GameObject Sprite;
@ -16,6 +16,8 @@ namespace Saltosion.OneWeapon.Guns {
public ParticleSystem Trail;
public ParticleSystem Explosion;
public float Damage = 12;
private float DeathTimer = 0;
private Bullet Bullet;
@ -53,7 +55,7 @@ namespace Saltosion.OneWeapon.Guns {
DeathTimer = 19;
// Do damage here, kill everyone
Bullet.DoDamage(12, 1, collider, Bullet.Direction);
Bullet.DoDamage(Damage, 1, collider, Bullet.Direction);
}
}
}

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon.Guns {
public class ShotgunBullet : MonoBehaviour {
public Bullet SubBullet;
public int BulletsShot;
public float TotalArc;
private Bullet Bullet;
void Start() {
Bullet = GetComponent<Bullet>();
Vector2 Direction = Bullet.Direction;
float Rot = Bullet.InitialRotation;
Vector2 BaseDirection = Quaternion.AngleAxis(TotalArc / 2, Vector3.forward) * Direction;
float Rotation = Mathf.Atan2(BaseDirection.y, BaseDirection.x) * Mathf.Rad2Deg + 90;
for (int i = 0; i < BulletsShot; i++) {
float CurrentAngle = -i * (TotalArc / (BulletsShot - 1));
Vector2 CurrentDirection = Quaternion.AngleAxis(CurrentAngle, Vector3.forward) * BaseDirection;
Bullet ShotBullet = GameObject.Instantiate(SubBullet, transform.position, new Quaternion());
ShotBullet.Direction = CurrentDirection;
ShotBullet.InitialRotation = Rotation + CurrentAngle;
}
Destroy(gameObject);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9edcbf3e93102449b08e0213772089f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -53,4 +53,4 @@ Physics2DSettings:
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdfffffff6fffffff7fffffff9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdfffffff4fffffff7fffffff9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff