more abilities and fixes

This commit is contained in:
Sylvia 2026-06-12 03:54:49 -07:00
parent cb4470f2d6
commit fc2329a873
31 changed files with 268 additions and 52 deletions

View file

@ -1,5 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &421458751285719772
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3296806893241747122}
m_Layer: 7
m_Name: WallDetectionLeft
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3296806893241747122
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 421458751285719772}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.5, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1849759059644475718}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &3703793765329398476
GameObject:
m_ObjectHideFlags: 0
@ -114,6 +145,37 @@ Transform:
- {fileID: 6298566175391005934}
m_Father: {fileID: 1849759059644475718}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4267661987825850846
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3190385463741537217}
m_Layer: 7
m_Name: WallDetectionRight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3190385463741537217
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4267661987825850846}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.5, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1849759059644475718}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4860917236126221086
GameObject:
m_ObjectHideFlags: 0
@ -294,6 +356,8 @@ Transform:
- {fileID: 6047872402331640471}
- {fileID: 5727125788773421239}
- {fileID: 3459125905580705084}
- {fileID: 3296806893241747122}
- {fileID: 3190385463741537217}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &5359122752217294183
@ -442,7 +506,9 @@ MonoBehaviour:
maxTargettingRange: 0
maxHeightDifference: 0
minTargetJumpDistance: 0
wallDetectors: []
wallDetectors:
- {fileID: 3296806893241747122}
- {fileID: 3190385463741537217}
wallLayer:
serializedVersion: 2
m_Bits: 8

View file

@ -47,7 +47,7 @@ MonoBehaviour:
abilityName: Shoot Bullet
thisEntity: {fileID: 0}
cooldown: 1
power: 20
power: 2
targetLocation: {x: 0, y: 0, z: 0}
projectile: {fileID: 4968744362001082579, guid: 75dc1523a7fccf65c913e8fcd3e81206, type: 3}
projectileSpeed: 16

View file

@ -0,0 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4311467942257352709
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 138905293908846767}
- component: {fileID: 6375377852585697837}
m_Layer: 7
m_Name: SwordSlash
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &138905293908846767
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4311467942257352709}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
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 &6375377852585697837
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4311467942257352709}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68c3a1cc2e61de7f4a20126c2d48b4b5, type: 3}
m_Name:
m_EditorClassIdentifier:
abilityName: Sword Slash
thisEntity: {fileID: 0}
cooldown: 0.5
power: 2
targetLocation: {x: 0, y: 0, z: 0}
entityLayer:
serializedVersion: 2
m_Bits: 128
damageRadius: 0.5

View file

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

View file

@ -91,7 +91,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1837572426186338970}
- {fileID: 2713030079190109584}
m_Father: {fileID: 4893125162624080007}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7013272570264032182
@ -364,10 +364,12 @@ MonoBehaviour:
attackOriginPoint: {fileID: 5196447376297042405}
attackOriginCenter: {fileID: 462469376723332893}
abilities:
- {fileID: 5774395727869586210}
- {fileID: 8949223911955580690}
rb: {fileID: 2047881652295913413}
sprite: {fileID: 3940513499368174321}
isFacingRight: 0
originalColor: {r: 0, g: 0, b: 0, a: 0}
damageColorChangeSpeed: 4
--- !u!1 &7227609801905333812
GameObject:
m_ObjectHideFlags: 0
@ -647,7 +649,7 @@ Transform:
m_Children: []
m_Father: {fileID: 462469376723332893}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &4772816046521060917
--- !u!1001 &2615434540164326719
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -655,72 +657,72 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 8123025040681778021}
m_Modifications:
- target: {fileID: 1305679653731509527, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
propertyPath: thisEntity
value:
objectReference: {fileID: 8821502866947698626}
- target: {fileID: 2518044865521178739, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
propertyPath: m_Name
value: ShootBullet
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalPosition.x
value: 10.320001
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalPosition.y
value: 2.69
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
- target: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4311467942257352709, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: m_Name
value: SwordSlash
objectReference: {fileID: 0}
- target: {fileID: 6375377852585697837, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
propertyPath: thisEntity
value:
objectReference: {fileID: 6187681838506810731}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
--- !u!4 &1837572426186338970 stripped
m_SourcePrefab: {fileID: 100100000, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
--- !u!4 &2713030079190109584 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6610207326853905583, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
m_PrefabInstance: {fileID: 4772816046521060917}
m_CorrespondingSourceObject: {fileID: 138905293908846767, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
m_PrefabInstance: {fileID: 2615434540164326719}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5774395727869586210 stripped
--- !u!114 &8949223911955580690 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1305679653731509527, guid: 303f1513a3d6002c7a0b7b3fcc807afd, type: 3}
m_PrefabInstance: {fileID: 4772816046521060917}
m_CorrespondingSourceObject: {fileID: 6375377852585697837, guid: 66dacfe15602208ce8dda31a9fae4107, type: 3}
m_PrefabInstance: {fileID: 2615434540164326719}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c2e841223273eee80837e20d27430787, type: 3}
m_Script: {fileID: 11500000, guid: 68c3a1cc2e61de7f4a20126c2d48b4b5, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -3456,6 +3456,10 @@ PrefabInstance:
propertyPath: m_Name
value: Youmu
objectReference: {fileID: 0}
- target: {fileID: 7036878528139897633, guid: 109c16c8c32ec1d5a831de3f8cbbfc4b, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8821502866947698626, guid: 109c16c8c32ec1d5a831de3f8cbbfc4b, type: 3}
propertyPath: player
value:
@ -3568,10 +3572,18 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5842194869372379965, guid: d79cfe0fe733d409a8fe68dede44bd2a, type: 3}
propertyPath: thisEntity
value:
objectReference: {fileID: 6873119575921479510}
- target: {fileID: 3190385463741537217, guid: d79cfe0fe733d409a8fe68dede44bd2a, type: 3}
propertyPath: m_LocalPosition.y
value: -0.25
objectReference: {fileID: 0}
- target: {fileID: 3296806893241747122, guid: d79cfe0fe733d409a8fe68dede44bd2a, type: 3}
propertyPath: m_LocalPosition.y
value: -0.25
objectReference: {fileID: 0}
- target: {fileID: 6505873975486236506, guid: d79cfe0fe733d409a8fe68dede44bd2a, type: 3}
propertyPath: damageColorChangeSpeed
value: 4
objectReference: {fileID: 0}
- target: {fileID: 7051425899434579382, guid: d79cfe0fe733d409a8fe68dede44bd2a, type: 3}
propertyPath: m_Name
value: Reisen
@ -3584,10 +3596,6 @@ PrefabInstance:
propertyPath: player
value:
objectReference: {fileID: 1074741177}
- target: {fileID: 8547430362287369941, guid: d79cfe0fe733d409a8fe68dede44bd2a, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -3745,6 +3753,8 @@ MonoBehaviour:
rb: {fileID: 7332886677051986745}
sprite: {fileID: 5694705184433450509}
isFacingRight: 0
originalColor: {r: 0, g: 0, b: 0, a: 0}
damageColorChangeSpeed: 4
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fba3e9535515c7e87b339b01929aef98
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
using UnityEngine;
public class SwordSlash : Ability
{
public LayerMask entityLayer;
//probably will change out entity detection. or will i?
//i'd also probably have to offset the damage origin direction
public float damageRadius;
protected override void AbilityEffects()
{
base.AbilityEffects();
Collider2D[] entitiesFound = Physics2D.OverlapCircleAll(thisEntity.stats.attackOriginPoint.position, damageRadius, entityLayer);
foreach (Collider2D entityFound in entitiesFound)
{
if (!entityFound.CompareTag(thisEntity.tag))
{
if (entityFound.TryGetComponent(out Entity isEntity))
{
isEntity.stats.TakeDamage(power);
}
}
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 68c3a1cc2e61de7f4a20126c2d48b4b5

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e041f619639af6b64af518d30f666342
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -25,15 +26,35 @@ public class EntityStats : MonoBehaviour
public Rigidbody2D rb;
public SpriteRenderer sprite;
public bool isFacingRight;
public Color originalColor; //remove later
public float damageColorChangeSpeed;
private void Start()
{
originalColor = sprite.color;
}
public void TakeDamage(float damage)
{
health -= damage;
StartCoroutine(DamageVisual());
if (health <= 0)
{
thisEntity.OnDeath();
}
}
private IEnumerator DamageVisual()
{
float currentState = 0;
while (currentState < 1)
{
currentState += Time.deltaTime * damageColorChangeSpeed;
sprite.color = Color.Lerp(Color.gray, originalColor, currentState);
yield return null;
}
}
public void Heal(float healing)
{
health += healing;

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f2193c612c955cc5bb4fbbe2593ccb0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -20,14 +20,7 @@ public class PlayerSwitcher : MonoBehaviour
{
if (Input.GetKeyDown(KeyCode.E) && currentSwitchCooldown <= 0f)
{
if (player1.isActiveAndEnabled)
{
SwitchPlayers(player1, player1AI, player2, player2AI);
}
else
{
SwitchPlayers(player2, player2AI, player1, player1AI);
}
SwitchPlayers(player1, player1AI, player2, player2AI);
currentSwitchCooldown = switchCooldown;
}
@ -45,5 +38,17 @@ public class PlayerSwitcher : MonoBehaviour
playerB.enabled = true;
playerBAI.enabled = false;
(playerB.transform.position, playerAAI.transform.position) = (playerAAI.transform.position, playerB.transform.position);
player1 = playerB;
player1AI = playerBAI;
player2 = playerA;
player2AI = playerAAI;
foreach (Ability ability in playerA.stats.abilities)
{
ability.thisEntity = playerAAI;
}
foreach (Ability ability in playerBAI.stats.abilities)
{
ability.thisEntity = playerB;
}
}
}