77 lines
1.5 KiB
C#
77 lines
1.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Rider : Ally
|
|
{
|
|
private Vector2 _movementVector = Vector2.zero;
|
|
[SerializeField]
|
|
private int _maxChargeHitCount;
|
|
[SerializeField]
|
|
private int _maxChargeDistance;
|
|
private int _opponentsHit;
|
|
private float _originalPosX;
|
|
private float _originalPosY;
|
|
private bool _isCharging;
|
|
|
|
|
|
public override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
_originalPosX = transform.position.x;
|
|
_originalPosY = transform.position.y;
|
|
_isCharging = true;
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
if (_isCharging)
|
|
{
|
|
_movementVector.x = Time.deltaTime * Speed;
|
|
transform.position += (Vector3)_movementVector;
|
|
if (true)
|
|
{
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (IsEnemyDetected)
|
|
{
|
|
AttackEnemy();
|
|
}
|
|
}
|
|
}
|
|
|
|
void AttackEnemyRiding()
|
|
{
|
|
//Attack Cooldown
|
|
if (AttackSpeedWait > AttackInterval)
|
|
{
|
|
|
|
Animation.PlayAttackAnim();
|
|
|
|
AttackSpeedWait = 0f;
|
|
}
|
|
|
|
AttackSpeedWait += Time.deltaTime;
|
|
}
|
|
|
|
void AttackEnemy()
|
|
{
|
|
//Attack Cooldown
|
|
if (AttackSpeedWait > AttackInterval)
|
|
{
|
|
|
|
Animation.PlayAttackAnim();
|
|
|
|
AttackSpeedWait = 0f;
|
|
}
|
|
|
|
AttackSpeedWait += Time.deltaTime;
|
|
}
|
|
}
|