public static void Register(ActionMenu _actionMenu) { if (_actionMenu != null && !m_ActionMenu.ContainsKey(_actionMenu.name)) { m_ActionMenu.Add(_actionMenu.name, _actionMenu); } }
void Trade() { Item fromUnit = null; Item fromTarget = null; foreach (ItemButton b in inv1.GetComponentsInChildren <ItemButton>()) { if (b.GetComponent <UIHighlight>().IsStatic) { fromUnit = b.GetItem(); break; } } foreach (ItemButton b in inv2.GetComponentsInChildren <ItemButton>()) { if (b.GetComponent <UIHighlight>().IsStatic) { fromTarget = b.GetItem(); break; } } if (fromUnit == null || fromTarget == null) { return; } Fighter.Unit.inventory.Trade(Fighter, Target, fromUnit, fromTarget); ActionMenu.BaseAction(); ResetLists(Fighter, Target); }
public void destroyActionMenu() { storedTooltipBounds = new Rect(0,0,0,0); storedTooltipText = null; storedActionMenu = null; actionMenuOpen = false; }
public void CreateNewAsset() { var asset = ScriptableObject.CreateInstance <ActionAsset>(); newNetworkName = newNetworkName.Replace(" ", string.Empty); string nameCopy = newNetworkName.Clone().ToString(); int index = 0; if (System.IO.File.Exists(Application.dataPath + "/coAdjoint/Action/Libraries/" + newNetworkName + ".asset")) { ++index; while (System.IO.File.Exists(Application.dataPath + "/coAdjoint/Action/Libraries/" + newNetworkName + index + ".asset")) { ++index; } nameCopy += index.ToString(); } asset.libraryData = (new ActionLibrary()).GetData(); AssetDatabase.CreateAsset(asset, "Assets/coAdjoint/Action/Libraries/" + nameCopy + ".asset"); Selection.activeObject = asset; ActionMenu.EditLibraryAsset(); this.Close(); }
public static void Unregister(ActionMenu _actionMenu) { if (_actionMenu != null) { m_ActionMenu.Remove(_actionMenu.name); } }
private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if ((e.ColumnIndex == Offset.Index) && (e.Value != null)) { byte b = (byte)e.Value; e.Value = b.ToString("X2"); e.FormattingApplied = true; } else if (e.ColumnIndex == ActionColumn.Index) { if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) && (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) && (dataGridView.Rows[e.RowIndex].DataBoundItem is ActionMenu)) { ActionMenu menu = dataGridView.Rows[e.RowIndex].DataBoundItem as ActionMenu; if (menu.Default != null) { ActionMenuEntry a = menu.Default.MenuAction; if (a != (e.Value as ActionMenuEntry)) { e.CellStyle.BackColor = Settings.ModifiedColor.BackgroundColor; e.CellStyle.ForeColor = Settings.ModifiedColor.ForegroundColor; } } } } }
private void Update() { if (IsOpen && InputManager.RightClickUp()) { ActionMenu.Open(PhaseManager.Fighter); Close(); } }
public void updateCard(ObjectInfo info, ActionMenu menu) { actionInfo = info; parentMenu = menu; nameText.text = info.name;//todo: should find real name in item json //updateDetail(); button.GetComponent <UIButton>().OnClick.OnTrigger.Event.AddListener(delegate { select(); }); }
void Update() { // Make sure you have the ActionMenu component if (actionMenu == null && GameObject.Find("Camera")) actionMenu = GameObject.Find("Camera").GetComponent<ActionMenu>(); // Return if action menu is not set if (actionMenu == null) return; // Move objects to correct position foreach (Types type in Enum.GetValues(typeof(Types))) { // Decide to make visible or invisible if (type != Types.Null && type == currentType) { sideObjects[(int)type].SetActive(true); } else if (type != Types.Null && type != currentType) { sideObjects[(int)type].SetActive(false); } // Check if this is the action menu. If yes, loop through his child objects if (type == Types.ActionMenu) { foreach (GameObject obj in actionMenuItems) { // Enable/disable children if (obj.name == actionMenu.currentAction.ToString()) { for (int amount = 0; amount < obj.transform.childCount; amount++) { obj.transform.GetChild(amount).gameObject.SetActive(true); } } else { for (int amount = 0; amount < obj.transform.childCount; amount++) { obj.transform.GetChild(amount).gameObject.SetActive(false); } } } } } // Loop through touches int i = 0; while (i < Input.touchCount) { // Check if input is to the right of the UI if (Input.GetTouch(i).position.x > 300 && Input.GetTouch(i).phase == TouchPhase.Ended) currentType = Types.Null; i++; } }
public static void AddPedalsInList(List <PedalStruct> list, ActionMenu instance) { //if (!LoaderIntegrityCheck.passed && new System.Random().Next(3) == 1) return; foreach (var pedalStruct in list) { if (!pedalStruct.shouldAdd) { continue; } var pedalOption = instance.AddOption(); pedalOption.SetText(pedalStruct.text); if (!pedalStruct.locked) { pedalOption.SetPedalAction(pedalStruct.triggerEvent); } else { pedalOption.Lock(); } //Additional setup for pedals switch (pedalStruct.Type) { /*case PedalType.SubMenu: * pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeFolder); * break;*/ case PedalType.RadialPuppet: var pedalRadial = (PedalRadial)pedalStruct; pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeRadial); pedalOption.SetButtonPercentText($"{Math.Round(pedalRadial.currentValue)}%"); pedalRadial.pedal = pedalOption; pedalOption.SetBackgroundIcon(pedalStruct.icon); break; case PedalType.Toggle: var pedalToggle = (PedalToggle)pedalStruct; if (pedalToggle.toggled) { pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeToggleOn); } else { pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeToggleOff); } pedalToggle.pedal = pedalOption; pedalOption.SetBackgroundIcon(pedalStruct.icon); break; case PedalType.FourAxisPuppet: pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeAxis); pedalOption.SetBackgroundIcon(pedalStruct.icon); break; default: pedalOption.SetForegroundIcon(pedalStruct.icon); break; } } }
public override void Callback(ActionMenu menu) { var actor = GameContext.Actors[actorIndex]; GameContext.WalkTo(2, 1, 1, GameContext.Self.PathX[0], GameContext.Self.PathY[0], actor.PathX[0], actor.PathY[0], 0, 0, 0, false); var pos = InputUtils.mousePosition; GameContext.Cross.Show(2, (int)pos.x, (int)pos.y); switch (optionIndex) { case 0: { var @out = new Packet(155); @out.WriteLEShort(actorIndex); GameContext.NetworkHandler.Write(@out); break; } case 1: { var @out = new Packet(72); @out.WriteShortA(actorIndex); GameContext.NetworkHandler.Write(@out); break; } case 2: { var @out = new Packet(17); @out.WriteLEShortA(actorIndex); GameContext.NetworkHandler.Write(@out); break; } case 3: { var @out = new Packet(21); @out.WriteShort(actorIndex); GameContext.NetworkHandler.Write(@out); break; } case 4: { var @out = new Packet(18); @out.WriteLEShort(actorIndex); GameContext.NetworkHandler.Write(@out); break; } case 5: var desc = actor.Config; GameContext.Chat.Add(new ChatMessage(MessageType.Ambiguous, "", "It's a " + desc.Name + ".")); break; } }
public static void Show(string _menuName) { ActionMenu result = null; if (m_ActionMenu.TryGetValue(_menuName, out result) && !result.gameObject.activeSelf) { result.Show(); } }
/// <summary> /// Unselect one action menu and its childs. /// </summary> /// <param name="actionMenu">The action menu to unselect.</param> private void UnselectAction(ActionMenu actionMenu) { for (int index = 0; index < actionMenu.Commands.Count; index++) { actionMenu.Commands[index].Selected = false; } actionMenu.Selected = false; }
private void showActionMenu() { actionMenu = MenuManager.instantiateActionMenu(); addActionMenuListeners(); actionMenu.init(currentPlayer); isMenuActive = true; }
/// <summary> /// Called when the aim of the Heal magic is released. /// </summary> /// <param name="actionMenu">The menu that requested the mover.</param> /// <param name="target">The unit targeted by the aim. Null if the aim is over anything.</param> /// <param name="position">The last valid position of the aim.</param> private void Aim_Aimed(ActionMenu actionMenu, Unit target, Vector2 position) { this.Reset(); // Execute the command. CommandMenu commandMenu = actionMenu as CommandMenu; commandMenu.Command.Execute(target, position); }
public static void Hide(string _menuName) { ActionMenu result = null; if (!m_ActionMenu.TryGetValue(_menuName, out result) && result.gameObject.activeSelf) { result.Hide(); } }
private void pasteAll(object sender, EventArgs e) { if (copiedEntry != null) { ActionMenu destEntry = dataGridView.CurrentRow.DataBoundItem as ActionMenu; copiedEntry.CopyAllTo(destEntry); dataGridView.Invalidate(); } }
public override void OnInspectorGUI() { GUILayout.TextArea("This asset contains your Action Library. The library contains one or more" + " networks for use in your Unity3D project. To edit the library, press the 'Edit Library' button below."); EditorGUILayout.Separator(); ActionAsset highlightedAsset = Selection.activeObject as ActionAsset; try { currentLibrary = ActionLibrary.LoadData(highlightedAsset.libraryData); } catch {} GUILayout.Label("This library contains " + currentLibrary.networks.Length + " networks."); EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayout.Button("Edit Library", GUILayout.MaxWidth(100f))) { ActionMenu.EditLibraryAsset(); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayout.Button("Generate Runtime Library from Asset")) { //ActionClassGenerator.CreateNetworkClass(Selection.activeObject as ActionAsset); ActionCompiler.GenerateRTLibrary(Selection.activeObject as ActionAsset); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); if (GUILayout.Button("Export Library")) { SerializeToXML(currentLibrary); //SerializeToBin(currentLibrary); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); }
private static void AddPedalsInList(List <PedalStruct> pedalStructs, ActionMenu instance) { foreach (PedalStruct pedalStruct in pedalStructs) { PedalOption pedalOption = instance.AddOption(); pedalOption.setText(pedalStruct.text); // VVV pedalOption.setIcon(pedalStruct.icon); //Pretty self explanatory pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); } }
public override void Callback(ActionMenu menu) { switch (optionIndex) { case 0: { var @out = new Packet(145); @out.WriteShortA(widgetId); @out.WriteShortA(widgetSlot); @out.WriteShortA(itemId); GameContext.NetworkHandler.Write(@out); break; } case 1: { var @out = new Packet(117); @out.WriteLEShortA(widgetId); @out.WriteLEShortA(itemId); @out.WriteLEShort(widgetSlot); GameContext.NetworkHandler.Write(@out); break; } case 2: { var @out = new Packet(43); @out.WriteLEShort(widgetId); @out.WriteShortA(itemId); @out.WriteShortA(widgetSlot); GameContext.NetworkHandler.Write(@out); break; } case 3: { var @out = new Packet(129); @out.WriteShortA(widgetSlot); @out.WriteShort(widgetId); @out.WriteShortA(itemId); GameContext.NetworkHandler.Write(@out); break; } case 4: { var @out = new Packet(135); @out.WriteLEShort(widgetSlot); @out.WriteShortA(widgetId); @out.WriteLEShort(itemId); GameContext.NetworkHandler.Write(@out); break; } } }
public static void AddPedalsInList(List <PedalStruct> list, ActionMenu instance) { foreach (var pedalStruct in list) { PedalOption pedalOption = instance.AddOption(); switch (pedalStruct.Type) { case PedalType.Button: pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.SubMenu: pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeFolder; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.RadialPuppet: PedalRadial pedalRadial = (PedalRadial)pedalStruct; pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeRadial; pedalOption.field_Public_ActionButton_0.prop_String_1 = $"{Math.Round(pedalRadial.currentValue)}%"; pedalRadial.pedal = pedalOption; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.Toggle: PedalToggle pedalToggle = (PedalToggle)pedalStruct; pedalOption.setText(pedalStruct.text); if (pedalToggle.toggled) { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOn; } else { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOff; } pedalOption.setIcon(pedalToggle.icon); pedalToggle.pedal = pedalOption; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.FourAxisPuppet: pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeAxis; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; } } }
public void Awake() { if(log == null) { GameObject c = GameObject.Find("Main Camera"); log = c.GetComponentInChildren<Log>(); actionMenu = c.GetComponent<ActionMenu>(); } // goalPoint = actionMenu.transform.position; // goalPoint.y = transform.position.y; }
System.Collections.IEnumerator _Close() { yield return(new WaitForSeconds(0.1f)); IsOpen = false; if (!ActionMenu.instance.TradeThroughItemMenu) { ActionMenu.Open(PhaseManager.Fighter); } }
public static void Close() { instance.ClearList(); instance.menu.SetActive(false); IsOpen = false; ActionMenu.Open(PhaseManager.Fighter); Fighter = null; }
private void PlaceShipsRandomly() { InitBoard.InitializeBoard(MyGame); ShipPlacement.RandomPlacement(MyGame, false); var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseMySQL( "server=localhost;database=battleship;user=root;password=toor"); Ctx = new AppDbContext(optionsBuilder.Options); Ctx.Add(MyGame); ActionMenu.BombingMenu(MyGame, Ctx); }
public void Ini() { var action_menu_obj = GameObject.Find("ActionMenuList").GetComponentsInChildren <UnityEngine.UI.Dropdown>(); for (var index = 0; index < action_menu_obj.Length; index++) { var action_menu = new ActionMenu(); action_menu.Menu = action_menu_obj[index]; action_menu_list.Add(action_menu); action_menu.Test(); } }
public void EndTurn() { if (Unit.alignment == Unit.Alignment.Player) { ActionMenu.Close(); } TurnOver = true; mat.SetFloat("_EffectAmount", 1); UnitManager.OnUnitEnd(this); }
private void Control_KeyDown(object sender, KeyEventArgs e) { if ((e.KeyData == Keys.F12) && (dataGridView.CurrentCell is DataGridViewComboBoxCell) && (dataGridView.CurrentRow.DataBoundItem is ActionMenu)) { ActionMenu action = dataGridView.CurrentRow.DataBoundItem as ActionMenu; DataGridViewComboBoxEditingControl c = dataGridView.EditingControl as DataGridViewComboBoxEditingControl; c.SelectedItem = ReflectionHelpers.GetFieldOrProperty <ActionMenuEntry>(action.Default, dataGridView.Columns[dataGridView.CurrentCell.ColumnIndex].DataPropertyName); dataGridView.EndEdit(); } }
public static void ResetMenu(this ActionMenu actionMenu) { RadialPuppetManager.CloseRadialMenu(); FourAxisPuppetManager.CloseFourAxisMenu(); actionMenu.ClosePuppetMenus(true); for (var i = 0; i < actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0._items.Count; i++) { actionMenu.DestroyPage(actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0._items[i]); } actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0?.Clear(); actionMenu.field_Public_List_1_ObjectNPublicPaSiAcObUnique_0?.Clear(); }
private void dataGridView_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e) { if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) && (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) && (dataGridView.Rows[e.RowIndex].DataBoundItem is ActionMenu)) { ActionMenu menu = dataGridView.Rows[e.RowIndex].DataBoundItem as ActionMenu; if (menu.Default != null) { e.ToolTipText = "Default: " + menu.Default.MenuAction.ToString(); } } }
void Update() { agent.updateRotation = false; agent.destination = game.playerPosition; currentPos = ActionMenu.ConvertToWalkPos(new Vector2(this.transform.position.x, this.transform.position.z)); if (agent.velocity != Vector3.zero && Time.time > posUpdateTime) { posUpdateTime = Time.time + .1f; sender.SendCurrentPos(new Vector2(this.transform.position.x, this.transform.position.z)); } }
GetPedalOptionPrefab(this ActionMenu actionMenu) //Build 1093 menu.field_Public_GameObject_1 { if (pedalOptionPrefabProperty != null) { return((GameObject)pedalOptionPrefabProperty.GetValue(actionMenu)); } pedalOptionPrefabProperty = typeof(ActionMenu).GetProperties(BindingFlags.Public | BindingFlags.Instance) .Single( p => p.PropertyType == typeof(GameObject) && ((GameObject)p.GetValue(actionMenu)).name.Equals("PedalOption") ); return((GameObject)pedalOptionPrefabProperty.GetValue(actionMenu)); }
public override async Task ConfigureUIAsync() { await base.ConfigureUIAsync(); var textArea = new TextArea() { Text = Model.InitialText, VerticalAlignment = VerticalAlignment.Stretch }; SetContent(textArea); var readButton = new MenuButton() { Title = Strings.Read, IsEnabled = Model.FileExists, Action = async(button) => textArea.Text = await File.ReadAllTextAsync(Model.FileName) }; var writeButton = new MenuButton() { Title = Strings.Write, IsEnabled = Model.FileExists, Action = async(button) => { Alert resultAlert = null; try { await File.WriteAllTextAsync(Model.FileName, textArea.Text); readButton.IsEnabled = true; resultAlert = new Alert(Strings.FileWrittenSuccessfully, string.Empty); } catch (Exception e) { resultAlert = new Alert(e.Message, Strings.IOWriteError); } resultAlert.AddButton(new AlertButton(Strings.OK)); resultAlert.Show(); } }; Menu = new ActionMenu() { MaxDisplayItems = 2, Items = { writeButton, readButton } }; textArea.TextChanged += (o, e) => writeButton.IsEnabled = !string.IsNullOrEmpty(e.NewText); }
// Use this for initialization void Start() { battle = gameObject.GetComponent<Battle>(); enemyAIController = gameObject.GetComponent<EnemyAIController>(); actionMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>(); moveConfirmMenu = GameObject.Find("Main Camera").GetComponent<MoveConfirmMenu>(); levelStart = true; playerTurn = false; enemyTurn = false; attackMode = false; charIsMoving = false; displayAttackRange = false; previousMenu = ""; enemySelected = null; AddAllEnemies(); AddAllPlayers(); mapCam.enabled = true; battleCam.enabled = false; victory = false; defeat = false; //displayTurnText = true; //playerTurnStart = false; //enemyTurnStart = false; displayTurnTimer = displayTurnTextConst; audio.loop = true; //players = GameObject.FindGameObjectsWithTag("Player"); //cursorSelection = GameObject.Find("Cursor").GetComponent<CursorSelection>(); }
//private CursorSelection cursorSelect; // Use this for initialization void Start() { isCharSelected = false; selectedCharName = ""; actMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>(); // Initialize the ActionMenu variable to the Main Camera component gameController = GameObject.Find("GameController").GetComponent<GameController>(); /* Initialize the CharacterState variable to the component on the current character script is attached to */ charState = gameObject.GetComponent<CharacterState>(); //cursorSelect = GameObject.Find("Cursor").GetComponent<CursorSelection>(); //cursorSelect = theCursor.GetComponent<CursorSelection>(); }
public void setHovering(GameObject newHovering) { if (newHovering != null) { hovering = newHovering; hoveringTooltip = newHovering.GetComponent<Tooltip>(); hoveringActionMenu = newHovering.GetComponent<ActionMenu>(); } else { hovering = null; hoveringTooltip = null; hoveringActionMenu = null; } }
//private CharacterSelected charSelect; // References the CharacterSelected component // Use this for initialization void Start() { actionMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>(); moveConfirmMenu = GameObject.Find("Main Camera").GetComponent<MoveConfirmMenu>(); //cursorMove = GameObject.Find("Cursor").GetComponent<CursorMovement>(); emptyTileMenu = GameObject.Find("Main Camera").GetComponent<EmptyTileMenu>(); gameController = GameObject.Find("GameController").GetComponent<GameController>(); battle = GameObject.Find("GameController").GetComponent<Battle>(); //gridWorld = GameObject.Find("Grid").GetComponent<GridWorld>(); curMove = GameObject.Find("Cursor").GetComponent<CursorMovement>(); isSelected = false; moveMode = false; selectedPlayerName = ""; //charSelect = null; }
//private float Lifebar_distance_y=0; //private float Lifebar_back_distance_y=0; //-- protected virtual void Start() { audioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>(); displayMessage = GameObject.Find ("TurnManager").GetComponent<DisplayMessage> (); //Lifebar_distance_y = this.transform.position.y-Lifebar.transform.position.y; aux_d = Lifebar.GetComponent<Renderer>().bounds.size.x;//lifebar width initial_localscale = new Vector3 (Lifebar.transform.localScale.x,Lifebar.transform.localScale.y,Lifebar.transform.localScale.z); //-- circleCollider = GetComponent<CircleCollider2D> (); rb2D = GetComponent<Rigidbody2D> (); inverseMoveTime = 1f / moveTime; moved = true; isAttacking = false; attackerDamage = 0; hasMoved = false; hasAttacked = false; isdead = false; stopped = true; selected = false; newAnimation = false; myDirection = directions [0]; myPlayer = this.GetComponentInParent<Player> (); // gets the photon view of parent player class if (myPlayer == null) { // Player2 denotes enemy, still unused but can be changed later transform.gameObject.tag = "Player2"; //transform.SetParent(GameObject.FindGameObjectWithTag("Player").transform); transform.SetParent(GameObject.FindGameObjectsWithTag("Player")[1].transform); myPlayer = this.GetComponentInParent<Player> (); } GameObject go = GameObject.FindGameObjectWithTag ("Canvas"); actionMenu = (ActionMenu)go.transform.FindChild ("ActionMenu(Clone)").GetComponent<ActionMenu>(); //healthValue = 50; //TODO read in health value by calculating from level startingHealth = healthValue; }
// Use this for initialization void Start() { currentHealth = maxHealth; info = gameObject.GetComponent<VictimInfo>(); if(actionMenu == null) { actionMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>(); log = GameObject.Find("HUD").GetComponent<Log>(); } }
private void setupActionMenu() { storedTooltipBounds = tooltipBounds; storedTooltipText = hoveringTooltip.getDisplayedName(); storedActionMenu = hoveringActionMenu; for (int x = 0; x < storedActionMenu.action.Length; x++) { if (storedActionMenu.action[x].Length * BOX_CHAR_WIDTH + MENU_MARGIN > menuWidth) { menuWidth = storedActionMenu.action[x].Length * BOX_CHAR_WIDTH + MENU_MARGIN; } } menuHeight = storedActionMenu.action.Length * (BOX_CHAR_HEIGHT + mainSkin.button.padding.top + mainSkin.button.padding.bottom + mainSkin.button.margin.bottom + MENU_MARGIN); menuX = Event.current.mousePosition.x - (menuWidth * .5f); menuY = Event.current.mousePosition.y; if (menuX < 0) { menuX = 0; } else if (menuX + menuWidth > Screen.width) { menuX = Screen.width - menuWidth; } if (menuY + menuHeight > Screen.height) { menuY = Screen.height - menuHeight; } actionMenuOpen = true; }