public override void OnStart() { wizardKing = GetComponentInChildren <WizardKing>(); transformersInGame.ForEach(transformerInGame => transformerInGame.AddEventListener(this.gameObject)); wizardKing.AddEventListener(this.gameObject); characterPicker = GetComponentInChildren <CharacterPicker>(); characterPicker.AddEventListener(this.gameObject); characterPicker.SetTotalAmountOfTransformers(transformersInGame.Count); int extraSavedLives = SaveUtil.LoadData(); livesOutput.text = transformersInGame.Count + extraSavedLives + ""; livesSaved = transformersInGame.Count + extraSavedLives; if (cutSceneManagerToPlayAtStart) { cutSceneManagerToPlayAtStart.AddEventListener(this.gameObject); cutSceneManagerToPlayAtStart.StartCutScene(true); } else { Invoke("InitiateCharacterPickerDelayed", .6f); } }
public void Init() { cPicker = transform.GetComponentInParent <CharacterPicker>(); myButton.onClick.RemoveAllListeners(); myButton.onClick.AddListener(() => { cPicker.SelectSlot(this); }); LockedUI.onClick.RemoveAllListeners(); LockedUI.onClick.AddListener(() => { cPicker.BuyAdditionalSlots(); }); }
void Awake() { // Singleton if (instance == null) { instance = this; } else if (instance != this) { Destroy (gameObject); } DontDestroyOnLoad(gameObject); }
// public void OnPointerClick(PointerEventData pData) // { // //Debug.Log("!!!!"); // cPicker.SelectSlot(this); // } // public void Init() { this.cPicker = (CharacterPicker)this.transform.GetComponentInParent <CharacterPicker>(); myButton.onClick.RemoveAllListeners(); myButton.onClick.AddListener(() => { cPicker.SelectSlot(this); }); //slotButton.onClick.AddListener((p) => {this.OnPointerClick(p);}); LockedUI.onClick.RemoveAllListeners(); LockedUI.onClick.AddListener(() => { cPicker.BuyAdditionalSlots(); }); }
void Awake() { // Singleton if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
// LIST TO DISPLAY IN INSPECTOR //public List<Button> characterButtonList = new List<Button> (); void Awake() { instance = this; //characterPanel.SetActive (true); Button[] buttons = characterPanel.transform.GetComponentsInChildren <Button> (); foreach (Button btn in buttons) { characterNameToButtonDict.Add(btn.name, btn); // LIST TO DISPLAY IN INSPECTOR //characterButtonList.Add (btn); Debug.Log("Character added to dictionary: " + btn.name + ""); btn.onClick.AddListener(delegate { SelectCharacter(btn); }); } characterIconImg = gameObject.transform.Find("CharacterIcon").GetComponent <Image> (); Debug.LogWarning(characterIconImg.name); }
public override void Start() { MoveButton.onClick.AddListener(() => SetState(ControllerState.Moving)); AttackButton.onClick.AddListener(() => SetState(ControllerState.Atttacking)); CancelButton.onClick.AddListener(() => SetState(ControllerState.ModePicking)); MoveOrder = 0; team = UnitTeam.Player; base.Start(); foreach (GameObject u in Units) { CharacterPicker picker = u.GetComponent <CharacterPicker>(); picker.OnCharacterPicked.AddListener((CharacterPicker p) => this.PickUnit(p.gameObject)); } GridController.GetGridController().GetTiles().ForEach( (Tile t) => t.OnClicked.AddListener((Tile tt) => PickTile(tt)) ); // SetState(ControllerState.ModePicking); }
public KeyboardController(CharacterPicker characterPicker) { this.characterPicker = characterPicker; keys = characterPicker.keyBoard.MakeKeyList(); }