コード例 #1
0
    public void Connect()
    {
        NetworkManager.instance.ip = ipInput.text;
        int result;

        if (!int.TryParse(portInput.text, out result))
        {
            mainMessageBox.AddMessage(portInput.text + " is not a valid port.", Color.red);
            return;
        }
        NetworkManager.instance.port = result;
        NetworkManager.instance.Connect();
    }
コード例 #2
0
    protected override void ConsumeItem()
    {
        if (!GameManager.instance.CanFireEvent(true))
        {
            return;
        }

        if (EntityManager.instance.PlayerInventory.CheckCanRecieveItem(91, 1))
        {
            List <Inventory.ItemStack> drops = new List <Inventory.ItemStack> ();
            bool wasFactionRoll = false;

            if (DropTableManager.instance.PartyHatDropTable.RollTable(out drops, out wasFactionRoll))
            {
                EntityManager.instance.PlayerInventory.AddMultipleItems(drops);
                if (wasFactionRoll)
                {
                    MessageBox.AddMessage("Your Faction Specialisation helps you find an item", MessageBox.Type.Warning);
                }
                MessageBox.AddMessage("You pulled the cracker and find a party hat inside!");
            }
            else
            {
                MessageBox.AddMessage("You pulled the cracker, but it's empty inside..");
            }

            EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1);
        }
        else
        {
            MessageBox.AddMessage("I need more inventory space to do this");
        }
    }
コード例 #3
0
    void Start()
    {
        markov     = FindObjectOfType <MarkovChatbot>();
        messageBox = FindObjectOfType <MessageBox>();

        // generate name
        {
            var prefixes = NamePrefixes.text.Split('\n');
            var suffixes = NameSuffixes.text.Split('\n');
            Name = prefixes.Random() + suffixes.Random();
        }
        // generate country
        {
            var prefixes = CountryPrefixes.text.Split('\n');
            var suffixes = CountrySuffixes.text.Split('\n');
            Country = prefixes.Random() + suffixes.Random();
        }


        var message = Instantiate(MessagePrefab);

        message.GetComponent <Message>().Name = Name;
        message.GetComponent <Message>().Text = "hello i am " + Name + " from " + Country + " whats your name";
        messageBox.AddMessage(message.transform);
        AudioSource.PlayClipAtPoint(SubmitSound, Vector3.zero);
    }
コード例 #4
0
 void Update()
 {
     // process inputs
     {
         var text = input.text;
         var str  = Input.inputString;
         var ch   = str.Length > 0 ? str[0] : 0;
         if (Input.GetKeyDown(KeyCode.Backspace) || Input.GetKeyDown(KeyCode.Delete))
         {
             if (text.Length > 0)
             {
                 text = text.Substring(0, text.Length - 1);
                 AudioSource.PlayClipAtPoint(TypeSound, Vector3.zero);
             }
         }
         else if (Input.GetKeyDown(KeyCode.Return))
         {
             var message = Instantiate(MessagePrefab);
             message.GetComponent <Message>().Text = text;
             messageBox.AddMessage(message.transform);
             text = "";
             AudioSource.PlayClipAtPoint(SubmitSound, Vector3.zero);
             them.AskForResponse(); // this line feels really creepy for some reason
         }
         else if (32 <= ch && ch <= 126 && text.Length < MaxInputLength)
         {
             text += str;
             AudioSource.PlayClipAtPoint(TypeSound, Vector3.zero);
         }
         input.text = text;
     }
 }
コード例 #5
0
    protected override void ConsumeItem()
    {
        if (!GameManager.instance.CanFireEvent(true))
        {
            return;
        }

        float overallHealAmount = EntityManager.instance.PlayerCharacter.Health.MaxHealth * 0.4f;
        float modified          = overallHealAmount + (overallHealAmount * TalentManager.instance.GetTalentModifier(TalentType.BigGulp));

        EntityManager.instance.PlayerCharacter.Health.HealOverTime(modified, 1, 30);
        MessageBox.AddMessage(string.Format("The effects of the {0} wears off", Name), MessageBox.Type.Warning, 30);

        MessageBox.AddMessage(string.Format("You eat the {0}. It's begins to heal you over time.", Name));
        SoundEffectManager.Play(EntityManager.instance.eatSoundEffects.GetRandom(), AudioMixerGroup.SFX);

        if (UnityEngine.Random.value < TalentManager.instance.GetTalentModifier(TalentType.Resourceful))
        {
            MessageBox.AddMessage("Your " + TalentManager.instance.GetTalent(TalentType.Resourceful).talentData.talentName + " talent saves the Nitro Bits from being consumed.");
        }
        else
        {
            EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1);
        }
    }
コード例 #6
0
    protected override void ConsumeItem()
    {
        if (!GameManager.instance.CanFireEvent(false))
        {
            return;
        }

        List <Skill> skills = SkillManager.instance.Skills;

        TeleportCanvas.instance.SetButtons("Choose Skill", skills.Select(x => x.skillName).ToList(),
                                           (index) =>
        {
            if (!GameManager.instance.CanFireEvent(true))
            {
                return;
            }
            Skill skill    = skills[index];
            float xpToGive = skill.GetNextLevelRelativeXPRequirement() * 0.5f;
            SkillManager.instance.AddXpToSkill(skill.skillType, xpToGive);
            MessageBox.AddMessage("You smash the gem into the ground and it provides " + xpToGive.ToString("0.#") + " xp in " + skill.skillName);
            EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1);
            SoundEffectManager.Play(AudioClipAsset.UseGem, AudioMixerGroup.SFX);
        }
                                           );

        TeleportCanvas.instance.Open();
    }
コード例 #7
0
    public void ActuallyRespond()
    {
        var message = Instantiate(MessagePrefab);

        message.GetComponent <Message>().Name = Name;
        message.GetComponent <Message>().Text = markov.GetMessageOfLength(Mathf.CeilToInt(Mathf.Lerp(MaxMessageLength * 0.33f, MaxMessageLength, Random.value)));
        messageBox.AddMessage(message.transform);
        AudioSource.PlayClipAtPoint(SubmitSound, Vector3.zero);
    }
コード例 #8
0
 public override void DoAction()
 {
     if (EntityManager.instance.PlayerInventory.CheckCanRecieveItem(itemID, itemAmount))
     {
         EntityManager.instance.PlayerInventory.AddItem(itemID, itemAmount);
     }
     else
     {
         EntityManager.instance.PlayerBankInventory.AddItem(itemID, itemAmount);
         MessageBox.AddMessage("Some items were sent to your bank.", MessageBox.Type.Warning);
     }
 }
コード例 #9
0
    protected override void ConsumeItem()
    {
        if (!GameManager.instance.CanFireEvent(true))
        {
            return;
        }

        UnityEngine.GameObject.FindObjectOfType <HoverboardCanvas> ().SetActive();
        MessageBox.AddMessage("You activate the hoverboard. It can be summoned by using the button above the hotbar.", MessageBox.Type.Warning);
        SoundEffectManager.Play(AudioClipAsset.UseGem, AudioMixerGroup.SFX);

        EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1);
    }
コード例 #10
0
    private IEnumerator waitForSuitPurchase(WWW www, int suitToBuy)
    {
        yield return(www);

        if (www.error == null)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(www.text);
            XmlNode node = xmlDoc.FirstChild;
            if (node == null)
            {
                Debug.Log("Purchase Authentication was NULL");
                yield break;
            }
            XmlAttributeCollection data   = node.Attributes;
            XmlAttribute           status = (XmlAttribute)data.GetNamedItem("status");
            string msg = string.Empty;
            if (data.GetNamedItem("message") != null)
            {
                msg = data.GetNamedItem("message").Value;
            }
            switch (status.Value)
            {
            case "success":
                GameData.AddOwnedSuit(suitToBuy);
                GameData.MyTotalCredits -= GameData.getExosuit(suitToBuy).mCost;
                MessageBox.AddMessage("Suit Purchase Success!", "Your Suit was successfully Purchased.", null, true, MessageBox.MessageType.MB_OK, null);
                MessageBox.AddMessage("Equip New Suit?", "Would you like to equip your new suit?", null, false, MessageBox.MessageType.MB_YESNO, tabshowcase.EquipSelected);
                break;

            case "fail":
                MessageBox.AddMessage("Operation Error | Game DB Says You Cannot Purchase", msg, null, true, MessageBox.MessageType.MB_OK, null);
                break;
            }
        }
        else
        {
            MessageBox.AddMessage("ERROR PURCHASING SUIT!", "You Cannot Purchase this suit at this time.", null, true, MessageBox.MessageType.MB_OK, null);
            Debug.Log("@Error Purchasing Suit:" + www.error.ToString());
        }
    }
コード例 #11
0
    public void Interact()
    {
        if (currentHoverboard == null)
        {
            SpawnHoverboard();
        }

        if (currentHoverboard == null)
        {
            MessageBox.AddMessage("I don't have a hoverboard to call.", MessageBox.Type.Error);
            return;
        }

        Vector2 randomCircle   = Random.insideUnitCircle * 2.0f;
        Vector3 targetPosition = EntityManager.instance.PlayerCharacter.transform.position + new Vector3(randomCircle.x, 2.0f, randomCircle.y);

        currentHoverboard.transform.position = targetPosition;

        MessageBox.AddMessage("You summon your hoverboard.", MessageBox.Type.Warning);
        SoundEffectManager.Play(AudioClipAsset.UseGem, AudioMixerGroup.SFX);
    }
コード例 #12
0
    protected override void ConsumeItem()
    {
        if (!GameManager.instance.CanFireEvent(false))
        {
            return;
        }

        TeleportCanvas.instance.SetDestinations((td) =>
        {
            if (!GameManager.instance.CanFireEvent(true))
            {
                return;
            }

            td.Teleport(EntityManager.instance.PlayerCharacter.transform);
            EntityManager.instance.CameraController.SnapToTargetPosition();
            MessageBox.AddMessage("You smash the gem into the ground to unleash it's powers.");
            EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1);
            SoundEffectManager.Play(AudioClipAsset.UseGem, AudioMixerGroup.SFX);
        }, EntityManager.instance.teleportationBeams);

        TeleportCanvas.instance.Open();
    }
コード例 #13
0
    protected override void ConsumeItem()
    {
        if (!GameManager.instance.CanFireEvent(true))
        {
            return;
        }

        float percentOfMaxHealthToHeal = EntityManager.instance.PlayerCharacter.Health.MaxHealth * 0.1f;
        float modified = percentOfMaxHealthToHeal + (percentOfMaxHealthToHeal * TalentManager.instance.GetTalentModifier(TalentType.BigGulp));

        float added = EntityManager.instance.PlayerCharacter.Health.AddHealth(modified, HealType.Consumable);

        MessageBox.AddMessage("You eat the Calorie Capsule. It heals " + string.Format("{0:0.#}", added) + " hitpoints.");
        SoundEffectManager.Play(EntityManager.instance.eatSoundEffects.GetRandom(), AudioMixerGroup.SFX);

        if (UnityEngine.Random.value < TalentManager.instance.GetTalentModifier(TalentType.Resourceful))
        {
            MessageBox.AddMessage("Your " + TalentManager.instance.GetTalent(TalentType.Resourceful).talentData.talentName + " talent saves the Calorie Capsule from being consumed.");
        }
        else
        {
            EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1);
        }
    }