コード例 #1
0
    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();
        }
    }
コード例 #2
0
    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);
    }
コード例 #3
0
 public void SetAction(EnCharacterAction action, CircleUnit targetCC)
 {
     SetAction(action, null, targetCC);
 }
コード例 #4
0
 public void SetAction(EnCharacterAction action, Character targetCharacter, CircleUnit targetCC)
 {
     this.Action          = action;
     this.TargetCharacter = targetCharacter;
     this.TargetCC        = targetCC;
 }
コード例 #5
0
 public void UpdateStandingBase(CircleUnit unit)
 {
     StandingBase = unit;
 }