예제 #1
0
        public static CannonSettings SettingsForType(CannonType t)
        {
            switch (t)
            {
            case CannonType.Normal:
                return(NormalCannon);

            case CannonType.Bronze:
                return(BronzeCannon);

            case CannonType.Silver:
                return(SilverCannon);

            case CannonType.Gold:
                return(GoldCannon);

            case CannonType.Elite:
                return(EliteCannon);

            case CannonType.Inferno:
                return(InfernoCannon);

            case CannonType.Frozen:
                return(FrozenCannon);
            }
            return(new CannonSettings());
        }
예제 #2
0
 public override void initialize()
 {
     Level = 3;
     Type = CannonType.DoubleCannonII;
     CannonName = "Double Cannon II";
     Range = 100;
     Frequency = 2;
     TimeBeforeShoot = 0;
     Cost = 60;
     Speed = 5;
     Damage = 2;
     target = null;
     gradeTree = new CannonType[4];
     gradeTree[0] = CannonType.DoubleCannonIII;
     gradeTree[1] = CannonType.Nothing;
     gradeTree[2] = CannonType.Nothing;
     gradeTree[3] = CannonType.Degrade;
     prefabs = new GameObject[4];
     prefabs[0] = Resources.Load("Prefabs/DoubleCannonIII") as GameObject;
     prefabs[1] = null;
     prefabs[2] = null;
     prefabs[3] = Resources.Load("Prefabs/DoubleCannon") as GameObject;
     CannonReloadTime = (float)1 / Frequency;
     RotationFactor = 20;
 }
예제 #3
0
 private void SetImgs(CannonType cannonType)
 {
     cannonBottomImg = Utilities.GetBottomOfCannon(cannonType);
     cannonTubeImg   = Utilities.GetTubeOfCannon(cannonType);
     //switch (cannonType)
     //{
     //    case CannonType.Normal:
     //        cannonExtImg = Utilities.NormCannonBottomImg;
     //        cannonTubeImg = Utilities.NormCannonTubeImg;
     //        break;
     //    case CannonType.Bronze:
     //        cannonExtImg = Utilities.BronzeCannonBottomImg;
     //        cannonTubeImg = Utilities.BronzeCannonTubeImg;
     //        break;
     //    case CannonType.Silver:
     //        cannonExtImg = Utilities.SilverCannonBottomImg;
     //        cannonTubeImg = Utilities.SilverCannonTubeImg;
     //        break;
     //    case CannonType.Gold:
     //        cannonExtImg = Utilities.GoldCannonBottomImg;
     //        cannonTubeImg = Utilities.GoldCannonTubeImg;
     //        break;
     //    case CannonType.Master:
     //        cannonExtImg = Utilities.MasterCannonBottomImg;
     //        cannonTubeImg = Utilities.MasterCannonTubeImg;
     //        break;
     //}
 }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        rend = GetComponent <SpriteRenderer>();
        rb   = GetComponent <Rigidbody2D>();

        health    = 100f;
        maxHealth = health;

        PlayerManagerScript.instance.playerHealth     = health;
        PlayerManagerScript.instance.playerMaxHealth  = maxHealth;
        PlayerManagerScript.instance.playerLives.text = "X : " + lives.ToString();
        PlayerManagerScript.instance.EMPCount.text    = "X : " + empCount.ToString();

        tankMode = true;
        cannonGO.SetActive(true);
        PlayerManagerScript.instance.ammoGO.SetActive(true);

        moveSpeed   /= moveSpeedLoss;
        torqueForce /= moveSpeedLoss / 2;


        for (int i = 0; i < ammoList.Length; i++)
        {
            ammoList[i] = 5;

            PlayerManagerScript.instance.ammoList[i].currAmmo       = ammoList[i];
            PlayerManagerScript.instance.ammoList[i].rendRing.color = Color.clear;
        }

        cannonType = CannonType.NORMAL;
        PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.yellow;
    }
예제 #5
0
 public override void initialize()
  {
      Level = 1;
      Type = CannonType.SimpleCannon;
      CannonName = "Simple Cannon";
      Range = 100;
      Frequency = 3;
      TimeBeforeShoot = 0;
      Cost = 30;
      Speed = 4;
      Damage = 1;
      target = null;
      gradeTreeSize = 3;
      gradeTree = new CannonType[4];
      gradeTree[0] = CannonType.HeavyCannon;
      gradeTree[1] = CannonType.QuickCannon;
      gradeTree[2] = CannonType.DoubleCannon;
      gradeTree[3] = CannonType.Sell;
      
      prefabs = new GameObject[4];
      prefabs[0] = Resources.Load("Prefabs/HeavyCannon") as GameObject;
      prefabs[1] = Resources.Load("Prefabs/QuickCannon") as GameObject;
      prefabs[2] = Resources.Load("Prefabs/DoubleCannon") as GameObject;
      prefabs[3] = null;
      parent = null;
      CannonReloadTime = (float)1 / Frequency;
      RotationFactor = 20;
  }
예제 #6
0
    public override void initialize()
    {
        Level = 4;

        Type = CannonType.FlameThrowerI;
        CannonName = "Flame Thrower I";
        Range = 75;
        Frequency = 12;
        TimeBeforeShoot = 0;
        Cost = 640;
        Speed = 3;
        Damage = 1;
        target = null;
        gradeTree = new CannonType[4];
        gradeTree[0] = CannonType.FlameThrowerII;
        gradeTree[1] = CannonType.Nothing;
        gradeTree[2] = CannonType.Nothing;
        gradeTree[3] = CannonType.Degrade;
        prefabs = new GameObject[4];
        prefabs[0] = Resources.Load("Prefabs/FlameThrowerII") as GameObject;
        prefabs[1] = null;
        prefabs[2] = null;
        prefabs[3] = Resources.Load("Prefabs/QuickCannonII") as GameObject;
        CannonReloadTime = (float)1 / Frequency;
        RotationFactor = 20;
        Pivot = this.transform.FindChild("PivotPoint");
        EmitRange = Pivot.transform.FindChild("Range");
        EmitRange.gameObject.SetActive(true);
    }
예제 #7
0
 public override void initialize()
 {
     Level = 5;
     Type = CannonType.SonicPulseII;
     CannonName = "Sonic Pulse II";
     Range = 120;
     Frequency = 4;
     TimeBeforeShoot = 0;
     Cost = 1662;
     Speed = 5;
     Damage = 5;
     target = null;
     gradeTree = new CannonType[4];
     gradeTree[0] = CannonType.Nothing;
     gradeTree[1] = CannonType.Nothing;
     gradeTree[2] = CannonType.Nothing;
     gradeTree[3] = CannonType.Degrade;
     prefabs = new GameObject[4];
     prefabs[0] = null;
     prefabs[1] = null;
     prefabs[2] = null;
     prefabs[3] = Resources.Load("Prefabs/SonicPulseI") as GameObject;
     CannonReloadTime = (float)1 / Frequency;
     RotationFactor = 50;
     Pivot = this.transform.FindChild("PivotPoint");
     EmitRange = Pivot.transform.FindChild("Range");
     EmitRange.gameObject.SetActive(true);
 }
예제 #8
0
 public override void initialize()
 {
     Level = 3;
     Type = CannonType.SniperCannonI;
     CannonName = "Sniper Cannon I";
     Range = 100;
     Frequency = 4;
     TimeBeforeShoot = 0;
     Cost = 80;
     Speed = 12;
     Damage = 1;
     target = null;
     gradeTree = new CannonType[4];
     gradeTree[0] = CannonType.SniperCannonII;
     gradeTree[1] = CannonType.LaserI;
     gradeTree[2] = CannonType.Nothing;
     gradeTree[3] = CannonType.QuickCannon;
     prefabs = new GameObject[4];
     prefabs[0] = Resources.Load("Prefabs/SniperCannonII") as GameObject;
     prefabs[1] = Resources.Load("Prefabs/LaserI") as GameObject;
     prefabs[2] = null;
     prefabs[3] = Resources.Load("Prefabs/QuickCannon") as GameObject;
     CannonReloadTime = (float)1 / Frequency;
     RotationFactor = 20;
 }
예제 #9
0
	// Use this for initialization
    public override void initialize()
    {
        Level = 5;
        Type = CannonType.MissileLauncherI;
        CannonName = "Missile Launcher II";
        Range = 180;
        Frequency = 0.5f;
        TimeBeforeShoot = 0;
        Cost = 772;
        Speed = 4;
        Damage = 36;
        target = null;
        gradeTreeSize = 3;
        gradeTree = new CannonType[4];
        gradeTree[0] = CannonType.Nothing;
        gradeTree[1] = CannonType.Nothing;
        gradeTree[2] = CannonType.Nothing;
        gradeTree[3] = CannonType.Degrade;

        prefabs = new GameObject[4];
        prefabs[0] = null;
        prefabs[1] = null;
        prefabs[2] = null;
        prefabs[3] = Resources.Load("Prefabs/MissileLauncher") as GameObject;

        CannonReloadTime = (float)1 / Frequency;
        RotationFactor = 20;
    }
예제 #10
0
    public override void initialize()
    {
        Level = 5;
        Type = CannonType.LaserII;
        CannonName = "Laser II";
        Range = 160;
        Frequency = 1.2f;
        TimeBeforeShoot = 0;
        Cost = 1297;
        Speed = 1;
        Damage = 30;
        target = null;
        gradeTree = new CannonType[4];
        gradeTree[0] = CannonType.Nothing;
        gradeTree[1] = CannonType.Nothing;
        gradeTree[2] = CannonType.Nothing;
        gradeTree[3] = CannonType.Degrade;
        prefabs = new GameObject[4];
        prefabs[0] = null;
        prefabs[1] = null;
        prefabs[2] = null;
        prefabs[3] = Resources.Load("Prefabs/LaserI") as GameObject;
        CannonReloadTime = (float)1 / Frequency;
        RotationFactor = 20;

        Line = this.transform.FindChild("PivotPoint").GetComponent<LineRenderer>() as LineRenderer;
        EndOfBeam = this.transform.FindChild("PivotPoint").transform.FindChild("EndOfBeam");
    }
예제 #11
0
 void MakeUpgrade(ref CannonInfo ci, int lv, CannonType next)
 {
     ci.upgrades.Add(new CannonInfo.Upgrade()
     {
         level = lv, next = next
     });
 }
예제 #12
0
 public override void initialize()
 {
     Level = 5;
     Type = CannonType.QuickCannonIV;
     CannonName = "Quick Cannon IV";
     Range = 120;
     Frequency = 6;
     TimeBeforeShoot = 0;
     Cost = 1123;
     Speed = 7;
     Damage = 9;
     target = null;
     gradeTree = new CannonType[4];
     gradeTree[0] = CannonType.Nothing;
     gradeTree[1] = CannonType.Nothing;
     gradeTree[2] = CannonType.Nothing;
     gradeTree[3] = CannonType.QuickCannonIII;
     prefabs = new GameObject[4];
     prefabs[0] = null;
     prefabs[1] = null;
     prefabs[2] = null;
     prefabs[3] = Resources.Load("Prefabs/QuickCannonIII") as GameObject;
     CannonReloadTime = (float)1 / Frequency;
     RotationFactor = 20;
 }
 public void CreateCannon(List <Vector2> positions, CannonType type)
 {
     foreach (var pos in positions)
     {
         var obstacle = Instantiate(cannon, obstacleRoot).GetComponent <Obstacle>();
         obstacle.transform.position = new Vector3(pos.x, pos.y, 0) * Globals.TILE_SIZE + new Vector3(0.5f, 0.5f, 0f);
         obstacle.GetPosition();
         obstacle.gameObject.GetComponent <Cannon>().SetType(type);
         ObstacleMap.AddObstacle(obstacle);
     }
 }
예제 #14
0
 public CannonSettings(int maxHealth, CannonType cannonType, int damage, int reloadSpeed, int moveSpeed,
                       int accuracy, StatusEffect effectAdded, bool freezes, int rapidFire, int power, int defense)
 {
     MaxHealth   = maxHealth;
     CannonType  = cannonType;
     Damage      = damage;
     ReloadSpeed = reloadSpeed;
     MoveSpeed   = moveSpeed;
     Accuracy    = accuracy;
     EffectAdded = effectAdded;
     Freezes     = freezes;
     RapidFire   = rapidFire;
     Power       = power;
     Defense     = defense;
 }
예제 #15
0
        public static void PlaceShipCannon(BaseBoat boat, Point3D point, CannonType cannonType, CannonPosition cannonPosition)
        {
            if (boat == null)
            {
                return;
            }

            ShipCannon shipCannon = new ShipCannon();

            shipCannon.Visible = false;

            shipCannon.m_Boat           = boat;
            shipCannon.m_CannonType     = cannonType;
            shipCannon.m_CannonPosition = cannonPosition;
            shipCannon.m_xOffset        = point.X;
            shipCannon.m_yOffset        = point.Y;
            shipCannon.m_zOffset        = point.Z;

            Point3D cannonLocation = boat.GetRotatedLocation(point.X, point.Y, 0);

            shipCannon.MoveToWorld(new Point3D(boat.Location.X + cannonLocation.X, boat.Location.Y + cannonLocation.Y, boat.Location.Z + cannonLocation.Z), boat.Map);
            shipCannon.BoatFacingChange(boat.Facing);
            shipCannon.Z = boat.Location.Z + cannonLocation.Z + shipCannon.GetAdjustedCannonZOffset();

            shipCannon.Hue = boat.CannonHue;

            if (boat.MobileControlType != MobileControlType.Player)
            {
                shipCannon.Ammunition = shipCannon.GetMaxAmmunition();
            }

            shipCannon.Visible = true;

            boat.m_Cannons.Add(shipCannon);

            switch (cannonPosition)
            {
            case CannonPosition.Left: boat.m_LeftCannons.Add(shipCannon); break;

            case CannonPosition.Right: boat.m_RightCannons.Add(shipCannon); break;

            case CannonPosition.Front: boat.m_FrontCannons.Add(shipCannon); break;

            case CannonPosition.Rear: boat.m_RearCannons.Add(shipCannon); break;
            }
        }
예제 #16
0
    public void SetType(CannonType type)
    {
        switch (type)
        {
        case CannonType.UP:
            direction = Vector2Int.up;
            break;

        case CannonType.DOWN:
            direction = Vector2Int.down;
            break;

        case CannonType.LEFT:
            direction = Vector2Int.left;
            break;

        case CannonType.RIGHT:
            direction = Vector2Int.right;
            break;
        }
        transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = cannonDirections[(int)type];
    }
예제 #17
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            //Version 0
            if (version >= 0)
            {
                m_Boat           = (BaseBoat)reader.ReadItem();
                m_CannonType     = (CannonType)reader.ReadInt();
                m_CannonPosition = (CannonPosition)reader.ReadInt();
                m_Ammunition     = reader.ReadInt();
                m_xOffset        = reader.ReadInt();
                m_yOffset        = reader.ReadInt();
                m_zOffset        = reader.ReadInt();
                Facing           = (Direction)reader.ReadInt();
            }

            //-----

            Movable = false;

            if (m_Boat != null)
            {
                m_Boat.m_Cannons.Add(this);

                switch (m_CannonPosition)
                {
                case CannonPosition.Left: m_Boat.m_LeftCannons.Add(this); break;

                case CannonPosition.Right: m_Boat.m_RightCannons.Add(this); break;

                case CannonPosition.Front: m_Boat.m_FrontCannons.Add(this); break;

                case CannonPosition.Rear: m_Boat.m_RearCannons.Add(this); break;
                }
            }
        }
예제 #18
0
    public static Vector3[] GetBulletCoordinates(CannonType cannonType)
    {
        Vector3[] result;
        switch (cannonType)
        {
        case CannonType.U:
            result    = new Vector3[1];
            result[0] = new Vector3(0, 1, 0);
            break;

        case CannonType.D:
            result    = new Vector3[1];
            result[0] = new Vector3(0, -1, 0);
            break;

        case CannonType.L:
            result    = new Vector3[1];
            result[0] = new Vector3(-1, 0, 0);
            break;

        case CannonType.R:
            result    = new Vector3[1];
            result[0] = new Vector3(1, 0, 0);
            break;

        case CannonType.UD:
            result    = new Vector3[2];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(0, -1, 0);
            break;

        case CannonType.UL:
            result    = new Vector3[2];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(-1, 0, 0);
            break;

        case CannonType.UR:
            result    = new Vector3[2];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(1, 0, 0);
            break;

        case CannonType.DL:
            result    = new Vector3[2];
            result[0] = new Vector3(0, -1, 0);
            result[1] = new Vector3(-1, 0, 0);
            break;

        case CannonType.DR:
            result    = new Vector3[2];
            result[0] = new Vector3(0, -1, 0);
            result[1] = new Vector3(1, 0, 0);
            break;

        case CannonType.LR:
            result    = new Vector3[2];
            result[0] = new Vector3(-1, 0, 0);
            result[1] = new Vector3(1, 0, 0);
            break;

        case CannonType.ULR:
            result    = new Vector3[3];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(-1, 0, 0);
            result[2] = new Vector3(1, 0, 0);
            break;

        case CannonType.UDR:
            result    = new Vector3[3];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(0, -1, 0);
            result[2] = new Vector3(1, 0, 0);
            break;

        case CannonType.UDL:
            result    = new Vector3[3];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(0, -1, 0);
            result[2] = new Vector3(-1, 0, 0);
            break;

        case CannonType.DLR:
            result    = new Vector3[3];
            result[0] = new Vector3(0, -1, 0);
            result[1] = new Vector3(-1, 0, 0);
            result[2] = new Vector3(1, 0, 0);
            break;

        case CannonType.UDLR:
            result    = new Vector3[4];
            result[0] = new Vector3(0, 1, 0);
            result[1] = new Vector3(0 - 1, 0);
            result[2] = new Vector3(-1, 0, 0);
            result[3] = new Vector3(1, 0, 0);
            break;

        default:
            result    = new Vector3[1];
            result[0] = new Vector3(0, 0, 0);
            break;
        }

        return(result);
    }
예제 #19
0
    // Update is called once per frame
    void Update()
    {
        if (PauseManagerScript.instance.isPaused)
        {
            return;
        }

        if (PlayerManagerScript.instance.gameWait)
        {
            return;
        }

        if (Input.GetAxis("Mouse ScrollWheel") != 0)
        {
            float d = Input.GetAxis("Mouse ScrollWheel");

            if (d < 0)
            {
                PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.clear;

                cannonType = (CannonType)((int)cannonType + 1);

                if ((int)cannonType > (int)CannonType.BOOMERANG)
                {
                    cannonType = CannonType.NORMAL;
                }

                PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.yellow;

                if (ammoList[(int)cannonType] <= 0)
                {
                    if (PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color != Color.gray)
                    {
                        PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.gray;
                    }
                }
            }
            else if (d > 0)
            {
                PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.clear;

                cannonType = (CannonType)((int)cannonType - 1);

                if ((int)cannonType < (int)CannonType.NORMAL)
                {
                    cannonType = CannonType.BOOMERANG;
                }

                PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.yellow;

                if (ammoList[(int)cannonType] <= 0)
                {
                    if (PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color != Color.gray)
                    {
                        PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.gray;
                    }
                }
            }
        }

//		if(Input.GetKeyDown(KeyCode.Alpha1))
//		{
//			PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.clear;
//
//			cannonType = (CannonType)((int)cannonType + 1);
//
//			if((int)cannonType > (int)CannonType.BOOMERANG)
//			{
//				cannonType = CannonType.NORMAL;
//			}
//
//			PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.yellow;
//
//			if(ammoList[(int)cannonType] <= 0)
//			{
//				if(PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color != Color.gray)
//				{
//					PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.gray;
//				}
//			}
//
//		}
//
//		if(Input.GetKeyDown(KeyCode.Alpha2))
//		{
//			PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.clear;
//
//			cannonType = (CannonType)((int)cannonType - 1);
//
//			if((int)cannonType < (int)CannonType.NORMAL)
//			{
//				cannonType = CannonType.BOOMERANG;
//			}
//
//			PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.yellow;
//
//			if(ammoList[(int)cannonType] <= 0)
//			{
//				if(PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color != Color.gray)
//				{
//					PlayerManagerScript.instance.ammoList[(int)cannonType].rendRing.color = Color.gray;
//				}
//			}
//		}

        if (Input.GetKeyDown(KeyCode.E))
        {
            FireEMP();
        }

        if (Input.GetMouseButtonDown(1))
        {
            cannonGO.SetActive(!cannonGO.activeSelf);

            PlayerManagerScript.instance.ammoGO.SetActive(!PlayerManagerScript.instance.ammoGO.activeSelf);

            tankMode = !tankMode;
            if (tankMode)
            {
                moveSpeed   /= moveSpeedLoss;
                torqueForce /= moveSpeedLoss / 2;
            }
            else
            {
                moveSpeed   *= moveSpeedLoss;
                torqueForce *= moveSpeedLoss / 2;
            }
        }

        if (tankMode)
        {
            CannonAimTowards();

            if (Input.GetMouseButtonDown(0))
            {
                if (cannonCooldown <= 0f)
                {
                    ShootCannon();
                    cannonCooldown = cannonFireRate;
                }
            }
        }

        if (Input.GetKey(KeyCode.Space))
        {
            if (mgCooldown <= 0)
            {
                ShootMG();;
                mgCooldown = mgFireRate;
            }
        }

        if (damageFlash)
        {
            flashTime -= Time.deltaTime;

            if (rend.color != Color.red)
            {
                rend.color = Color.red;
            }

            if (flashTime <= 0f)
            {
                rend.color  = Color.white;
                damageFlash = false;
            }
        }

        cannonCooldown -= 1f / cannonFireRate;
        mgCooldown     -= 1f / mgFireRate;

        camPosition   = transform.position;
        camPosition.z = -5f;

        Camera.main.transform.position = camPosition;
    }
예제 #20
0
 private void Start()
 {
     current = CannonType.Normal;
     pov     = cm.GetCinemachineComponent <CinemachinePOV>();
 }
예제 #21
0
    public static Direction[] GetBulletDirection(CannonType cannonType)
    {
        Direction[] result;
        switch (cannonType)
        {
        case CannonType.U:
            result    = new Direction[1];
            result[0] = Direction.U;
            break;

        case CannonType.D:
            result    = new Direction[1];
            result[0] = Direction.D;
            break;

        case CannonType.L:
            result    = new Direction[1];
            result[0] = Direction.L;
            break;

        case CannonType.R:
            result    = new Direction[1];
            result[0] = Direction.R;
            break;

        case CannonType.UD:
            result    = new Direction[2];
            result[0] = Direction.U;
            result[1] = Direction.D;
            break;

        case CannonType.UL:
            result    = new Direction[2];
            result[0] = Direction.U;
            result[1] = Direction.L;
            break;

        case CannonType.UR:
            result    = new Direction[2];
            result[0] = Direction.U;
            result[1] = Direction.R;
            break;

        case CannonType.DL:
            result    = new Direction[2];
            result[0] = Direction.D;
            result[1] = Direction.L;
            break;

        case CannonType.DR:
            result    = new Direction[2];
            result[0] = Direction.D;
            result[1] = Direction.R;
            break;

        case CannonType.LR:
            result    = new Direction[2];
            result[0] = Direction.L;
            result[1] = Direction.R;
            break;

        case CannonType.ULR:
            result    = new Direction[3];
            result[0] = Direction.U;
            result[1] = Direction.L;
            result[2] = Direction.R;
            break;

        case CannonType.UDR:
            result    = new Direction[3];
            result[0] = Direction.U;
            result[1] = Direction.D;
            result[2] = Direction.R;
            break;

        case CannonType.UDL:
            result    = new Direction[3];
            result[0] = Direction.U;
            result[1] = Direction.D;
            result[2] = Direction.L;
            break;

        case CannonType.DLR:
            result    = new Direction[3];
            result[0] = Direction.D;
            result[1] = Direction.L;
            result[2] = Direction.R;
            break;

        case CannonType.UDLR:
            result    = new Direction[4];
            result[0] = Direction.U;
            result[0] = Direction.D;
            result[2] = Direction.L;
            result[3] = Direction.R;
            break;

        default:
            result    = new Direction[1];
            result[0] = Direction.U;
            break;
        }

        return(result);
    }
//	void BulletHit(EnemyScript other)
//	{
//		if(bulletType == CannonType.NORMAL)
//		{
//
//		}
//	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if (!other.CompareTag("Player") && !other.CompareTag("EnemyBullet"))
        {
            Debug.Log("Cannon Hit");

            EnemyScript enemy = other.GetComponent <EnemyScript>();

            if (bulletType == CannonType.NORMAL)
            {
                if (enemy != null)
                {
                    enemy.TakeDamage(damage);
                }

                Destroy(gameObject);
            }
            else if (bulletType == CannonType.SNIPER)
            {
                if (enemy != null)
                {
                    enemy.TakeDamage(damage);
                }

                Destroy(gameObject);
            }
            else if (bulletType == CannonType.SHOTGUN)
            {
                if (enemy != null)
                {
                    enemy.TakeDamage(damage);
                }

                Destroy(gameObject);
            }
            else if (bulletType == CannonType.CLUSTERNADE)
            {
                bulletType = CannonType.NORMAL;

                for (int i = 0; i < 6; i++)
                {
                    Transform pos = transform;

                    pos.Rotate(0f, 0f, 360f / 6f * i);

                    GameObject newbullet = Instantiate(this.gameObject, transform.position, pos.rotation);

                    CannonBulletScript bulletscript = newbullet.GetComponent <CannonBulletScript>();
                    bulletscript.bulletType = CannonType.CLUSTERCHILD;
                    bulletscript.damage     = damage;
                }

                if (enemy != null)
                {
                    enemy.TakeDamage(damage);
                }

                Destroy(gameObject);
            }
            else if (bulletType == CannonType.BOOMERANG)
            {
                Debug.Log(other.name);

                coll.enabled = false;
                rend.enabled = false;

                GameObject newbullet = Instantiate(this.gameObject, transform.position, transform.rotation);

                CannonBulletScript bulletscript = newbullet.GetComponent <CannonBulletScript>();
                bulletscript.bulletType   = CannonType.BOOMERANGCHILD;
                bulletscript.coll.enabled = true;
                bulletscript.rend.enabled = true;
                bulletscript.bulletSpeed  = bulletSpeed * 0.005f;
                bulletscript.damage       = 20f;

                newbullet.transform.parent = this.transform;

                if (enemy != null)
                {
                    enemy.TakeDamage(damage);
                }

                Destroy(gameObject, 5f);
            }
            else if (bulletType == CannonType.BOOMERANGCHILD)
            {
                if (enemy != null)
                {
                    enemy.TakeDamage(damage);
                }
            }
            else if (bulletType == CannonType.CLUSTERCHILD)
            {
                bulletSpeed = 0f;

                Debug.Log(other.name);

                if (enemy != null)
                {
                    enemy.TakeDamage(damage);

                    GameObject         newpart    = Instantiate(boomParticle, this.transform.position, Quaternion.identity) as GameObject;
                    BoomParticleScript partscript = newpart.GetComponent <BoomParticleScript>();

                    if (partscript != null)
                    {
                        partscript.ExpandBoom(1f, 0f, damage, 1f);
                        Destroy(gameObject, 0.2f);
                    }


                    //StartCoroutine(ClusterBoom(1.2f, 10f, 12, 15, 0.2f));
                }
                else
                {
                    GameObject         newpart    = Instantiate(boomParticle, this.transform.position, Quaternion.identity) as GameObject;
                    BoomParticleScript partscript = newpart.GetComponent <BoomParticleScript>();

                    if (partscript != null)
                    {
                        partscript.ExpandBoom(0.5f, 0.5f, damage, 1f);
                        Destroy(gameObject, 0.5f);
                    }

                    //StartCoroutine(ClusterBoom(0.8f, 5f, 8, 10, 0.5f));
                }
            }


            //BulletHit();
        }
    }