|
|
@@ -10,27 +10,32 @@ namespace Subworlds.Scripts
|
|
|
|
|
|
private void Awake()
|
|
|
{
|
|
|
- base.trig[0] = gameObject.transform.GetChild(1).gameObject;
|
|
|
- base.trig[1] = gameObject.transform.GetChild(2).gameObject;
|
|
|
- base.Initialize(130, 7, 80, new int[] { 25, 25, 52 }, 60);
|
|
|
+ trig[0] = gameObject.transform.GetChild(1).gameObject;
|
|
|
+ trig[1] = gameObject.transform.GetChild(2).gameObject;
|
|
|
+ Initialize(130, 7, 80, new int[] { 25, 25, 52 }, 60);
|
|
|
+
|
|
|
+ var network = gameObject.GetComponent<NetworkEnemyBasic>();
|
|
|
+ network.isPirate = true;
|
|
|
+
|
|
|
+ canKnockback = false;
|
|
|
}
|
|
|
|
|
|
private void Update()
|
|
|
{
|
|
|
if (Network.isServer)
|
|
|
{
|
|
|
- if (!this.attacking)
|
|
|
+ if (!attacking)
|
|
|
{
|
|
|
- if (this.target)
|
|
|
+ if (target)
|
|
|
{
|
|
|
- if (Mathf.Abs(this.target.transform.position.x - this.t.position.x) < 45f)
|
|
|
+ if (Mathf.Abs(target.transform.position.x - t.position.x) < 45f)
|
|
|
{
|
|
|
- this.attacking = true;
|
|
|
- base.StartCoroutine(this.Attack());
|
|
|
+ attacking = true;
|
|
|
+ StartCoroutine(Attack());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- this.target = null;
|
|
|
+ target = null;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -43,8 +48,8 @@ namespace Subworlds.Scripts
|
|
|
{
|
|
|
for (int i = 0; i < count; i++)
|
|
|
{
|
|
|
- this.dir = this.target.transform.position - this.t.position;
|
|
|
- this.dir.Normalize();
|
|
|
+ dir = target.transform.position - t.position;
|
|
|
+ dir.Normalize();
|
|
|
var newRotation = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
|
|
|
var diffAngle = (z - newRotation + 180) % 360 - 180;
|
|
|
|
|
|
@@ -60,27 +65,29 @@ namespace Subworlds.Scripts
|
|
|
|
|
|
private IEnumerator Attack()
|
|
|
{
|
|
|
- yield return Seach(100 + Random.Range(0, 30));
|
|
|
+ yield return Seach(Random.Range(0, 100));
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
- this.dir = this.target.transform.position - this.t.position;
|
|
|
- this.dir.Normalize();
|
|
|
+ dir = target.transform.position - t.position;
|
|
|
+ dir.Normalize();
|
|
|
var newRotation = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
|
|
|
z = (int) newRotation;
|
|
|
z = (z + 360) % 360;
|
|
|
gameObject.transform.GetChild(0).GetChild(0).GetChild(0).localEulerAngles = new Vector3(0, ((z + 360 - 90) % 360) > 180 ? 0 : 180, ((z + 360 - 90) % 360) > 180 ? z : 180 - z);
|
|
|
- var pos = this.target.transform.position;
|
|
|
+ var pos = target.transform.position;
|
|
|
var dist = 2.1f;
|
|
|
- var endPosition = new Vector3(this.t.position.x + Mathf.Cos((Mathf.PI / 180) * z) * dist, this.t.position.y + Mathf.Sin((Mathf.PI / 180) * z) * dist, this.t.position.z);
|
|
|
+ var endPosition = new Vector3(t.position.x + Mathf.Cos((Mathf.PI / 180) * z) * dist, t.position.y + Mathf.Sin((Mathf.PI / 180) * z) * dist, t.position.z);
|
|
|
var p = (GameObject)Network.Instantiate(Resources.Load("proj/pirateproj"), endPosition, Quaternion.identity, 0);
|
|
|
p.SendMessage("EnemySet", pos, SendMessageOptions.DontRequireReceiver);
|
|
|
- yield return new WaitForSeconds(0.625f);
|
|
|
+ yield return new WaitForSeconds(1.625f);
|
|
|
yield return Seach(10);
|
|
|
}
|
|
|
|
|
|
- this.attacking = false;
|
|
|
+ yield return Seach(200 + Random.Range(0, 200));
|
|
|
+
|
|
|
+ attacking = false;
|
|
|
yield break;
|
|
|
}
|
|
|
}
|