Beispiel #1
0
        public static void JoinedGame()
        {
            string         chatPlayerColor = GameController.gameController.playerAgent.objectMult.GetChatPlayerColor(GameController.gameController.playerAgent.playerColor);
            NetworkPackage package         = new NetworkPackage(1);

            package.write(GameController.gameController.playerAgent.objectMult.netId.Value.ToString());
            package.write(GameController.gameController.playerAgent.objectMult.playerUniqueID.ToString());
            package.write(chatPlayerColor);
            if (GameController.gameController.playerAgent.objectMult.gc.serverPlayer)
            {
                package.write("isServer");
            }
            else
            {
                package.write("isClient");
            }
            package.write(RedModMain.pluginVersion.ToString());
            RedNetwork.SendPackage(package);
        }
Beispiel #2
0
        public static void LoadSkill()
        {
            Sprite        questionmarkSprite = RogueUtilities.ConvertToSprite(RedMod.Properties.Resources.questionmark);
            CustomAbility randomAbility      = RogueLibs.CreateCustomAbility("randomAbility", questionmarkSprite, true,
                                                                             new CustomNameInfo("Random Ability"),
                                                                             new CustomNameInfo("???"),
                                                                             item =>
            {
            });



            randomAbility.OnPressed = (item, agent) =>
            {
                RedNetwork redNetwork = GameController.gameController.playerAgent.objectMult.gameObject.AddComponent(typeof(RedNetwork)) as RedNetwork;
                if (item.invItemCount > 0) // is recharging
                {
                    agent.gc.audioHandler.Play(agent, "CantDo");
                }
                else
                {
                    thisAgent = agent;
                    RandomEffect();
                    //InvItem newItem3 = GameController.gameController.playerAgent.inventory.AddItem("Giantizer", 2);

                    /*List<Agent> players = new List<Agent>();
                     * foreach (Agent a in GameController.gameController.playerAgentList)
                     * {
                     *
                     *  players.Add(a);
                     *  Debug.Log("NetId: "+ a.objectNetID);
                     *  GameController.gameController.playerAgent.GetComponent<RedNetwork>().AddStatusEffectOthers("Giant", true, GameController.gameController.playerAgent, a, GameController.gameController.playerAgent.objectMult.IsFromClient(), true, -1);
                     *  //a.statusEffects.AddStatusEffect("Invisible", true, GameController.gameController.playerAgent, a.objectNetID, false, -1);
                     *  //GameController.gameController.playerAgent.statusEffects.AddStatusEffectSpecial("Invisible", a, GameController.gameController.playerAgent, false);
                     *  //a.gameObject.GetComponent<NetworkIdentity>().AssignClientAuthority(this.GetComponent<NetworkIdentity>().connectionToClient);
                     *  //a.objectMultAgent.CallCmdAddStatusEffectSpecial("Invisible", GameController.gameController.playerAgent.objectNetID, true, false, -1);
                     *
                     * }*/

                    //GameController.gameController.playerAgent.objectMultAgent.CallCmdAddStatusEffect("Invisible", GameController.gameController.playerAgent.objectNetID, true, false, -1);
                    //GameController.gameController.playerAgent.statusEffects.AddStatusEffect("Invisible", true, GameController.gameController.playerAgent, GameController.gameController.playerAgent.objectNetID, false, -1);
                    //GameController.gameController.hostPlayer.objectMultAgent.CallRpcAddStatusEffect("Invisible", GameController.gameController.hostPlayer.objectNetID,true, GameController.gameController.hostPlayer.objectMultAgent.IsFromClient(),  false, -1);
                    //GameController.gameController.playerAgent.objectMultAgent.AddStatusEffect("Invisible", true, GameController.gameController.playerAgent, GameController.gameController.hostPlayer.objectMultAgent.IsFromClient(), true, -1);
                    agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable();
                    // make special ability slot half-transparent
                    item.invItemCount = 100; // 100 x 0.13f = 13 seconds to recharge
                                             // or you can replace 100 with 13, and 0.13 with 1 to make it simpler
                }
            };

            randomAbility.RechargeInterval = (item, agent)
                                             => item.invItemCount > 0 ? new WaitForSeconds(0.01f) : null;

            randomAbility.Recharge = (item, agent) =>
            {
                if (item.invItemCount > 0 && agent.statusEffects.CanRecharge())
                {                               // if can recharge
                    item.invItemCount--;
                    if (item.invItemCount == 0) // ability recharged
                    {
                        agent.statusEffects.CreateBuffText("Recharged", agent.objectNetID);
                        agent.gc.audioHandler.Play(agent, "Recharge");
                        agent.inventory.buffDisplay.specialAbilitySlot.MakeUsable();
                        // make special ability slot fully visible
                    }
                }
            };
        }