public void Activate() { skill = false; motor.lockOn = false; target = motor.lockonTarget.GetComponent <TargetObj>(); target.GetComponent <TommyBoom> ().Boom(); }
public void SelfAssignedInConstructor() { var target = new TargetObj(); Assert.That(target.Self, Is.Not.Null); Assert.That(target, Is.SameAs(target.Self)); }
void Start() { if (targetFintObj == null) { string targetName = this.tag + "Target"; targetFintObj = GameObject.Find(targetName).GetComponent <TargetObj>(); } target = 0; if (targetObj == null) { targetObj = targetFintObj.GetTargetObject(targetNum, this); this.transform.LookAt(targetObj.transform); transform.Rotate(new Vector3(0, 1, 0), 180); } moveStop = false; x = Random.Range(-2.0f, 2.0f); if (tag == "Frog" || tag == "Frog2") { y = 0.0f; } else { y = Random.Range(0, 2.0f); } z = Random.Range(-2.0f, 2.0f); goalObject = GameObject.Find("EnemyGoal"); barrier = GameObject.Find("Barrier").GetComponent <Barrier>(); anim = transform.GetChild(0).GetComponent <Animator>(); }
private void OnReceiveMessage(string message) { Room room = JsonConvert.DeserializeObject <Room>(message); UpdateRoomUsers(room); if (CurrentState == State.Timeup || CurrentState == State.Finish) { return; } if (room.action == "start_count_down") { ChangeState(State.CountDown); } else if (room.action == "appear_object") { if (room.targets != null) { for (int i = 0; i < appearSymbols.Count; ++i) { DeleteSymbol(appearSymbols[i]); } for (int i = 0; i < room.targets.Count; ++i) { TargetObj target = room.targets[i]; AppearSymbol(new Vector3(target.x, target.y, target.z), target.asset_index, target.id); } } } }
public void NonAssignableProxyDoesntThrow() { TargetObj target = new TargetObj(); object proxy = new object(); Assert.False(TrySetSelf(target, proxy)); }
public void NullProxyThrowsArgumentNullException() { TargetObj target = new TargetObj(); SelfType proxy = null; Assert.Throws <ArgumentNullException>(() => TrySetSelf(target, proxy)); }
public override void Update() { if (TargetObj != null && TargetObj.GetComponent <Vive_Pickup>() != null && TargetObj.GetComponent <Vive_Pickup>().Get_Controller() != null) { condition = TargetObj.GetComponent <Vive_Pickup>().Get_Controller().triggerPressed; } base.Update(); }
public void AssignSelfAfterConstruction() { var target = new TargetObj(); var wrapper = new NotATargetObj(); target.Self = wrapper; Assert.That(target.Self, Is.Not.Null); Assert.That(wrapper, Is.SameAs(target.Self)); }
public void ValidAssignWorks() { TargetObj target = new TargetObj(); SelfType proxy = new SelfType(); Assert.True(TrySetSelf(target, proxy)); Assert.That(target.Self, Is.SameAs(proxy)); }
private void Input_ButtonPressed(object sender, ButtonPressedEventArgs e) { #if NEVER //DEBUG // Testing the Scarecrow transpiler harmony patch if (e.Button == SButton.R && Game1.activeClickableMenu == null && Game1.player.currentLocation is Farm farm) { farm.addCrows(); } #endif if (IsCombineKeyHeld(Helper.Input)) { if (Game1.activeClickableMenu is GameMenu GM && GM.currentTab == GameMenu.inventoryTab && TryGetClickedInventoryItem(GM, e, out Item ClickedItem, out int ClickedItemIndex)) { // Detect when player clicks on a machine in their inventory while another machine of the same type is selected if (SButtonExtensions.IsUseToolButton(e.Button) /*e.Button == SButton.MouseLeft*/ && Game1.player.CursorSlotItem is SObject SourceObj && ClickedItem is SObject TargetObj && CanCombine(SourceObj, TargetObj)) { if (!SourceObj.TryGetCombinedQuantity(out int SourceQuantity)) { SourceQuantity = SourceObj.Stack; } if (!TargetObj.TryGetCombinedQuantity(out int TargetQuantity)) { TargetQuantity = TargetObj.Stack; } TargetObj.SetCombinedQuantity(SourceQuantity + TargetQuantity); Game1.player.CursorSlotItem = null; // Clicking an item will make the game set it to the new CursorSlotItem, but since we just combined them, we want the CursorSlotItem to be empty DelayHelpers.InvokeLater(1, () => { if (Game1.player.CursorSlotItem != null && Game1.player.Items[ClickedItemIndex] == null) { Game1.player.Items[ClickedItemIndex] = Game1.player.CursorSlotItem; Game1.player.CursorSlotItem = null; } }); } // Right-clicking a combined machine splits it to its un-combined state else if (SButtonExtensions.IsActionButton(e.Button) /*e.Button == SButton.MouseRight*/ && Game1.player.CursorSlotItem == null && ClickedItem is SObject ClickedObject && ClickedObject.IsCombinedMachine() && ClickedObject.TryGetCombinedQuantity(out int CombinedQuantity) && CombinedQuantity > 1) { ClickedObject.modData.Remove(ModDataQuantityKey); ClickedObject.Stack += CombinedQuantity - 1; Logger.Log(string.Format("De-combined {0} (Stack={1})", ClickedObject.DisplayName, CombinedQuantity), InfoLogLevel); } }
private void Input_ButtonPressed(object sender, ButtonPressedEventArgs e) { // Detect when player clicks on a machine in their inventory while another machine of the same type is selected, and the CTRL key is held if (e.Button == SButton.MouseLeft && IsCombineKeyHeld(Helper.Input)) { if (Game1.activeClickableMenu is GameMenu GM && GM.currentTab == GameMenu.inventoryTab) { if (TryGetClickedInventoryItem(GM, e, out Item ClickedItem, out int ClickedItemIndex)) { if (Game1.player.CursorSlotItem is SObject SourceObj && ClickedItem is SObject TargetObj && CanCombine(SourceObj, TargetObj)) { if (!SourceObj.TryGetCombinedQuantity(out int SourceQuantity)) { SourceQuantity = SourceObj.Stack; } if (!TargetObj.TryGetCombinedQuantity(out int TargetQuantity)) { TargetQuantity = TargetObj.Stack; } TargetObj.SetCombinedQuantity(SourceQuantity + TargetQuantity); Game1.player.CursorSlotItem = null; // Clicking an item will make the game set it to the new CursorSlotItem, but since we just combined them, we want the CursorSlotItem to be empty DelayHelpers.InvokeLater(1, () => { if (Game1.player.CursorSlotItem != null && Game1.player.Items[ClickedItemIndex] == null) { Game1.player.Items[ClickedItemIndex] = Game1.player.CursorSlotItem; Game1.player.CursorSlotItem = null; } }); } } } } }
public override void StickExit() { TargetObj.GetComponent <Vive_Pickup>().enabled = true; TargetObj.GetComponent <Rigidbody>().detectCollisions = true; base.StickExit(); }
public void C_Select() { TargetObj.GetComponent <Target_Obj_Switch>().SwitchSelect(myID); }