コード例 #1
0
        public static void OnProjectileReachedGround(LeafGolemProjectile projectile)
        {
            projectile.onReachedPosition -= OnProjectileReachedGround;
            projectile.onReachedPosition += OnProjectileGoOut;

            // 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 <bool>("higherProjectileGoesRight")) ? (boss.Projectile_1.transform.position + Vector3.left * 5f) : (boss.Projectile_1.transform.position + Vector3.right * 20f);
                boss.Projectile_1.GoToQuad(vector, duration);
            }
            else if (projectile == boss.Projectile_2)
            {
                Vector3 vector2 = (!specialStateData.Get <bool>("higherProjectileGoesRight")) ? (boss.Projectile_2.transform.position + Vector3.right * 20f) : (boss.Projectile_2.transform.position + Vector3.left * 5f);
                boss.Projectile_2.GoToQuad(vector2, duration);
            }
            else if (projectile == projectile_3)
            {
                Vector3 vector = (!specialStateData.Get <bool>("higherProjectileGoesRight")) ? (projectile_3.transform.position + Vector3.left * 20f) : (projectile_3.transform.position + Vector3.right * 5f);
                projectile_3.GoToQuad(vector, duration);
            }
            else if (projectile == projectile_4)
            {
                Vector3 vector2 = (!specialStateData.Get <bool>("higherProjectileGoesRight")) ? (projectile_4.transform.position + Vector3.right * 5f) : (projectile_4.transform.position + Vector3.left * 20f);
                projectile_4.GoToQuad(vector2, duration);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 public static void OnProjectileCameBack(LeafGolemProjectile projectile)
 {
     boss.Projectile_1.onReachedPosition -= OnProjectileCameBack;
     boss.Projectile_2.onReachedPosition -= OnProjectileCameBack;
     projectile_3.onReachedPosition      -= OnProjectileCameBack;
     projectile_4.onReachedPosition      -= OnProjectileCameBack;
     projectile_3.gameObject.SetActive(false);
     projectile_4.gameObject.SetActive(false);
     OnProjectileCameBackInfo.Invoke(specialState, new object[] { projectile });
 }
コード例 #4
0
        public static void GoToQuadSineWave(this LeafGolemProjectile self, Vector3 position, float duration)
        {
            DynData <LeafGolemProjectile> selfData = new DynData <LeafGolemProjectile>(self);

            if (selfData["goToCoroutine"] != null)
            {
                self.StopCoroutine(selfData.Get <Coroutine>("goToCoroutine"));
                selfData["goToCoroutine"] = null;
            }
            selfData["goToCoroutine"] = self.StartCoroutine(self.GoToQuadSineWaveCoroutine(position, duration));
        }
コード例 #5
0
        public static IEnumerator GoToQuadSineWaveCoroutine(this LeafGolemProjectile self, Vector3 targetPosition, float duration)
        {
            Vector3 startPos = self.transform.position;
            float   progress = 0f;

            while (progress < 1f)
            {
                progress += TimeVars.GetDeltaTime() / duration;
                float tweenProgress = TweenFunctions.Quadratic.Out(0f, 1f, progress);
                float x             = Vector3.Lerp(startPos, targetPosition, tweenProgress).x;
                float y             = targetPosition.y - 1 + Mathf.Cos(6 * Mathf.PI * progress) / 2;
                self.transform.position = new Vector3(x, y, self.transform.position.z);
                yield return(null);
            }
            self.Raise("onReachedPosition", EventArgs.Empty);
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        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);
            }
        }