-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
round shot weapon can purchased in the shop
- Loading branch information
Showing
15 changed files
with
636 additions
and
6 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
Assets/Resources/Prefabs/Player Projectiles/player_projectile_round_shot.prefab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &227399658643498932 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 5488743611133324747} | ||
- component: {fileID: 7549832020881850003} | ||
m_Layer: 0 | ||
m_Name: player_projectile_round_shot | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &5488743611133324747 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 227399658643498932} | ||
serializedVersion: 2 | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: 126.49457, y: 589.6237, z: -2.5083663} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_ConstrainProportionsScale: 0 | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!114 &7549832020881850003 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 227399658643498932} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 8b8128b909ad1b948a7af997009d8669, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
default_projectile: {fileID: 6289194308112020401, guid: 184e53708a9fbf44db2da85a2173e207, type: 3} |
7 changes: 7 additions & 0 deletions
7
Assets/Resources/Prefabs/Player Projectiles/player_projectile_round_shot.prefab.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
Assets/Scripts/Asteroids/Projectiles/ProjectileRoundShot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using UnityEngine; | ||
|
||
public class ProjectileRoundShot : MonoBehaviour | ||
{ | ||
[SerializeField] GameObject default_projectile; | ||
|
||
void Start() | ||
{ | ||
RoundShot(); | ||
} | ||
|
||
private void RoundShot() | ||
{ | ||
InstanceProjectile(default_projectile, new Vector2(1, 1)); | ||
InstanceProjectile(default_projectile, new Vector2(1, -1)); | ||
InstanceProjectile(default_projectile, new Vector2(-1, 1)); | ||
InstanceProjectile(default_projectile, new Vector2(-1, -1)); | ||
InstanceProjectile(default_projectile, Vector2.right); | ||
InstanceProjectile(default_projectile, Vector2.left); | ||
InstanceProjectile(default_projectile, Vector2.down); | ||
InstanceProjectile(default_projectile, Vector2.up); | ||
} | ||
|
||
private void InstanceProjectile(GameObject projectile, Vector2 move_direction) | ||
{ | ||
ProjctileDefaultLogic projectile_script = projectile.GetComponent<ProjctileDefaultLogic>(); | ||
|
||
if (projectile_script != null) | ||
{ | ||
projectile_script.SetMoveDirection(move_direction); | ||
Instantiate(projectile, transform.position, Quaternion.identity); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Scripts/Asteroids/Projectiles/ProjectileRoundShot.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Assets/Scripts/Shop/Cards/Weapons/04_round_shot_weapon.asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 8243da5405db3e84b9d83a1e6b8a39d0, type: 3} | ||
m_Name: 04_round_shot_weapon | ||
m_EditorClassIdentifier: | ||
card_name: ROUND SHOT | ||
upgrade_type: 6 | ||
cost_multiplier: 0 | ||
upgrade_value: 0 | ||
max_upgrade_stat: 0 | ||
current_stat: 0 | ||
upgrade_cost: 0 | ||
weapon_prefab_path: Prefabs/Player Projectiles/player_projectile_round_shot | ||
weapon_cost: 10000 | ||
is_unlocked_weapon: 1 | ||
ability_scriptableobject_path: | ||
ability_cost: 0 | ||
is_unlocked_ability: 0 |
8 changes: 8 additions & 0 deletions
8
Assets/Scripts/Shop/Cards/Weapons/04_round_shot_weapon.asset.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using UnityEngine; | ||
|
||
[CreateAssetMenu(fileName = "_weapon", menuName = "Card/Weapon/Round Shot")] | ||
public class RoundShotCard : Card, IWeapon | ||
{ | ||
int total_score; | ||
string current_path; | ||
|
||
public void Load(GameData game_data) | ||
{ | ||
is_unlocked_weapon = game_data.round_shot_unlocked; | ||
total_score = game_data.total_score; | ||
current_path = game_data.weapon_prefab_path; | ||
} | ||
|
||
public void Unlock(GameData game_data) | ||
{ | ||
if (total_score >= weapon_cost && !is_unlocked_weapon) | ||
{ | ||
total_score -= weapon_cost; | ||
current_path = weapon_prefab_path; | ||
is_unlocked_weapon = true; | ||
|
||
Save(game_data); | ||
} | ||
else | ||
{ | ||
Debug.LogWarning("not enought scroe points or is unlocked"); | ||
} | ||
} | ||
|
||
public void Equip(GameData gameData) | ||
{ | ||
current_path = weapon_prefab_path; | ||
Save(gameData); | ||
} | ||
|
||
private void Save(GameData game_data) | ||
{ | ||
game_data.round_shot_unlocked = is_unlocked_weapon; | ||
game_data.total_score = total_score; | ||
game_data.weapon_prefab_path = current_path; | ||
SaveSystem.Save(game_data); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.