void Awake()
    {
        Physics2D.IgnoreLayerCollision (LayerMask.NameToLayer (EnemyAWConst.ENEMY), LayerMask.NameToLayer (EnemyAWConst.ENEMY), true);

        // Random direction on start
        switch(Random.Range (0, 3)){
            case 0:
                top = true;
                lastDirection = BounceTarget.TOP;
                break;
            case 1:
                bottom = true;
                lastDirection = BounceTarget.BOTTOM;
                break;
            case 2:
                front = true;
                lastDirection = BounceTarget.FRONT;
                break;
        }
    }
        void Awake()
        {
            Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer(EnemyAWConst.ENEMY), LayerMask.NameToLayer(EnemyAWConst.ENEMY), true);

            // Random direction on start
            switch (Random.Range(0, 3))
            {
            case 0:
                top           = true;
                lastDirection = BounceTarget.TOP;
                break;

            case 1:
                bottom        = true;
                lastDirection = BounceTarget.BOTTOM;
                break;

            case 2:
                front         = true;
                lastDirection = BounceTarget.FRONT;
                break;
            }
        }
        private void nextMovement()
        {
            if (top)
            {
                if (facingRight)
                {
                    direction1 = Vector3.right * Speed;
                    direction2 = Vector3.down * Speed;
                }
                else
                {
                    direction1 = Vector3.left * Speed;
                    direction2 = Vector3.down * Speed;
                }

                lastDirection = BounceTarget.TOP;
                top           = false;
            }
            else

            if (bottom)
            {
                if (facingRight)
                {
                    direction1 = Vector3.right * Speed;
                    direction2 = Vector3.up * Speed;
                }
                else
                {
                    direction1 = Vector3.left * Speed;
                    direction2 = Vector3.up * Speed;
                }

                lastDirection = BounceTarget.BOTTOM;
                bottom        = false;
            }
            else

            if (front)
            {
                if (facingRight)
                {
                    if (lastDirection == BounceTarget.TOP)
                    {
                        direction1 = Vector3.left * Speed;
                        direction2 = Vector3.down * Speed;
                    }
                    else if (lastDirection == BounceTarget.BOTTOM)
                    {
                        direction1 = Vector3.left * Speed;
                        direction2 = Vector3.up * Speed;
                    }
                    else if (lastDirection == BounceTarget.FRONT)
                    {
                        if (lastPosition.y > transform.position.y)
                        {
                            direction1 = Vector3.left * Speed;
                            direction2 = Vector3.down * Speed;
                        }
                        else
                        {
                            direction1 = Vector3.left * Speed;
                            direction2 = Vector3.up * Speed;
                        }
                    }
                }
                else
                {
                    if (lastDirection == BounceTarget.TOP)
                    {
                        direction1 = Vector3.right * Speed;
                        direction2 = Vector3.down * Speed;
                    }
                    else if (lastDirection == BounceTarget.BOTTOM)
                    {
                        direction1 = Vector3.right * Speed;
                        direction2 = Vector3.up * Speed;
                    }
                    else if (lastDirection == BounceTarget.FRONT)
                    {
                        if (lastPosition.y > transform.position.y)
                        {
                            direction1 = Vector3.right * Speed;
                            direction2 = Vector3.down * Speed;
                        }
                        else
                        {
                            direction1 = Vector3.right * Speed;
                            direction2 = Vector3.up * Speed;
                        }
                    }
                }

                lastDirection = BounceTarget.FRONT;
                front         = false;
            }
        }
    private void nextMovement()
    {
        if(top){
            if(facingRight){
                direction1 = Vector3.right * Speed;
                direction2 = Vector3.down * Speed;
            } else {
                direction1 = Vector3.left * Speed;
                direction2 = Vector3.down * Speed;
            }

            lastDirection = BounceTarget.TOP;
            top = false;
        } else

        if (bottom) {

            if(facingRight){
                direction1 = Vector3.right * Speed;
                direction2 = Vector3.up * Speed;
            } else {
                direction1 = Vector3.left * Speed;
                direction2 = Vector3.up * Speed;
            }

            lastDirection = BounceTarget.BOTTOM;
            bottom = false;

        } else

        if (front) {

            if(facingRight){

                if(lastDirection == BounceTarget.TOP){
                    direction1 = Vector3.left * Speed;
                    direction2 = Vector3.down * Speed;
                } else if(lastDirection == BounceTarget.BOTTOM){
                    direction1 = Vector3.left * Speed;
                    direction2 = Vector3.up * Speed;
                } else if(lastDirection == BounceTarget.FRONT){

                    if(lastPosition.y > transform.position.y){
                        direction1 = Vector3.left * Speed;
                        direction2 = Vector3.down * Speed;

                    } else {
                        direction1 = Vector3.left * Speed;
                        direction2 = Vector3.up * Speed;
                    }
                }

            } else {

                if(lastDirection == BounceTarget.TOP){
                    direction1 = Vector3.right * Speed;
                    direction2 = Vector3.down * Speed;
                } else if(lastDirection == BounceTarget.BOTTOM){
                    direction1 = Vector3.right * Speed;
                    direction2 = Vector3.up * Speed;
                } else if(lastDirection == BounceTarget.FRONT){

                    if(lastPosition.y > transform.position.y){
                        direction1 = Vector3.right * Speed;
                        direction2 = Vector3.down * Speed;
                    } else {
                        direction1 = Vector3.right * Speed;
                        direction2 = Vector3.up * Speed;
                    }
                }
            }

            lastDirection = BounceTarget.FRONT;
            front = false;
        }
    }