cleaned up and commented bolas

This commit is contained in:
Adam Salah 2025-07-15 00:17:29 -04:00
parent d9b96438de
commit 2cfeb398ca
9 changed files with 20 additions and 48 deletions

View File

@ -152,7 +152,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3} m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_entityLinked: {fileID: 5530763025372097863} _entityLinked: {fileID: 814896672592409367}
--- !u!1 &1167891119861249516 --- !u!1 &1167891119861249516
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -499,7 +499,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 7468362030574254172} - component: {fileID: 7468362030574254172}
- component: {fileID: 5530763025372097863} - component: {fileID: 814896672592409367}
- component: {fileID: 7802907299062813180} - component: {fileID: 7802907299062813180}
- component: {fileID: 1182150014477180862} - component: {fileID: 1182150014477180862}
- component: {fileID: 5931428661698025033} - component: {fileID: 5931428661698025033}
@ -530,7 +530,7 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5530763025372097863 --- !u!114 &814896672592409367
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -539,7 +539,7 @@ MonoBehaviour:
m_GameObject: {fileID: 7468362030574254173} m_GameObject: {fileID: 7468362030574254173}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 20821ed53f7f53e4cbdc7b3157c35b97, type: 3} m_Script: {fileID: 11500000, guid: 4efc1afdf7c559a4cac25dad0d8917cb, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_lifeBar: {fileID: 9115548409632460044} _lifeBar: {fileID: 9115548409632460044}
@ -1963,7 +1963,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c0fbd934c179894458914437255781c4, type: 3} m_Script: {fileID: 11500000, guid: c0fbd934c179894458914437255781c4, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_entity: {fileID: 5530763025372097863} _entity: {fileID: 814896672592409367}
_projectile: {fileID: 6962989255644195630, guid: 3df5eaab2a4c1d64bba590ed4e1ac0f7, type: 3} _projectile: {fileID: 6962989255644195630, guid: 3df5eaab2a4c1d64bba590ed4e1ac0f7, type: 3}
_projectileSpawn: {fileID: 7322466304790414952} _projectileSpawn: {fileID: 7322466304790414952}
--- !u!1 &9107841294774877216 --- !u!1 &9107841294774877216

View File

@ -73,6 +73,7 @@ MonoBehaviour:
_angle: 0 _angle: 0
_speed: 2 _speed: 2
_slowIntensity: 0.25 _slowIntensity: 0.25
_slowDuration: 10
--- !u!1 &6962989256011107503 --- !u!1 &6962989256011107503
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -1,32 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bolas : Ally
{
public override void Start()
{
base.Start();
}
public override void Update()
{
base.Update();
if (IsEnemyDetected)
{
AttackEnemy();
}
}
void AttackEnemy()
{
//Attack Cooldown
if (AttackInterval < AttackSpeedWait)
{
Animation.PlayAttackAnim();
AttackSpeedWait = 0f;
}
AttackSpeedWait += Time.deltaTime;
}
}

View File

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

View File

@ -134,6 +134,7 @@ public class Projectile : MonoBehaviour
} }
} }
// applies effects on hit
protected virtual void ApplyEffects() { } protected virtual void ApplyEffects() { }
//Getter and Setter //Getter and Setter

View File

@ -6,6 +6,7 @@ public class BolasProjectile : Projectile
{ {
[SerializeField] [SerializeField]
private float _slowIntensity = 0.25f; private float _slowIntensity = 0.25f;
[SerializeField]
private float _slowDuration = 5f; private float _slowDuration = 5f;
protected override void ApplyEffects() protected override void ApplyEffects()

View File

@ -8,13 +8,19 @@ public class Slow : Status
public override void Apply(float duration) public override void Apply(float duration)
{ {
// reset slow duration
_duration += duration; _duration += duration;
// slow entity
EntityLinked.SpeedStatusModifier *= _speedModifier; EntityLinked.SpeedStatusModifier *= _speedModifier;
} }
public override void Unapply() public override void Unapply()
{ {
// bring entity to normal speed
EntityLinked.SpeedStatusModifier /= _speedModifier; EntityLinked.SpeedStatusModifier /= _speedModifier;
// stop effect
Destroy(this); Destroy(this);
} }

View File

@ -14,6 +14,7 @@ public abstract class Status : MonoBehaviour
protected virtual void Update() protected virtual void Update()
{ {
// effect timer
_duration -= Time.deltaTime; _duration -= Time.deltaTime;
if ( _duration < 0 ) Unapply(); if ( _duration < 0 ) Unapply();
} }

View File

@ -9,8 +9,13 @@ public class StatusHandler : MonoBehaviour
public void ApplySlow(float intensity, float duration) public void ApplySlow(float intensity, float duration)
{ {
// check if effect already applied
Slow slow = (Slow)GetStatus(Enum.StatusType.Slow); Slow slow = (Slow)GetStatus(Enum.StatusType.Slow);
// init effect params
slow.Intensity = intensity; slow.Intensity = intensity;
// apply effect
slow.Apply(duration); slow.Apply(duration);
} }