private void OnRecvTrigerOnEnter(IChannel channel, Message message) { CTrigerOnEnter msg = message as CTrigerOnEnter; STrigerOnEnter response = new STrigerOnEnter(); Player player = channel.GetContent() as Player; if (msg.pressurePad != null) { var pressurePad = World.Instance.PressurePads[msg.pressurePad.name]; if (!pressurePad.used) { response.pressurePad = msg.pressurePad; } pressurePad.used = true; } if (msg.switchCrystal != null) { var switchCrystal = World.Instance.SwitchCrystals[msg.switchCrystal.name]; if (!switchCrystal.used) { response.switchCrystal = msg.switchCrystal; } switchCrystal.used = true; } if (msg.healthBox != null) { var healthBox = World.Instance.HealthBoxes[msg.healthBox.name]; if (!healthBox.used) { response.healthBox = msg.healthBox; } healthBox.used = true; player.currentHP = player.maxHP; } player.Broadcast(response); }
public void SendTrigerMessage() { lock (used_lock) { if (used) { return; } used = true; } CTrigerOnEnter msg = new CTrigerOnEnter(); string name = gameObject.name; if (name.Contains("PressurePad")) { msg.pressurePad = new PressurePad(false, 0, name); } else if (name.Contains("Switch")) { msg.switchCrystal = new SwitchCrystal(false, 0, name); } else if (name.Contains("HealthCrate")) { msg.healthBox = new HealthBox(false, 0, name); World.Instance.fPlayer.ResetHP(); } else if (name.Contains("Trans")) { CChangeScene cs = new CChangeScene(); cs.player_id = 0; cs.level = "Level2"; Client.Instance.Send(cs); return; } Client.Instance.Send(msg); }