void DrawHexagon(int ringCount) { ClearUnits(); var hexagon = BattleHelper.Inst.GenerationHexagon(ringCount); foreach (var obj in hexagon) { CircleUnit cu = Instantiate(prefabCircleUnit, hexagonZone); cu.gameObject.SetActive(true); cu.transform.SetParent(hexagonZone); cu.Init(obj); cu.name = "cu_" + obj.Round + "_" + obj.HexPoint; cu.transform.position = obj.BasePosition; units.Add(cu); } List <CircleUnit> adjacentUnits = new List <CircleUnit>(); foreach (var unit in units) { var adjacents = BattleHelper.Inst.GetAdjacents(hexagon, unit.Data.HexPoint); foreach (var a in adjacents) { var au = units.Find(x => x.Data.Equals(a)); if (au != null) { adjacentUnits.Add(au); } } unit.UpdateAdjacents(adjacentUnits); adjacentUnits.Clear(); } }
public virtual void MoveTo(CircleUnit unit) { bool isFlipX = unit.Data.BasePosition.x > StandingBase.Data.BasePosition.x; Vector3 scale = spine.localScale; scale.x = Mathf.Abs(scale.x) * (isFlipX ? -1 : 1); spine.localScale = scale; skeletonAnimation.AnimationState.SetAnimation(0, AnimationAction.MoveBack, false); skeletonAnimation.AnimationState.AddAnimation(1, AnimationAction.Idle, true, 0); }
public void SetAction(EnCharacterAction action, CircleUnit targetCC) { SetAction(action, null, targetCC); }
public void SetAction(EnCharacterAction action, Character targetCharacter, CircleUnit targetCC) { this.Action = action; this.TargetCharacter = targetCharacter; this.TargetCC = targetCC; }
public void UpdateStandingBase(CircleUnit unit) { StandingBase = unit; }