Ejemplo n.º 1
0
    void OnMouseDown()
    {
        //this tappedRedArrowCounter is for the tutorial
        tapRedArrowCounter++;
        activeMainPlayerOBJ    = GameObject.FindGameObjectWithTag("ActiveMain");
        activeMainPlayerScript = activeMainPlayerOBJ.GetComponent <MainChar>();
        QueueScript1 qScript = activeMainPlayerOBJ.GetComponentInChildren <QueueScript1>();

        if (qScript.myItemObjects.Count > 0)
        {
            activeMainPlayerScript.setMainTarget(activeMainPlayerScript.getTargetUnderConsideration());
            activeMainPlayerScript.getTargetUnderConsideration().setAssailant(activeMainPlayerScript);
            activeMainPlayerScript.setAttacking(true);
            activeMainPlayerScript.myArrow.SetActive(false);
            //uncomment the code below to hide all character queues when character first starts moving

            /*activeMainPlayerScript.myQueueOBJ.SetActive(false);
             * foreach(Character chr in levelManScript.charsInLevel){
             *      chr.myQueueOBJ.SetActive(false);
             * }*/
            levelManScript.setGameState(GAME_STATE.CHAIN_REACTION);
            levelManScript.enableAllInventoryColliders(false);

            //
        }
    }
Ejemplo n.º 2
0
    void OnMouseDown()
    {
        QueueScript1 myQueueScript = GetComponentInParent <QueueScript1>();

        screenPoint       = Camera.main.WorldToScreenPoint(gameObject.transform.position);
        offset            = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
        positionICameFrom = myQueueScript.myItemObjects.IndexOf((Item_Set)this.GetComponent <Item_Set>());
    }
Ejemplo n.º 3
0
	public virtual void Start(){
		myStartPosition = new Vector2(this.transform.position.x, this.transform.position.y);
		anim = GetComponent<Animator>();
		levelManagerOBJ = GameObject.Find("LevelManager_OBJ");
		levelManScript = levelManagerOBJ.GetComponent <LevelManager>();
		myQueue_Script = myQueueOBJ.GetComponent<QueueScript1>();
		potentialLiability = true;
	}
Ejemplo n.º 4
0
 public virtual void Start()
 {
     myStartPosition    = new Vector2(this.transform.position.x, this.transform.position.y);
     anim               = GetComponent <Animator>();
     levelManagerOBJ    = GameObject.Find("LevelManager_OBJ");
     levelManScript     = levelManagerOBJ.GetComponent <LevelManager>();
     myQueue_Script     = myQueueOBJ.GetComponent <QueueScript1>();
     potentialLiability = true;
 }
Ejemplo n.º 5
0
 void OnMouseUp()
 {
     iAmBeingMoved = false;
     if (touchingWhereIWantToBe)
     {
         transform.position = itemGoesToThisSpot;
         //for Tutorial
         tapOnSyringeCounter++;
     }
     else
     {
         QueueScript1 myQueueScript = GetComponentInParent <QueueScript1>();
         myQueueScript.myItemObjects.Insert(positionICameFrom, this.GetComponent <Item_Set>());
         myQueueScript.displayNewQueueVisualFromOwnerQueueList();
         transform.position = (Vector2)startPosition;
     }
 }
Ejemplo n.º 6
0
 public void previewNewQueue(Collider2D coll)
 {
     if (coll.gameObject.name == "Orange_Spot1")
     {
         Debug.Log("TOUCHING ORANGE SPOT 1");
         QueueScript1 orangeQueueScript = coll.GetComponentInParent <QueueScript1>();
         orangeQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
         orangeQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
         itemGoesToThisSpot     = (Vector2)coll.transform.position;
     }
     else if (coll.gameObject.name == "Orange_Spot2")
     {
         Debug.Log("TOUCHING ORANGE SPOT 2");
         QueueScript1 orangeQueueScript = coll.GetComponentInParent <QueueScript1>();
         if (orangeQueueScript.myItemObjects.Count > 0)
         {
             Debug.Log("GOING INTO ORANGE SPT 2");
             orangeQueueScript.myItemObjects.Insert(1, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)coll.transform.position;
         }
         else if (orangeQueueScript.myItemObjects.Count == 0)
         {
             orangeQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)orangeQueueScript.myQSpots[0].transform.position;
         }
         orangeQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
     }
     else if (coll.gameObject.name == "Orange_Spot3")
     {
         Debug.Log("TOUCHING ORANGE SPOT 3");
         QueueScript1 orangeQueueScript = coll.GetComponentInParent <QueueScript1>();
         if (orangeQueueScript.myItemObjects.Count >= 2)
         {
             orangeQueueScript.myItemObjects.Insert(2, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)coll.transform.position;
         }
         else if (orangeQueueScript.myItemObjects.Count == 1)
         {
             orangeQueueScript.myItemObjects.Insert(1, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)orangeQueueScript.myQSpots[1].transform.position;
         }
         else
         {
             orangeQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)orangeQueueScript.myQSpots[0].transform.position;
         }
         orangeQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
     }
     else if (coll.gameObject.name == "Blue_Spot1")
     {
         Debug.Log("TOUCHING Blue SPOT 1");
         QueueScript1 blueQueueScript = coll.GetComponentInParent <QueueScript1>();
         blueQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
         blueQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
         itemGoesToThisSpot     = (Vector2)coll.transform.position;
     }
     else if (coll.gameObject.name == "Blue_Spot2")
     {
         Debug.Log("TOUCHING Blue SPOT 2");
         QueueScript1 blueQueueScript = coll.GetComponentInParent <QueueScript1>();
         if (blueQueueScript.myItemObjects.Count > 0)
         {
             Debug.Log("GOING INTO BLUE SPT 2");
             blueQueueScript.myItemObjects.Insert(1, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)coll.transform.position;
         }
         else
         {
             blueQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)blueQueueScript.myQSpots[0].transform.position;
         }
         blueQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
     }
     else if (coll.gameObject.name == "Blue_Spot3")
     {
         Debug.Log("TOUCHING Blue SPOT 3");
         QueueScript1 blueQueueScript = coll.GetComponentInParent <QueueScript1>();
         if (blueQueueScript.myItemObjects.Count >= 2)
         {
             blueQueueScript.myItemObjects.Insert(2, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)coll.transform.position;
         }
         else if (blueQueueScript.myItemObjects.Count == 1)
         {
             blueQueueScript.myItemObjects.Insert(1, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)blueQueueScript.myQSpots[1].transform.position;
         }
         else
         {
             blueQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)blueQueueScript.myQSpots[0].transform.position;
         }
         blueQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
     }
     else if (coll.gameObject.name == "Green_Spot1")
     {
         Debug.Log("TOUCHING green SPOT 1");
         QueueScript1 greenQueueScript = coll.GetComponentInParent <QueueScript1>();
         greenQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
         greenQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
         itemGoesToThisSpot     = (Vector2)coll.transform.position;
     }
     else if (coll.gameObject.name == "Green_Spot2")
     {
         Debug.Log("TOUCHING green SPOT 2");
         QueueScript1 greenQueueScript = coll.GetComponentInParent <QueueScript1>();
         itemGoesToThisSpot = (Vector2)startPosition;
         if (greenQueueScript.myItemObjects.Count > 0)
         {
             Debug.Log("GOING INTO GREEN SPT 2");
             greenQueueScript.myItemObjects.Insert(1, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)coll.transform.position;
         }
         else
         {
             greenQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)greenQueueScript.myQSpots[0].transform.position;
         }
         greenQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
     }
     else if (coll.gameObject.name == "Green_Spot3")
     {
         Debug.Log("TOUCHING green SPOT 3");
         QueueScript1 greenQueueScript = coll.GetComponentInParent <QueueScript1>();
         itemGoesToThisSpot = (Vector2)startPosition;
         if (greenQueueScript.myItemObjects.Count >= 2)
         {
             greenQueueScript.myItemObjects.Insert(2, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)coll.transform.position;
         }
         else if (greenQueueScript.myItemObjects.Count == 1)
         {
             greenQueueScript.myItemObjects.Insert(1, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)greenQueueScript.myQSpots[1].transform.position;
         }
         else
         {
             greenQueueScript.myItemObjects.Insert(0, this.GetComponent <Item_Set>());
             itemGoesToThisSpot = (Vector2)greenQueueScript.myQSpots[0].transform.position;
         }
         greenQueueScript.displayNewQueueVisualFromOwnerQueueList();
         touchingWhereIWantToBe = true;
     }
 }
Ejemplo n.º 7
0
    public void removePreview(Collider2D coll)
    {
        itemGoesToThisSpot = (Vector2)startPosition;

        if (coll.gameObject.name == "Orange_Spot1")
        {
            Debug.Log("Removing from ORANGE SPOT 1");
            QueueScript1 orangeQueueScript = coll.GetComponentInParent <QueueScript1>();
            orangeQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            orangeQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Orange_Spot2")
        {
            Debug.Log("Removing from ORANGE SPOT 2!!!!");
            QueueScript1 orangeQueueScript = coll.GetComponentInParent <QueueScript1>();
            orangeQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            orangeQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Orange_Spot3")
        {
            Debug.Log("Removing from ORANGE SPOT 3");
            QueueScript1 orangeQueueScript = coll.GetComponentInParent <QueueScript1>();
            orangeQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            orangeQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Blue_Spot1")
        {
            Debug.Log("removing from Blue SPOT 1");
            QueueScript1 blueQueueScript = coll.GetComponentInParent <QueueScript1>();
            blueQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            blueQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Blue_Spot2")
        {
            Debug.Log("Removing from Blue SPOT 2");
            QueueScript1 blueQueueScript = coll.GetComponentInParent <QueueScript1>();
            blueQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            blueQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Blue_Spot3")
        {
            Debug.Log("Removing From Blue SPOT 3");
            QueueScript1 blueQueueScript = coll.GetComponentInParent <QueueScript1>();
            blueQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            blueQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Green_Spot1")
        {
            Debug.Log("Removing from green SPOT 1");
            QueueScript1 greenQueueScript = coll.GetComponentInParent <QueueScript1>();
            greenQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            greenQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Green_Spot2")
        {
            Debug.Log("Removing from green SPOT 2");
            QueueScript1 greenQueueScript = coll.GetComponentInParent <QueueScript1>();
            greenQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            greenQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
        else if (coll.gameObject.name == "Green_Spot3")
        {
            Debug.Log("Removing from green SPOT 3");
            QueueScript1 greenQueueScript = coll.GetComponentInParent <QueueScript1>();
            greenQueueScript.myItemObjects.Remove((Item_Set)this.GetComponent <Item_Set>());
            greenQueueScript.displayNewQueueVisualFromOwnerQueueList();
            itemGoesToThisSpot     = (Vector2)startPosition;
            touchingWhereIWantToBe = false;
        }
    }