예제 #1
0
    public void ShootBubble(Vector2 direction)
    {
        Vector2 shootDirection = GetTouchDistanceFromGivenObject(direction, transform.position);

        shootDirection *= StandardCoefficient(shootDirection);

        if (shootingSuperBubble)
        {
            //Debug.Log("shoot super power");
            superBubble.Move(shootDirection, finalPosition);
            shootingSuperBubble = false;
            selectedMoveableObj.DestroyMoveableObj();
            unSelectedMoveableObj.DestroyMoveableObj();
            StartCoroutine(SetMoveableObj(1));
            StartCoroutine(SetMoveableObj(2));
            superBubble = null;
        }
        else
        {
            selectedMoveableObj.Move(shootDirection, finalPosition);
            // swap
            selectedMoveableObj = unSelectedMoveableObj;
            selectedMoveableObj.ChangePosition(selectedMoveableObjPos, transform.position, false);
            StartCoroutine(SetMoveableObj(2));
        }
    }
예제 #2
0
    private void SetAndInstantietMoveableObj(ISpawnable spawnable, int ID)
    {
        switch (ID)
        {
        case 1: selectedMoveableObj = spawnable.SpawnAtPoint(selectedMoveableObjPos);
            break;

        case 2: unSelectedMoveableObj = spawnable.SpawnAtPoint(unSelectedMoveableObjPos);
            break;
        }
    }
예제 #3
0
 public void UnSelecctSuperBubble()
 {
     if (this.superBubble != null)
     {
         this.superBubble.Hide(true);
     }
     selectedMoveableObj.Hide(false);
     unSelectedMoveableObj.Hide(false);
     shootingSuperBubble = false;
     superBubble.DestroyMoveableObj();
     superBubble = null;
 }
예제 #4
0
    public void SwapBubble()
    {
        selectedMoveableObj.ChangePosition(unSelectedMoveableObjPos, transform.position, true);
        unSelectedMoveableObj.ChangePosition(selectedMoveableObjPos, transform.position, false);

        IMoveableAndHideable temp = null;

        temp = selectedMoveableObj;
        selectedMoveableObj   = unSelectedMoveableObj;
        unSelectedMoveableObj = temp;
        lastSelectedTag       = unSelectedMoveableObj.GetTag();
    }
예제 #5
0
 public void SelectSuperBubble(ISpawnable superBubble)
 {
     if (shootingSuperBubble == false)
     {
         if (this.superBubble != null)
         {
             this.superBubble.Hide(false);
         }
         // Debug.Log("called");
         selectedMoveableObj.Hide(true);
         unSelectedMoveableObj.Hide(true);
         shootingSuperBubble = true;
         this.superBubble    = superBubble.SpawnAtPoint(selectedMoveableObjPos);
     }
 }