public static void OnProjectileGoOut(LeafGolemProjectile projectile) { projectile.onReachedPosition -= OnProjectileGoOut; projectile.onReachedPosition += OnProjectileAtMergePosition; // One goes 5, one goes 20, both go at 17 speed float duration = 17f / specialState.projectileSpeed; if (projectile == boss.Projectile_1) { Vector3 vector = specialStateData.Get <Vector3>("projectileMergePosition") + Vector3.up * 0.75f; projectile.GoToLinear(vector, duration); } else if (projectile == boss.Projectile_2) { projectile.GoToLinear(specialStateData.Get <Vector3>("projectileMergePosition"), duration); } else if (projectile == projectile_3) { Vector3 vector = extraProjectileMergePos + Vector3.up * 0.75f; projectile.GoToLinear(vector, duration); } else if (projectile == projectile_4) { projectile.GoToLinear(extraProjectileMergePos, duration); } }
public static void OnProjectileCameUp(LeafGolemProjectile projectile) { projectile.onReachedPosition -= OnProjectileCameUp; projectile.onReachedPosition += OnProjectileCameBack; float duration = 15f / specialState.projectileSpeed; if (projectile == boss.Projectile_1 || projectile == projectile_3) { projectile.GoToLinear(boss.downProjectileSpawnPos.position, duration); } else { projectile.GoToLinear(boss.downProjectileSpawnPos.position + Vector3.down * 0.75f, duration); } }
public static void OnProjectileAtMergePosition(LeafGolemProjectile projectile) { projectile.onReachedPosition -= OnProjectileAtMergePosition; projectile.onReachedPosition += OnProjectileCameUp; Vector3 returnPos = new Vector3(projectile.transform.position.x, boss.downProjectileSpawnPos.position.y, projectile.transform.position.z); if (projectile == boss.Projectile_1 || projectile == projectile_3) { float duration = Vector3.Distance(projectile.transform.position, returnPos) / specialState.projectileSpeed; projectile.GoToLinear(returnPos, duration); } else { float duration2 = Vector3.Distance(projectile.transform.position, returnPos + Vector3.down * 0.75f) / specialState.projectileSpeed; projectile.GoToLinear(returnPos + Vector3.down * 0.75f, duration2); } }
public static void OnProjectileReachedUpApart(LeafGolemProjectile projectile) { projectile.onReachedPosition -= OnProjectileReachedUpApart; RaycastHit2D[] array = Physics2D.RaycastAll(projectile.transform.position, Vector3.down, 30f, LayerMaskConstants.GROUND_8_AND_16); Vector3 projectileTargetPos = Vector3.zero; for (int i = 0; i < array.Length; i++) { CollisionDirection component = array[i].collider.GetComponent <CollisionDirection>(); if (component == null || !component.CollideOnlyOnTop()) { projectileTargetPos = array[i].point; break; } } projectileTargetPos.y += 1f; if (projectile == boss.Projectile_1 || projectile == boss.Projectile_2) { specialStateData.Set("projectileMergePosition", projectileTargetPos); } else { extraProjectileMergePos = projectileTargetPos; } projectile.onReachedPosition += OnProjectileReachedGround; if (projectile == boss.Projectile_1 || projectile == projectile_3) { float duration = Vector3.Distance(projectile.transform.position, projectileTargetPos + Vector3.up * 0.75f) / specialState.projectileSpeed; projectile.GoToLinear(projectileTargetPos + Vector3.up * 0.75f, duration); } else { float duration = Vector3.Distance(projectile.transform.position, projectileTargetPos) / specialState.projectileSpeed; projectile.GoToLinear(projectileTargetPos, duration); } }