Ejemplo n.º 1
0
        }         //end ResolveFight(GameObject player)

        public string ResolveAlly(GameObject player, string p_GUIresult)
        {
            //Create ally
            GameObject m_ally = Instantiate(PrefabReference.prefabCharacter,
                                            m_player.transform.position, new Quaternion()) as GameObject;

            // Remove the sprite renderer component. This makes the ally not shown on the map.
            Destroy(m_ally.GetComponent <SpriteRenderer>());

            //Generate script
            Character m_allyScript = m_ally.GetComponent <Character>();

            //Set max weight
            m_allyScript.MaxWeight = m_die.Roll(1, 20) * 6;

            //Player accepts ally
            if (p_GUIresult == "YES")
            {
                //Add to ally list
                Ally m_playerAllyScript = m_player.GetComponent <Ally>();
                m_playerAllyScript.AddAlly(m_ally);

                //Return accepted
                m_GUIResult = "Ally was added.";
                return("Ally Was Added.");
            }

            //Player declines ally
            else if (p_GUIresult == "NO")
            {
                //Destroy newAlly
                Destroy(m_ally);

                //Return decline
                m_GUIResult = "Ally was declined.";
                return("No ally was added.");
            }             //end else if

            //Otherwise wait for answer
            return("No choice was made.");
        }         //end ResolveAlly(GameObject player, string p_GUIresult)