Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (soundEffects == null)
        {
            soundEffects = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <SoundEffectsManager>();
        }
#if UNITY_STANDALONE
        m_InGamePauseCanvas = GameObject.FindGameObjectWithTag(m_canvasTagname);
#endif
#if UNITY_ANDROID
        // Since there will only be 1 joystick!
        thePlayerJoystick = FindObjectOfType <PlayerDrag>();
#endif
        arrowTransform = GetComponent <RectTransform>();
        GameObject[] allTheInGamePauseButtons = GameObject.FindGameObjectsWithTag(m_buttonTags);
        foreach (GameObject zeGO in allTheInGamePauseButtons)
        {
            //Debug.Log("Pause button name: " + zeGO.name);
            PauseButtonScript zePause = zeGO.GetComponent <PauseButtonScript>();
            if (zePause != null)
            {
                allThePauseButtons.Add(zePause.m_Number, zePause);
            }
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
#if UNITY_STANDALONE
        // For keypress so that the select border can go left and right
        //  Will also need to make sure that the slot this select is at is more than 0
        if (Input.GetKeyDown(KeyBindScript.leftKey) && m_slotAt > 0)
        {
            --m_slotAt;
            UpdateTheUI();
        }
        else if (Input.GetKeyDown(KeyBindScript.rightKey) && m_slotAt + 1 < toKnowTheSlots.allTheSlots.Count)
        {
            ++m_slotAt;
            UpdateTheUI();
        }
#else
        // Based on the android joystick drag, we shall determine where is it moving
        if (thePlayerDrag == null)
        {
            thePlayerDrag = FindObjectOfType <PlayerDrag>();
        }
        if (thePlayerDrag.movingInXDirection == 1)
        {
            ++m_slotAt;
            UpdateTheUI();
        }
        else if (thePlayerDrag.movingInXDirection == -1)
        {
            --m_slotAt;
            UpdateTheUI();
        }
#endif
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        theHeroMeleeSystem = GetComponent <MeleeScript>();
        #if UNITY_STANDALONE
        theHeroRangeSystem = GetComponent <HeroRangeScript>();
        //theAttackButton = GameObject.Find("AttackButton");
        //theAttackButton.SetActive(false);
        //ItemUI = GameObject.Find(m_ItemUI_Name);
        //Debug.Log("Item Canvas name: " + ItemUI.name);
        //ItemUI.gameObject.SetActive(false);
#else
        thePlayerJoystick = GameObject.FindObjectOfType <PlayerDrag>();
        //theAttackButton = GameObject.Find("AttackButton");
#endif
    }
Ejemplo n.º 4
0
    //// Use this for initialization
    //void Start () {

    //}

    public void pressedTheButtonScript()
    {
        // We shall cheat here becuz aint no time for SP!
        // So everytime we press a button, see whether Player GameoObject has exists!
        if (GameObject.FindGameObjectWithTag("Player") == null)
        {
            return;
        }

        if (thePlayerDrag == null)
        {
            thePlayerDrag = FindObjectOfType <PlayerDrag>();
        }
        switch (isOpeningInventory)
        {
        case true:
            if (LocalDataSingleton.instance.talking)
            {
                LocalDataSingleton.instance.Inventorycanvas.SetActive(!LocalDataSingleton.instance.Inventorycanvas.activeSelf);
                LocalDataSingleton.instance.talking = LocalDataSingleton.instance.Inventorycanvas.activeSelf;
                GameObject.FindGameObjectWithTag("Player").GetComponent <HeroesMovement>().stopMovement();
                isOpeningInventory = false;
                thePlayerDrag.playerHasPressedButton();
            }
            break;

        default:
            if (!LocalDataSingleton.instance.talking)
            {
                LocalDataSingleton.instance.Inventorycanvas.SetActive(!LocalDataSingleton.instance.Inventorycanvas.activeSelf);
                LocalDataSingleton.instance.talking = LocalDataSingleton.instance.Inventorycanvas.activeSelf;
                GameObject.FindGameObjectWithTag("Player").GetComponent <HeroesMovement>().stopMovement();
                thePlayerDrag.playerHasPressedButton();
                isOpeningInventory = true;
            }
            break;
        }
        //LocalDataSingleton.instance.talking = !LocalDataSingleton.instance.talking;
        //if (itemUI == null)
        //{
        //    itemUI = GameObject.Find(m_inventoryName);
        //}
        //itemUI.SetActive(LocalDataSingleton.instance.talking);
        //thePlayerDrag.playerHasPressedButton();
    }
Ejemplo n.º 5
0
 public void pressedShoot()
 {
     //Debug.Log("Trying to shoot");
     if (!LocalDataSingleton.instance.talking)
     {
         if (heroRangeAttack == null)
         {
             //Debug.Log("Finding GameObject 1st");
             heroRangeAttack = GameObject.FindObjectOfType <HeroRangeScript>();
         }
         if (thePlayerJoystick == null)
         {
             thePlayerJoystick = GameObject.FindObjectOfType <PlayerDrag>();
         }
         thePlayerJoystick.playerHasPressedButton();
         heroRangeAttack.shootArrow();
     }
 }
Ejemplo n.º 6
0
 public void doAttack()
 {
     if (thePlayerJoystick == null)
     {
         thePlayerJoystick = GameObject.FindObjectOfType <PlayerDrag>();
     }
     if (!LocalDataSingleton.instance.talking)
     {
         //thePlayerJoystick.fingerHasPressedIt = false;
         thePlayerJoystick.playerHasPressedButton();
         theHeroMeleeSystem.meleeAttack();
     }
     //else if (LocalDataSingleton.instance.InGamePauseCanvas.activeSelf)
     //{
     //    // If the in game pause is active and player hit the attack button, then use that button!
     //    LocalDataSingleton.instance.InGamePauseCanvas.GetComponentInChildren<InGamePauseScript>().selectedTheButton();
     //}
     GameObject.FindGameObjectWithTag("GameController").GetComponent <PlayerController>().TryInteract();
     MessageSystem.instance.triggerEventCall("PressedAndroidMeleeButton");
 }
Ejemplo n.º 7
0
    //Show-hide stuff will happen here
    void Update()
    {
        //Lets just store the Node Data variable for the sake of fewer words
        var data = dialogue.nodeData;

        //We'll be disabling the entire UI if there aren't any loaded conversations
        if (!dialogue.isLoaded)
        {
            uiContainer.SetActive(false);
        }
        else
        {
            uiContainer.SetActive(true);
            //Player-NPC conversation text will be visible depending on whose turn it is
            playerText.transform.parent.gameObject.SetActive(data.currentIsPlayer);
            npcText.transform.parent.gameObject.SetActive(!data.currentIsPlayer);

            //Color the Player options. Blue for the selected one
            for (int i = 0; i < currentOptions.Count; i++)
            {
                currentOptions[i].color = Color.black;
                if (i == data.selectedOption)
                {
                    currentOptions[i].color = Color.white;
                }
            }

            //Scroll through Player dialogue options
            if (!data.pausedAction)
            {
#if UNITY_STANDALONE
                if (Input.GetKeyDown(KeyBindScript.downKey))
                {
                    if (data.selectedOption < currentOptions.Count - 1)
                    {
                        data.selectedOption++;
                    }
                }
                if (Input.GetKeyDown(KeyBindScript.upKey))
                {
                    if (data.selectedOption > 0)
                    {
                        data.selectedOption--;
                    }
                }
#else
                PlayerDrag touch = LocalDataSingleton.instance.GetComponentInChildren <PlayerDrag>();
                if (touch.movingInYDirection == -1)
                {
                    if (data.selectedOption < currentOptions.Count - 1)
                    {
                        data.selectedOption++;
                    }
                }
                if (touch.movingInYDirection == 1)
                {
                    if (data.selectedOption > 0)
                    {
                        data.selectedOption--;
                    }
                }
#endif
            }
        }
    }
Ejemplo n.º 8
0
 void Start()
 {
     thePlayerJoystick = GameObject.FindObjectOfType <PlayerDrag>();
 }