private IEnumerator UseSkill(string skillName, Transform character) { yield return(new WaitForSeconds(1.5f)); character.GetComponent <CharacterAction>().SetSkill(skillName); var f = new Vector3(40.5f, 0, 34.5f); UnitSkill unitSkill = SkillManager.GetInstance().skillQueue.Peek().Key as UnitSkill; rtsCamera.FollowTarget(f); yield return(new WaitForSeconds(0.5f)); unitSkill.Focus(f); yield return(new WaitForSeconds(0.5f)); unitSkill.Confirm(); yield return(new WaitUntil(() => { return unitSkill.complete == true; })); rtsCamera.FollowTarget(character.position); ChooseDirection chooseDirection = SkillManager.GetInstance().skillQueue.Peek().Key as ChooseDirection; yield return(null); chooseDirection.OnArrowHovered("right"); yield return(new WaitForSeconds(1f)); chooseDirection.Confirm_AI(); }
public bool BetterThanCurrent(uint index, ChooseDirection direction) { if (direction == ChooseDirection.Max) { return(_comparer.WhereGreaterThan(_current, _values[index])); } else { return(_comparer.WhereLessThan(_current, _values[index])); } }
IEnumerator turnToAI(string orientation) { ChooseDirection chooseDirection = SkillManager.GetInstance().skillQueue.Peek().Key as ChooseDirection; yield return(null); chooseDirection.OnArrowHovered(orientation); yield return(new WaitForSeconds(1f)); chooseDirection.Confirm_AI(); yield return(0); }
public IXTable Build(IXTable source, XDatabaseContext context) { ChooseDirection direction = context.Parser.NextEnum <ChooseDirection>(); IXColumn rankColumn = context.Parser.NextColumn(source, context); List <IXColumn> identityColumns = new List <IXColumn>(); do { identityColumns.Add(context.Parser.NextColumn(source, context)); } while (context.Parser.HasAnotherPart); return(new Choose(source, direction, rankColumn, identityColumns)); }
// use start since the object is not active at the begining private void Start() { // to get choose direction class chooseDirection = this.GetComponentInChildren <ChooseDirection>(); // to get renderer and default color render = this.GetComponent <Renderer>(); defaultColor = render.material.GetColor(colorPropertyId); // reset health resetAttribute(); //add audio source audioSource = this.gameObject.GetComponent <AudioSource>(); // change layer order this.gameObject.GetComponent <SpriteRenderer>().sortingOrder = 2; this.gameObject.GetComponentInChildren <TextMesh>().gameObject.GetComponent <MeshRenderer>().sortingOrder = 2; }
public static IEnumerator TurnToAI(Unit aiUnit, string orientation) { if (SkillManager.GetInstance().skillQueue.Count == 0) { aiUnit.GetComponent <CharacterAction>().SetSkill("ChooseDirection"); //for more move step } ChooseDirection chooseDirection = SkillManager.GetInstance().skillQueue.Peek().Key as ChooseDirection; yield return(0); chooseDirection.OnArrowHovered(orientation); yield return(new WaitForSeconds(1f)); chooseDirection.Confirm_AI(); yield return(0); }
public Choose(IXTable source, ChooseDirection direction, IXColumn rankColumn, IList <IXColumn> keyColumns) { if (source == null) { throw new ArgumentNullException("source"); } _source = source; // Build a typed dictionary to handle the rank and key column types _dictionary = new ChooseDictionary(direction, rankColumn.ColumnDetails, keyColumns.Select((col) => col.ColumnDetails).ToArray()); // Retrieve the getters for all columns _rankColumnGetter = rankColumn.CurrentGetter(); _keyColumnGetters = keyColumns.Select((col) => col.CurrentGetter()).ToArray(); _chosenRowsFilter = new RowRemapper(); _columns = source.Columns.Select((col) => new RemappedColumn(col, _chosenRowsFilter)).ToArray(); }
public ChooseDictionary(ChooseDirection direction, ColumnDetails rankColumn, ColumnDetails[] keyColumns, int initialCapacity = -1) { _chooseDirection = direction; _keyColumns = keyColumns; _rankColumn = rankColumn; // Create a strongly typed column for each key _keys = new IDictionaryColumn[keyColumns.Length]; for (int i = 0; i < keyColumns.Length; ++i) { _keys[i] = (IDictionaryColumn)Allocator.ConstructGenericOf(typeof(DictionaryColumn <>), keyColumns[i].Type); } // Create a strongly typed column to hold rank values _ranks = (IDictionaryColumn)Allocator.ConstructGenericOf(typeof(DictionaryColumn <>), rankColumn.Type); _bestRowIndices = (IDictionaryColumn)Allocator.ConstructGenericOf(typeof(DictionaryColumn <>), typeof(int)); // Allocate the arrays for the keys and values themselves Reset(HashCore.SizeForCapacity(initialCapacity)); }
// Initialization private void Start() { chooseDirection = GetComponentInParent <ChooseDirection>(); }