private void OnTriggerEnter2D(Collider2D collider) { BulletDestroy unit = collider.GetComponent <BulletDestroy>(); if (unit && unit.gameObject != parent) { trigger trigger = collider.GetComponent <trigger>(); if (!trigger) { Destroy(gameObject); } } Monster Monster = collider.GetComponent <Monster>(); if (Monster) { Destroy(gameObject); BulletDestroy.BangHere(collider.transform); } EmenyBullet emenyBullet = collider.GetComponent <EmenyBullet>(); if (emenyBullet) { Destroy(gameObject); } }
private static void Main() { // Disable Fog FogEnable(false); FogMaskEnable(false); // // Set up custom unit // // get id of custom unit int customUnitId = FourCC("O000"); // save spawned unit into a variable unit myUnit = CreateUnit(GetLocalPlayer(), customUnitId, 0.0f, 0.0f, 0.0f); // get id of custom ability int customSpellId = FourCC("A000"); // give custom ability to spawned unit UnitAddAbility(myUnit, customSpellId); // // Set up spell trigger // // Create the trigger trigger spellTrigger = CreateTrigger(); // Register the event that activates the trigger TriggerRegisterPlayerUnitEvent(spellTrigger, GetLocalPlayer(), EVENT_PLAYER_UNIT_SPELL_EFFECT, null); TriggerAddCondition(spellTrigger, Condition(spellCondition)); TriggerAddAction(spellTrigger, spellActions); // // Spawn a circle of wisps to attack // // The player that will own the spawned units player neutralAggressive = Player(PLAYER_NEUTRAL_AGGRESSIVE); // How many wisps to spawn const uint kNumWisps = 12; // The radius of the circle to spawn wisps in const float kCircleRadius = 500.0f; // The angle between each wisp const float kAngleDelta = (2.0f * 3.1415f) / kNumWisps; // A wisp's unitId int wispId = FourCC("ewsp"); // for each wisp we want to spawn... for (uint i = 0; i < kNumWisps; ++i) { // Calculate position in the circle float angle = kAngleDelta * i; float x = kCircleRadius * Cos(angle); float y = kCircleRadius * Sin(angle); // Spawn wisp CreateUnit(neutralAggressive, wispId, x, y, 0.0f); } Helpers.DebugPrint("Hello War3 C#!"); }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); tri = GetComponentInChildren <trigger>(); path = Application.streamingAssetsPath + "\\config.xml"; xmlD = new XmlDocument(); xmlD.Load(path); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D>(); cLeft = transform.Find("cLeft").gameObject.GetComponent <trigger>(); cRight = transform.Find("cRight").gameObject.GetComponent <trigger>(); cUp = transform.Find("cUp").gameObject.GetComponent <trigger>(); cDown = transform.Find("cDown").gameObject.GetComponent <trigger>(); }
public void Start() { //Pull variables from RobotControllerScript GameObject robot = GameObject.Find("robot 1"); RobotControllerSript robotScript = robot.GetComponent <RobotControllerSript>(); //Pull Variables from box script GameObject box = GameObject.Find("testCrate"); box boxScript = box.GetComponent <box> (); //Pull variables from trigger script GameObject trigger = GameObject.Find("switch_1"); trigger triggerScript = trigger.GetComponent <trigger> (); //Pull variables from RobotUP Script GameObject up = GameObject.Find("robot_1"); RobotUP upScript = up.GetComponent <RobotUP> (); //Begin Tests 1 //Test the character is alive when level is loaded Assertions.Equals(robotScript.dead, false); //Test the character is facing right when level is loaded Assertions.Equals(robotScript.facingRight, true); //Test ground check is working Assertions.Equals(robotScript.groundCheck, true); //End Tests 1 //Begin Test 2 //Test gravity is set properly Assertions.Equals(grav, Physics2D.gravity); //Test variable tacking gravity is set correctly Assertions.Equals(robotScript.jumpdir, 1); //End Test 2 //Begin Test 3 //Test that Finish is set to false as level is loaded Assertions.Equals(boxScript.finish, false); //End Test 3 //Begin Test 4 //Test the correct animation is set Assertions.Equals(triggerScript.doorOpen, "doorOpen"); //Test that the door is closed when level is loaded Assertions.Equals(triggerScript.isOpen, false); //End Test 4 //Begin Test 5 //Test that gravity is initialized properly Assertions.Equals(grav2, Physics2D.gravity); //Test gravity variable is set Assertions.Equals(upScript.jumpdir, 0); //End Test 5 }
/// <summary> /// This method locks execution AND must be called within trigger or it will break data (or crash). /// </summary> /// <returns></returns> public string Read() { ReadCount++; PromisedString ret = new PromisedString(); trigger SyncThread = CreateTrigger(); for (int i = 0; i < 100; i++) { foreach (NoxPlayer pl in NoxPlayer.AllPlayers.Values) { BlzTriggerRegisterPlayerSyncEvent(SyncThread, pl._Self, I2S(i) + "sync" + I2S(ReadCount), false); } } foreach (NoxPlayer pl in NoxPlayer.AllPlayers.Values) { BlzTriggerRegisterPlayerSyncEvent(SyncThread, pl._Self, "async" + I2S(ReadCount), false); // util } TriggerAddAction(SyncThread, () => { string prefix = BlzGetTriggerSyncPrefix().Split("sync")[0]; if (prefix == "a") { ret.Size = S2I(BlzGetTriggerSyncData()); } else { ret.Chunks.Add(S2I(prefix), BlzGetTriggerSyncData()); } ret.CheckComplete(); }); if (GetLocalPlayer() == TargetPlayer._Self) { Preloader(Path); int i = 0; for (; i < 100; i++) { string chunk = BlzGetAbilityExtendedTooltip(AbilID, i); BlzSetAbilityExtendedTooltip(AbilID, "0", i); if (chunk == "0") { break; } BlzSendSyncData(I2S(i) + "sync" + I2S(ReadCount), chunk); } BlzSendSyncData("async" + I2S(ReadCount), I2S(i)); } while (!ret.HaveString) { TriggerSleepAction(0.1f); } DestroyTrigger(SyncThread); return(ret.BuildString()); }
// Update is called once per frame void Update() { t1 = GameObject.Find("trigger1").GetComponent <trigger>(); f1 = GameObject.Find("rock_ball_sprite").GetComponent <fading>(); if (t1.b1) { gameObject.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic; // Debug.Log(gameObject.GetComponent<Rigidbody2D>().bodyType); f1.fade(); } }
public static void InitAbilityLogic() { tr = CreateTrigger(); TriggerRegisterAnyUnitEventBJ(tr, EVENT_PLAYER_UNIT_SPELL_CAST); TriggerAddAction(tr, () => { if (Indexer.ContainsKey(GetSpellAbilityId())) { Indexer[GetSpellAbilityId()].Callback(); } }); }
internal void CreateWrapper(Func <TEventArgs> eventArgsFunc, IEnumerable <Action <trigger> > registrars) { _trigger = CreateTrigger(); _triggercondition = TriggerAddCondition(_trigger, Condition(() => { Event.Invoke(null, eventArgsFunc()); return(false); })); foreach (var registrar in registrars) { registrar(_trigger); } }
void Start() { sp = new SerialPort(serialPortName, 9600); if (!sp.IsOpen) { print("Opening " + serialPortName + " baud 9600"); sp.Open(); sp.ReadTimeout = 100; sp.Handshake = Handshake.None; if (sp.IsOpen) { print("Open"); } } GameObject trigger = GameObject.Find("Trigger"); triggerScript = trigger.GetComponent <trigger>(); }
// Start is called before the first frame update void Start() { trigger1 = palanca1.GetComponent <trigger>(); trigger2 = palanca2.GetComponent <trigger>(); trigger3 = palanca3.GetComponent <trigger>(); trigger4 = palanca4.GetComponent <trigger>(); trigger5 = palanca5.GetComponent <trigger>(); anim1 = palanca1.GetComponent <Animator>(); anim2 = palanca2.GetComponent <Animator>(); anim3 = palanca3.GetComponent <Animator>(); anim4 = palanca4.GetComponent <Animator>(); anim5 = palanca5.GetComponent <Animator>(); scriptPlayer = player.GetComponent <Player>(); follow = camara.GetComponent <FollowTarget>(); animPj = player.GetComponent <Animator>(); }
public override void commandTriggered(List <string> args, string triggeredFromUsername, bool triggeredFromMod) { if (this.usernameTriggered.ContainsKey(triggeredFromUsername)) { if (this.usernameTriggered[triggeredFromUsername].checkTrigger()) { this.usernameTriggered[triggeredFromUsername].doTrigger(); } else { return; } } else { trigger t = new trigger(); t.doTrigger(); this.usernameTriggered.Add(triggeredFromUsername, t); } string[] tourettemessages = Config.Plugin_Tourette_Messages.Split(";"[0]); int molnarcommands = 1; foreach (string arg in args) { if (arg.ToLower().Contains(this.commandTag.ToLower())) { molnarcommands = molnarcommands + 1; } } if (molnarcommands >= 4) { molnarcommands = 3; } for (int i = 0; i < molnarcommands; i++) { Random rdmTouretteMessage = new Random(Guid.NewGuid().GetHashCode()); SendChatMessage(tourettemessages[rdmTouretteMessage.Next(0, tourettemessages.Count())].ToUpper()); } }
void Start() { sp = new SerialPort(serialPortName, 9600); if (!sp.IsOpen) { print("Opening " + serialPortName + " baud 9600"); sp.Open(); sp.ReadTimeout = 100; sp.Handshake = Handshake.None; if (sp.IsOpen) { print("Open"); } } GameObject trigger = GameObject.Find("Trigger"); triggerScript = trigger.GetComponent <trigger>(); //GameObject ResetaBall = GameObject.Find("Reset"); //resetScript = ResetaBall.GetComponent<ResetaBall>(); //Debug.Log(triggerScript.hit); }
bool checkTriggers() { int total = 0; foreach (GameObject trigger in triggers) { trigger tmpTrigger = trigger.GetComponent <trigger>(); if (tmpTrigger.getActive()) { total += 1; } } if (total == triggers.Length) { return(true); } else { return(false); } }
internal static void InitItemLogic() { trigger itemPick = CreateTrigger(); trigger itemDrop = CreateTrigger(); trigger itemUse = CreateTrigger(); TriggerRegisterAnyUnitEventBJ(itemPick, EVENT_PLAYER_UNIT_PICKUP_ITEM); TriggerRegisterAnyUnitEventBJ(itemDrop, EVENT_PLAYER_UNIT_PAWN_ITEM); TriggerRegisterAnyUnitEventBJ(itemDrop, EVENT_PLAYER_UNIT_DROP_ITEM); TriggerRegisterAnyUnitEventBJ(itemUse, EVENT_PLAYER_UNIT_USE_ITEM); TriggerAddAction(itemPick, () => { int type = GetItemTypeId(GetManipulatedItem()); NoxItem check = Indexer[type]; if (check != null) { check.PickUp.Invoke(GetManipulatingUnit()); } }); TriggerAddAction(itemDrop, () => { int type = GetItemTypeId(GetManipulatedItem()); NoxItem check = Indexer[type]; if (check != null) { check.Drop.Invoke(GetManipulatingUnit()); } }); TriggerAddAction(itemUse, () => { int type = GetItemTypeId(GetManipulatedItem()); NoxItem check = Indexer[type]; if (check != null) { check.Use.Invoke(GetManipulatingUnit()); } }); }
protected void writeAction(trigger, action) { if (action > 0) { this.writer.writeLine(sprintf("// on %s shift and go to state %d", trigger, action)); } elseif(action < 0) { rule = this.grammar.getRule(-action); components = rule.getComponents(); if (empty(components)) { rhs = "/* empty */"; } else { rhs = implode(" ", components); } this.writer.writeLine(sprintf("// on %s reduce by rule %s . %s", trigger, rule.getName(), rhs)); }
public override void ProcessMessage(ref byte[] message) { network_utils.HEADER header = network_utils.nData.Instance.DeserializeMsg <network_utils.HEADER>(message); if (header.signum != network_utils.SIGNUM.BIN) { return; } switch (header.command) { case (int)network_data.COMMANDS.center_ship: { network_data.enter_ship com = network_utils.nData.Instance.DeserializeMsg <network_data.enter_ship>(message); if (Channel.GetNetwork().IsClient() == false) { GameObject g = GetNextSpawnPoint(); SpawnPlayer(com.header.containerID, Channel.GetNetwork().IsClient(), false, g.transform.localPosition, g.transform.localRotation, 0); } } break; case (int)network_data.COMMANDS.ccreate_player: { network_data.create_player com = network_utils.nData.Instance.DeserializeMsg <network_data.create_player>(message); if (Channel.GetNetwork().IsClient() == true) { SpawnPlayer(com.header.containerID, Channel.GetNetwork().IsClient(), Channel.GetNetwork().GetComponent <client>().ingameContID == com.header.containerID, com.position, com.rotation, 0); } } break; case (int)network_data.COMMANDS.cmove_player: { network_data.move_player com = network_utils.nData.Instance.DeserializeMsg <network_data.move_player>(message); if (Channel.GetNetwork().IsClient()) { if (Channel.GetNetwork().GetComponent <client>().ingameContID != com.header.containerID) { GameObject g = Channel.GetEntity(com.header.containerID); if (g != null) { g.GetComponent <puppet>().SetTransform(com.position, com.rotation, puppet.trans_flag_position | puppet.trans_flag_rotation, com.time); } } } else { GameObject g = Channel.GetEntity(com.header.containerID); if (g != null) { g.GetComponent <puppet>().SetTransform(com.position, com.rotation, puppet.trans_flag_position | puppet.trans_flag_rotation, com.time); } } } break; case (int)network_data.COMMANDS.cdisconnect: { network_data.disconnect com = network_utils.nData.Instance.DeserializeMsg <network_data.disconnect>(message); UnregisterEntity(com.header.containerID); } break; case (int)network_data.COMMANDS.ctrigger: { network_data.trigger com = network_utils.nData.Instance.DeserializeMsg <network_data.trigger>(message); if (Triggers.ContainsKey(com.netID)) { trigger t = Triggers[com.netID]; if (Channel.GetNetwork().IsClient()) { if (com.accept) { t.SetTrigger(com.count, com.on); t.GetLink().Accept(com.on, com.header.containerID); t.DoActivate(com.header.containerID); } } else { t.TriggerRequest(com.header.containerID); t.DoActivate(com.header.containerID); } } } break; } }
public void SetTrigger(trigger t) { Trigger = t; }
public void SpawnPlayer(int contID, bool IsClient, bool ownPlayer, Vector3 position, Quaternion rotation, float time) { Vector3 re = rotation.eulerAngles; GameObject Player = Instantiate(Resources.Load("Prefabs/Player", typeof(GameObject)), transform) as GameObject; Player.transform.localPosition = position; Player.transform.localRotation = rotation; Channel.RegisterEntity(Player, contID); if (IsClient && ownPlayer) { Transform t = Player.transform.FindChild("Camera"); myCam = t.gameObject; t.gameObject.SetActive(true); Player.AddComponent <puppetcontrol>(); Player.GetComponent <puppet>().InitTransform(position, rotation);// rotation); puppetcontrol f = Player.GetComponent <puppetcontrol>(); f.SetChannel(Channel); // f.AddObjectToInteract(this.gameObject); GameObject GUI = GameObject.Find("GUI"); if (GUI != null) { GUI.GetComponent <gui>().PushUserInterface(Player); } } else { Player.AddComponent <puppet>(); Player.GetComponent <puppet>().InitTransform(position, rotation);// rotation); } Player.GetComponent <puppet>().SetTransform(position, rotation, puppet.trans_flag_position | puppet.trans_flag_rotation, time); if (Player) { Debug.Log("Enter Ship (" + Channel.GetChannel() + ")" + " player " + contID + " pos: " + position + " rot:" + re.x + "," + re.y + "," + re.z); } if (IsClient == false) { network_data.create_player m = new network_data.create_player(); m.set(contID, Channel.GetChannel()); m.position = position; m.rotation = rotation; byte[] data = network_utils.nData.Instance.SerializeMsg <network_data.create_player>(m); Channel.SendToChannel(ref data); List <byte[]> datalist = new List <byte[]>(); IDictionaryEnumerator r = Channel.FirstEntity(); while (r.MoveNext()) { if (contID != (int)r.Key) { m.set((int)r.Key, Channel.GetChannel()); m.position = ((GameObject)r.Value).transform.localPosition; m.rotation = ((GameObject)r.Value).transform.localRotation; byte[] data1 = network_utils.nData.Instance.SerializeMsg <network_data.create_player>(m); Channel.GetNetwork().Send(contID, data1); } } foreach (KeyValuePair <int, trigger> j in Triggers) { trigger t = (trigger)j.Value; t.SendTriggerTo(contID); } } }
protected override void RegisterTriggerEvents(trigger trigger) { TriggerRegisterEnterRegion(trigger, Rectangle.WorldBounds.Region, null); }
void Update() { if (!isActiv) { return; } SetMoveVector(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"))); UpdateCamera(); if (UI != null) { Ray ray = myCamera.GetComponent <Camera>().ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); RaycastHit hit; LayerMask _layerMask = 1 << 9; float dist = 1.5f; bool use_on = false; if (Physics.Raycast(ray, out hit, dist, _layerMask)) { trigger interact = hit.collider.gameObject.GetComponent <trigger>(); if (interact) { use_on = true; if (Channel.GetNetwork().IsClient()) { client c = (client)Channel.GetNetwork(); if (Input.GetKeyDown(KeyCode.F)) { interact.SendRequest(c.ingameContID); } } } else { } } Transform m = UI.transform.FindChild("Cursor_Use"); m.gameObject.SetActive(use_on); } /* if (UI != null) * { * foreach (KeyValuePair<int,GameObject> obj in ObjectToInteractWith) * { * trigger interact = obj.Value.GetComponent<ship>().MouseOver(); * if (interact != null) * { * Transform m = UI.transform.FindChild("Cursor_Use"); * m.gameObject.SetActive(true); * if (obj.Value.GetComponent<ship>().GetComponent<channel>().GetNetwork().IsClient()) * { * client c = (client)obj.Value.GetComponent<ship>().GetComponent<channel>().GetNetwork(); * if (Input.GetKeyDown(KeyCode.F)) * { * interact.SendRequest(c.ingameContID); * } * } * } * else * { * Transform m = UI.transform.FindChild("Cursor_Use"); * m.gameObject.SetActive(false); * } * } * } */ }
set => Set(trigger, value);
protected override DHJassValue Run() { trigger t = new trigger(); return new DHJassHandle(null, t.handle); }
public void Trigger(trigger trig, double startTime, int endTime) { Add(string.Format("T,{0},{1},{2}", trig, (int)startTime, endTime)); layers++; }
protected void writeAction(StringWriter writer, trigger, action) { writer.write(sprintf("" % s "=>%d", trigger, action)); }
void Start() { instance = this; }
protected abstract void RegisterTriggerEvents(trigger trigger);