예제 #1
0
        public void Setup(bool isSource, ExplosionDirection direction, int bombRange, GroundTile groundTile)
        {
            CheckHitSomething();
            if (isSource)
            {
                onSourceExplosion.Invoke();
                bombRange--;
                SpreadExplosion(groundTile.GetBottomNeighbor(), ExplosionDirection.Down, bombRange);
                SpreadExplosion(groundTile.GetTopNeighbor(), ExplosionDirection.Up, bombRange);
                SpreadExplosion(groundTile.GetLeftNeighbor(), ExplosionDirection.Left, bombRange);
                SpreadExplosion(groundTile.GetRightNeighbor(), ExplosionDirection.Right, bombRange);
            }
            else
            {
                animator.SetBool("isDerivate", true);
                if (direction == ExplosionDirection.Up || direction == ExplosionDirection.Down)
                {
                    transform.rotation = Quaternion.Euler(0, 0, 90);
                }

                if (bombRange > 0)
                {
                    bombRange--;
                    switch (direction)
                    {
                    case ExplosionDirection.Up:
                        SpreadExplosion(groundTile.GetTopNeighbor(), direction, bombRange);
                        break;

                    case ExplosionDirection.Down:
                        SpreadExplosion(groundTile.GetBottomNeighbor(), direction, bombRange);
                        break;

                    case ExplosionDirection.Right:
                        SpreadExplosion(groundTile.GetRightNeighbor(), direction, bombRange);
                        break;

                    case ExplosionDirection.Left:
                        SpreadExplosion(groundTile.GetLeftNeighbor(), direction, bombRange);
                        break;
                    }
                }
                else
                {
                    //Explosion Tail
                }
            }
            StartCoroutine(DestroyGameObjectOnClients(gameObject, 1f));
        }
예제 #2
0
        public void Setup(bool isSource, ExplosionDirection direction, int bombRange, GroundTile groundTile)
        {
            CheckHitSomething();
            if (isSource)
            {
                onSourceExplosion.Invoke();
                bombRange--;
                SpreadExplosion(groundTile.GetBottomNeighbor(), ExplosionDirection.Down, bombRange);
                SpreadExplosion(groundTile.GetTopNeighbor(), ExplosionDirection.Up, bombRange);
                SpreadExplosion(groundTile.GetLeftNeighbor(), ExplosionDirection.Left, bombRange);
                SpreadExplosion(groundTile.GetRightNeighbor(), ExplosionDirection.Right, bombRange);
            }
            else
            {
                if (bombRange > 0)
                {
                    bombRange--;
                    switch (direction)
                    {
                    case ExplosionDirection.Up:
                        SpreadExplosion(groundTile.GetTopNeighbor(), direction, bombRange);
                        break;

                    case ExplosionDirection.Down:
                        SpreadExplosion(groundTile.GetBottomNeighbor(), direction, bombRange);
                        break;

                    case ExplosionDirection.Right:
                        SpreadExplosion(groundTile.GetRightNeighbor(), direction, bombRange);
                        break;

                    case ExplosionDirection.Left:
                        SpreadExplosion(groundTile.GetLeftNeighbor(), direction, bombRange);
                        break;
                    }
                }
                else
                {
                    //Explosion Tail
                }
            }
            Destroy(gameObject, 1f);
        }