Пример #1
0
    void OnDragging(DragInfo dragInfo)
    {
        //タイル上
        var targetPosition = TileBase.GetArrayFromRay(dragInfo.pos);

        if (targetPosition == null)
        {
            return;
        }
        //まだ未通過
        if (IntVect2D.IsEqual(targetPosition, nowTraceTiles.LastOrDefault()))
        {
            return;
        }
        //まだ未完成
        if (skillTiles.Count == nowTraceTiles.Count)
        {
            return;
        }

        //次のタイル
        if (IntVect2D.IsEqual(targetPosition, IntVect2D.Add(skillTiles[nowTraceTiles.Count], nowTraceTiles[0])) == false)
        {
            FailAciton();
            return;
        }

        nowTraceTiles.Add(targetPosition);
        BattleStage.Instance.ChangeColor(targetPosition, TileState.Skill);
    }
Пример #2
0
        //実際に移動
        protected void UpdatePosition(IntVect2D newPosition)
        {
            //移動方向
            var direction = IntVect2D.GetDirection(character.positionArray, newPosition);
            //移動先のタイル位置
            var toTilePostion = BBattleStage.Instance.GetTileXAndZPosition(newPosition);
            var table         = GetMoveTable(toTilePostion);

            //現在のタイルの実座標
            var oldTilePosition = BBattleStage.Instance.GetTileXAndZPosition(character.positionArray);

            //カメラをアップデート
            BCameraMove.Instance.FollowCharacter(toTilePostion - oldTilePosition, animator.moveTime);

            //座標変更
            iTween.MoveTo(gameObject, table);

            isDone      = true;
            isNowAction = true;

            //配列値変更
            character.positionArray = newPosition;

            StartRotateAnimation(direction);
            StartAnimation();


            UpdateInManualState();
            //UI
            UIBottomCommandParent.UICommandState = EUICommandState.Action;
            UIBottomAllParent.Instance.UpdateUI();
        }
Пример #3
0
        public void OnEndDrag(PointerEventData e)
        {
            //タイルの取得
            var tile=GameObject.FindGameObjectsWithTag("Tile")
                .Where(x=>RectTransformUtility.RectangleContainsScreenPoint(x.GetComponent<RectTransform>(),e.position)==true
                    &&x.GetComponent<ETile>().isAttachable==true)
                .Select(x=>x.GetComponent<ETile>())
                .FirstOrDefault();

            //タイル外
            if (tile == null) {
                                rectTransform.position = oldPosition;
                return;
            }
                        //他キャラクターの取得
                        var otherTile=GameObject.FindGameObjectsWithTag("Edit/Character")
                .Where(x=>x.GetComponent<ECharacterIcon>().vect2D==tile.vect)
                .FirstOrDefault();

            //既にいる
            if(otherTile!=null){
                rectTransform.position = oldPosition;
                return;
            }

            rectTransform.position = CSTransform.CopyVector3(tile.GetComponent<RectTransform>().position);
            oldPosition = CSTransform.CopyVector3(rectTransform.position);
            vect2D = tile.vect;
        }
Пример #4
0
        public void OnEndDrag(PointerEventData e)
        {
            //タイルの取得
            var tile = GameObject.FindGameObjectsWithTag("Tile")
                       .Where(x => RectTransformUtility.RectangleContainsScreenPoint(x.GetComponent <RectTransform>(), e.position) == true &&
                              x.GetComponent <ETile>().isAttachable == true)
                       .Select(x => x.GetComponent <ETile>())
                       .FirstOrDefault();

            //タイル外
            if (tile == null)
            {
                rectTransform.position = oldPosition;
                return;
            }
            //他キャラクターの取得
            var otherTile = GameObject.FindGameObjectsWithTag("Edit/Character")
                            .Where(x => x.GetComponent <ECharacterIcon>().vect2D == tile.vect)
                            .FirstOrDefault();

            //既にいる
            if (otherTile != null)
            {
                rectTransform.position = oldPosition;
                return;
            }


            rectTransform.position = CSTransform.CopyVector3(tile.GetComponent <RectTransform>().position);
            oldPosition            = CSTransform.CopyVector3(rectTransform.position);
            vect2D = tile.vect;
        }
Пример #5
0
    //なぞり開始
    void OnDraggingStart(DragInfo dragInfo)
    {
        isNowAttackable = false;
        //タイル上
        var tilePosition = TileBase.GetArrayFromRay(dragInfo.pos);

        if (tilePosition == null)
        {
            return;
        }

        //キャラクターの上
        if (IntVect2D.IsEqual(tilePosition, character.positionArray) == false)
        {
            return;
        }
        BattleStage.Instance.ResetAllTileColor();

        nowTraceTiles = new List <IntVect2D>();
        nowTraceTiles.Add(tilePosition);
        BattleStage.Instance.ChangeColor(tilePosition, TileState.Skill);

        IT_Gesture.onDraggingE    += OnDragging;
        IT_Gesture.onDraggingEndE += OnDraggingEnd;
        isNowCharge = true;
        ActionSelect.Instance.DisableMoveAttackButton();
    }
        //攻撃範囲に近づくように移動
        void MoveForApproach()
        {
            var toVect2D = new IntVect2D[] {
                new IntVect2D(movableCount, 0),
                new IntVect2D(-movableCount, 0),
                new IntVect2D(0, movableCount),
                new IntVect2D(0, -movableCount)
            };

            toVect2D = toVect2D.Shuffle();
            List <VectAndDistance> vectAndDistance = new List <VectAndDistance>();

            //各移動後における攻撃範囲と敵キャラとの最小距離取得
            foreach (var toV in toVect2D)
            {
                vectAndDistance.Add(new VectAndDistance(GetDistanceInAttackRange(IntVect2D.Add(character.positionArray, toV)), toV));
            }

            //距離が小さい順に移動試行
            foreach (var toV in vectAndDistance.OrderBy(v => v.distance).Select(v => v.vect))
            {
                RequestMoveFromVect2D(toV);
                if (isDone == true)
                {
                    break;
                }
            }
        }
        void RandamMove()
        {
            var toVect2D = new IntVect2D[] {
                new IntVect2D(movableCount, 0),
                new IntVect2D(-movableCount, 0),
                new IntVect2D(0, movableCount),
                new IntVect2D(0, -movableCount)
            };

            //移動可能範囲を取得
            toVect2D = toVect2D.Shuffle();
            foreach (var toV in toVect2D)
            {
                RequestMoveFromVect2D(toV);
                if (isDone == true)
                {
                    break;
                }
            }
            if (isDone == false)
            {
                isDone = true;
                if (OnCompleteMove != null)
                {
                    OnCompleteMove();
                }
            }
        }
        //攻撃範囲と敵キャラとの距離
        float GetDistanceInAttackRange(IntVect2D position)
        {
            //攻撃可能位置の設定
            var attackablePosition = attackParameter.attackRanges.Select(x => IntVect2D.Add(x, position)).ToList();

            //攻撃取得失敗
            if (attackablePosition == null)
            {
                return(-1);
            }

            //攻撃可能位置にいるキャラクターとの距離,不可能=100
            float distance = 100;

            foreach (var pos in attackablePosition)
            {
                //攻撃位置と敵キャラとの距離比較
                //最小を設定
                var dis = BCharacterManager.Instance.GetOpponentCharacters(character.isEnemy)
                          .Min(x => IntVect2D.Distance(x.positionArray, pos));
                distance = Mathf.Min(distance, dis);
            }
            //一番近い位置がターゲット
            return(distance);
        }
Пример #9
0
    void OnDragging(DragInfo dragInfo)
    {
        //もうなぞれない
        if (nowTraceTiles.Count == moveRange)
        {
            return;
        }

        //タイル上
        var tilePosition = TileBase.GetArrayFromRay(dragInfo.pos);

        if (tilePosition == null)
        {
            return;
        }
        //まだ未通過
        if (IntVect2D.IsEqual(tilePosition, nowTraceTiles.LastOrDefault()))
        {
            return;
        }
        //まだ未完成
        if (moveRange == nowTraceTiles.Count)
        {
            return;
        }

        //次のタイル
        if (IntVect2D.IsNeighbor(tilePosition, nowTraceTiles.LastOrDefault()) == false)
        {
            return;
        }

        nowTraceTiles.Add(tilePosition);
        BattleStage.Instance.ChangeColor(tilePosition, TileState.Skill);
    }
Пример #10
0
        public override void Init(IntVect2D array)
        {
            base.Init(array);
            isEnemy = false;

            OnActivePlayerE += BCharacterManager.Instance.SetActivePlayer;
        }
Пример #11
0
        bool SetTarget()
        {
            //攻撃可能位置の設定
            var attackablePosition = selectAttackParameter.attackRanges.Select(x => IntVect2D.Add(x, character.positionArray)).ToList();

            if (attackablePosition == null)
            {
                return(false);
            }
            //デバッグ出力
            //攻撃可能位置にいるキャラクター
            var opponentCharacters = new List <BCharacterBase>();

            foreach (var pos in attackablePosition)
            {
                var chara = BCharacterManager.Instance.GetOpponentCharacterOnTileFormVect2D(pos, character.isEnemy);
                if (chara != null)
                {
                    opponentCharacters.Add(chara);
                }
            }
            if (opponentCharacters.Count == 0)
            {
                return(false);
            }

            //一番近い位置がターゲット
            attackTarget.Add(opponentCharacters.OrderBy(c => IntVect2D.Distance(c.positionArray, character.positionArray)).First());
            return(true);
        }
Пример #12
0
        void OnDragging(DragInfo dragInfo)
        {
            //もうなぞれない
            if (nowTraceTiles.Count == selectAttackParameter.moveRange)
            {
                return;
            }

            //タイル上
            var tilePosition = BBattleStage.Instance.GetTilePositionFromScreenPosition(dragInfo.pos);

            if (tilePosition == null)
            {
                return;
            }
            //まだ未通過
            if (IntVect2D.IsEqual(tilePosition, nowTraceTiles.LastOrDefault()))
            {
                return;
            }
            //まだ未完成
            if (selectAttackParameter.moveRange == nowTraceTiles.Count)
            {
                return;
            }

            //次のタイル
            if (IntVect2D.IsNeighbor(tilePosition, nowTraceTiles.LastOrDefault()) == false)
            {
                return;
            }

            nowTraceTiles.Add(tilePosition);
            BBattleStage.Instance.ChangeColor(tilePosition, TileState.Skill);
        }
Пример #13
0
        void StartRotateAnimation(IntVect2D vect)
        {
            float angleX       = vect.x * 90;
            float angleY       = Mathf.Sign(vect.y) > 0 ? 0 : 180;
            float isEnemyAngle = character.isEnemy == false ? 1 : -1;

            transform.eulerAngles = new Vector3(0, angleX + isEnemyAngle * angleY, 0);
        }
Пример #14
0
        public override void Init(IntVect2D array)
        {
            base.Init(array);
            isEnemy = false;


            OnActivePlayerE += BCharacterManager.Instance.SetActivePlayer;
        }
Пример #15
0
        //一連の移動判定処理の開始
        void RequestMove(Vector2 delta)
        {
            //カメラから方向取得
            var toVect = BCameraMove.Instance.GetMoveDirection(delta);
            //Vect2D化
            var toVect2D = IntVect2D.GetDirectionFromVector2(toVect);

            RequestMoveFromVect2D(toVect2D);
        }
Пример #16
0
        public override void Init(IntVect2D array)
        {
            base.Init(array);
            isEnemy = true;

            //回転
            transform.rotation = Quaternion.Euler(0, 180, 0);
            OnActiveEnemyE += BCharacterManager.Instance.SetActiveEnemy;
        }
Пример #17
0
        public virtual void Init(IntVect2D array)
        {
            positionArray.x = array.x;
            positionArray.y = array.y;

            //ライフ設定
            life.Init(characterParameter);
            OnEndActiveStaticE += BCharacterManager.Instance.ResetActiveCharacter;
        }
Пример #18
0
        public override void Init(IntVect2D array)
        {
            base.Init(array);
            isEnemy = true;

            //回転
            transform.rotation = Quaternion.Euler(0, 180, 0);
            OnActiveEnemyE    += BCharacterManager.Instance.SetActiveEnemy;
        }
Пример #19
0
        //タイルのVect2Dを返す
        public IntVect2D GetTilePosition(IntVect2D position)
        {
            var tile = GetTile(position);

            if (tile == null)
            {
                return(null);
            }
            return(GetTile(position).positionArray);
        }
Пример #20
0
 public void Init(IntVect2D array, bool isEne)
 {
     isEnemy = isEne;
     if (isEnemy == true)
     {
         transform.rotation = Quaternion.Euler(0, 180, 0);
     }
     positionArray.x = array.x;
     positionArray.y = array.y;
 }
Пример #21
0
 //攻撃選択
 public void OnSlectWaza(BCharacterBase chara, SingleAttackParameter selectWaza)
 {
     ResetAllTileColor();
     //攻撃範囲取得
     foreach (var range in selectWaza.attackRanges)
     {
         var pos = IntVect2D.Clone(chara.positionArray);
         pos = IntVect2D.Add(pos, range);
         ChangeColor(pos, TileState.Attack);
     }
 }
Пример #22
0
 public void Init(IntVect2D v, bool _isAttachable, ETileCreater _tileCreater)
 {
     vect         = v;
     tileCreater  = _tileCreater;
     isAttachable = _isAttachable;
     if (isAttachable == true)
     {
         var sprite = GetComponent <Image>();
         sprite.sprite = Resources.Load <Sprite>("EditScene/mass_attack_sprite");
     }
 }
Пример #23
0
 public void ChangeTilesColorFromDistance(IntVect2D position, TileState toState, float distance, bool reset = false)
 {
     if (reset)
     {
         ResetAllTileColor();
     }
     foreach (var tile in GetTilesFormDistance(position, distance))
     {
         tile.ChangeColor(toState);
     }
 }
Пример #24
0
 //上下左右のタイル色変更
 public void ChangeNeighborTilesColor(IntVect2D position, TileState toState, bool reset = false)
 {
     if (reset)
     {
         ResetAllTileColor();
     }
     foreach (var tile in GetVerticalHorizontalTiles(position))
     {
         tile.ChangeColor(toState);
     }
 }
Пример #25
0
 public void Init(IntVect2D v, bool _isAttachable, ETileCreater _tileCreater)
 {
     vect = v;
     tileCreater = _tileCreater;
     isAttachable = _isAttachable;
     if (isAttachable == true)
     {
         var sprite = GetComponent<Image>();
         sprite.sprite = Resources.Load<Sprite>("EditScene/mass_attack_sprite");
     }
 }
Пример #26
0
        //実際に移動
        void UpdatePosition(IntVect2D newPosition)
        {
            //移動先のタイル位置
            var toTilePostion = BBattleStage.Instance.GetTileXAndZPosition(newPosition);
            var table         = GetMoveTable(toTilePostion);

            //座標変更
            iTween.MoveTo(gameObject, table);


            //配列値変更
            character.positionArray = newPosition;
        }
Пример #27
0
        //一連の移動判定処理の開始
        public void RequestMoveFromVect2D(IntVect2D toVect2D)
        {
            //新しいタイルポジション
            var newPosition = new IntVect2D(
                Mathf.Clamp(character.positionArray.x + toVect2D.x, -BBattleStage.stageSizeX, BBattleStage.stageSizeX),
                Mathf.Clamp(character.positionArray.y + toVect2D.y, -BBattleStage.stageSizeY, BBattleStage.stageSizeY));

            //移動先が空いている
            if (BCharacterManager.Instance.IsExistCharacterOnTile(newPosition) == true) return;

            //移動実行
            UpdatePosition(newPosition);
        }
Пример #28
0
        public void ChangeColor(IntVect2D position, TileState state, bool reset = false)
        {
            if (reset)
            {
                ResetAllTileColor();
            }
            var tile = GetTile(position);

            if (tile == null)
            {
                return;
            }
            tile.ChangeColor(state);
        }
Пример #29
0
        //Vect2Dからキャラクター取得
        public BCharacterBase GetCharacterOnTile(IntVect2D vect)
        {
            //タイル以外
            if (vect == null)
            {
                return(null);
            }
            //ターゲットの検索
            var target = GetCharacterFromVect2D(vect);

            ////ターゲットが存在しないマスをタップ
            //if (target == null) return null;
            return(target);
        }
Пример #30
0
        //タイル上のキャラが自身にとっての敵キャラなら取得
        public BCharacterBase GetOpponentCharacterOnTileFormVect2D(IntVect2D toPos, bool isEnemy)
        {
            var chara = GetCharacterOnTile(toPos);

            if (chara == null)
            {
                return(null);
            }
            if (chara.isEnemy != isEnemy)
            {
                return(chara);
            }
            return(null);
        }
Пример #31
0
        //一連の移動判定処理の開始
        public void RequestMoveFromVect2D(IntVect2D toVect2D)
        {
            //新しいタイルポジション
            var newPosition = new IntVect2D(
                Mathf.Clamp(character.positionArray.x + toVect2D.x, -BBattleStage.stageSizeX, BBattleStage.stageSizeX),
                Mathf.Clamp(character.positionArray.y + toVect2D.y, -BBattleStage.stageSizeY, BBattleStage.stageSizeY));

            //移動先が空いている
            if (BCharacterManager.Instance.IsExistCharacterOnTile(newPosition) == true)
            {
                return;
            }

            //移動実行
            UpdatePosition(newPosition);
        }
Пример #32
0
    //タイル上のキャラを取得
    //呼ばれる場所の統一化が必要
    public static Character GetCharacterOnTile(IntVect2D toPos)
    {
        var objects    = GameObject.FindGameObjectsWithTag("BattleCharacter");
        var characters = new List <Character>();

        Debug.Log(objects.Length);
        foreach (var obj in objects)
        {
            if (obj == null)
            {
                Debug.Log("Error");
            }
            else
            {
                characters.Add(obj.GetComponent <Character>());
            }
        }
        Debug.Log(objects.Length);
        foreach (var ob in objects)
        {
            Debug.Log(ob.name);
        }

        foreach (var obj in characters)
        {
            if (IntVect2D.IsEqual(obj.positionArray, toPos) == true)
            {
                return(obj);
            }
        }
        return(null);
        //Linqが止まる原因か検証

        /*
         * return GameObject.FindGameObjectsWithTag("BattleCharacter").
         * Select(t => t.GetComponent<Character>()).
         * Where(t => IntVect2D.IsEqual(toPos, t.positionArray)).
         * FirstOrDefault();
         */
    }
Пример #33
0
        //なぞり開始
        void OnDraggingStart(DragInfo dragInfo)
        {
            if (isDone == true)
            {
                return;
            }
            //タイル上
            var tilePosition = BBattleStage.Instance.GetTilePositionFromScreenPosition(dragInfo.pos);

            if (tilePosition == null)
            {
                return;
            }

            //キャラクターの上
            if (IntVect2D.IsEqual(tilePosition, character.positionArray) == false)
            {
                return;
            }
            BBattleStage.Instance.ResetAllTileColor();

            nowTraceTiles = new List <IntVect2D>();
            nowTraceTiles.Add(tilePosition);
            foreach (var target in attackTarget)
            {
                target.SetTargeted(false);
            }
            attackTarget = new List <BCharacterBase>();

            UIBottomCommandParent.UICommandState = EUICommandState.ExecuteAttack;
            UIBottomCommandParent.Instance.UpdateUI();
            //タイル
            BBattleStage.Instance.OnSelecSkillTarget(tilePosition);

            IT_Gesture.onDraggingE    += OnDragging;
            IT_Gesture.onDraggingEndE += OnDraggingEnd;
            //ActionSelect.Instance.DisableMoveAttackButton();
        }
        //移動後攻撃範囲にいたら移動
        bool TryMoveInAttackRange()
        {
            var toVect2D = new IntVect2D[] {
                new IntVect2D(movableCount, 0),
                new IntVect2D(-movableCount, 0),
                new IntVect2D(0, movableCount),
                new IntVect2D(0, -movableCount)
            };

            //移動可能範囲を取得
            toVect2D = toVect2D.Shuffle();
            foreach (var toV in toVect2D)
            {
                if (CheckExistInAttackRange(IntVect2D.Add(character.positionArray, toV)))
                {
                    RequestMoveFromVect2D(toV);
                }
                if (isDone == true)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #35
0
 void RandamMove()
 {
     var toVect2D = new IntVect2D[] {
         new IntVect2D(movableCount, 0),
         new IntVect2D(-movableCount, 0),
         new IntVect2D(0, movableCount),
         new IntVect2D(0, -movableCount)
     };
     //移動可能範囲を取得
     toVect2D = toVect2D.Shuffle();
     foreach (var toV in toVect2D)
     {
         RequestMoveFromVect2D(toV);
         if (isDone == true)
         {
             break;
         }
     }
     if (isDone == false)
     {
         isDone = true;
         if (OnCompleteMove != null) OnCompleteMove();
     }
 }
Пример #36
0
        //攻撃範囲に近づくように移動
        void MoveForApproach()
        {
            var toVect2D = new IntVect2D[] {
                new IntVect2D(movableCount, 0),
                new IntVect2D(-movableCount, 0),
                new IntVect2D(0, movableCount),
                new IntVect2D(0, -movableCount)
            };

            toVect2D = toVect2D.Shuffle();
            List<VectAndDistance> vectAndDistance = new List<VectAndDistance>();
            //各移動後における攻撃範囲と敵キャラとの最小距離取得
            foreach (var toV in toVect2D)
            {
                vectAndDistance.Add(new VectAndDistance(GetDistanceInAttackRange(IntVect2D.Add(character.positionArray, toV)), toV));
            }

            //距離が小さい順に移動試行
            foreach (var toV in vectAndDistance.OrderBy(v => v.distance).Select(v=>v.vect))
            {
                RequestMoveFromVect2D(toV);
                if (isDone == true)
                {
                    break;
                }

            }
        }
Пример #37
0
        //実際に移動
        void UpdatePosition(IntVect2D newPosition)
        {
            //移動先のタイル位置
            var toTilePostion = BBattleStage.Instance.GetTileXAndZPosition(newPosition);
            var table = GetMoveTable(toTilePostion);

            //座標変更
            iTween.MoveTo(gameObject, table);

            //配列値変更
            character.positionArray = newPosition;
        }
 bool IsInAttackRange(IntVect2D targetPositionArray)
 {
     return selectAttackParameter.attackRanges.Any(x => x.IsEqual(IntVect2D.Sub(targetPositionArray, character.positionArray)));
 }
Пример #39
0
    public void Init(IntVect2D array, bool isEne)
    {
        isEnemy = isEne;
        if (isEnemy == true)
        {
            transform.rotation = Quaternion.Euler(0, 180, 0);

        }
        positionArray.x = array.x;
        positionArray.y = array.y;
    }
Пример #40
0
    //タイル上のキャラを取得
    //呼ばれる場所の統一化が必要
    public static Character GetCharacterOnTile(IntVect2D toPos)
    {
        var objects = GameObject.FindGameObjectsWithTag("BattleCharacter");
        var characters=new List<Character>();

        Debug.Log(objects.Length);
        foreach (var obj in objects)
        {
            if (obj == null)
            {

                Debug.Log("Error");
            }
            else
            {
                characters.Add(obj.GetComponent<Character>());
            }
        }
        Debug.Log(objects.Length);
        foreach (var ob in objects)
        {
            Debug.Log(ob.name);
        }

        foreach (var obj in characters)
        {
            if (IntVect2D.IsEqual(obj.positionArray, toPos) == true)
            {
                return obj;
            }
        }
        return null;
        //Linqが止まる原因か検証
        /*
        return GameObject.FindGameObjectsWithTag("BattleCharacter").
        Select(t => t.GetComponent<Character>()).
        Where(t => IntVect2D.IsEqual(toPos, t.positionArray)).
        FirstOrDefault();
         */
    }
Пример #41
0
 //移動後攻撃範囲にいたら移動
 bool TryMoveInAttackRange()
 {
     var toVect2D = new IntVect2D[] {
         new IntVect2D(movableCount, 0),
         new IntVect2D(-movableCount, 0),
         new IntVect2D(0, movableCount),
         new IntVect2D(0, -movableCount)
     };
     //移動可能範囲を取得
     toVect2D = toVect2D.Shuffle();
     foreach (var toV in toVect2D)
     {
         if (CheckExistInAttackRange(IntVect2D.Add(character.positionArray,toV)))
         {
             RequestMoveFromVect2D(toV);
         }
         if (isDone == true)return true;
     }
     return false;
 }
Пример #42
0
 //攻撃範囲に敵がいる
 bool CheckExistInAttackRange(IntVect2D position)
 {
     return GetDistanceInAttackRange(position) == 0;
 }
Пример #43
0
 //ターゲット解除
 public void OnCancelSkillTarget(IntVect2D targetPosition)
 {
     ChangeColor(targetPosition, TileState.Default);
 }
Пример #44
0
 void StartRotateAnimation(IntVect2D vect)
 {
     float angleX = vect.x * 90;
     float angleY = Mathf.Sign(vect.y) > 0 ? 0 : 180;
     float isEnemyAngle = character.isEnemy == false ? 1 : -1;
     transform.eulerAngles = new Vector3(0, angleX + isEnemyAngle * angleY, 0);
 }
Пример #45
0
        public virtual void Init(IntVect2D array)
        {
            positionArray.x = array.x;
            positionArray.y = array.y;

            //ライフ設定
            life.Init(characterParameter);
            OnEndActiveStaticE += BCharacterManager.Instance.ResetActiveCharacter;
        }
Пример #46
0
 // Use this for initialization
 void Start()
 {
     vect2D = new IntVect2D(IntVect2D.nullNumber, IntVect2D.nullNumber);
     rectTransform = GetComponent<RectTransform>();
     oldPosition = CSTransform.CopyVector3(rectTransform.position);
 }
Пример #47
0
 public VectAndDistance(float dis, IntVect2D v)
 {
     distance = dis;
     vect = v;
 }
Пример #48
0
 public void Init(IntVect2D array)
 {
     positionArray.x = array.x;
     positionArray.y = array.y;
 }
Пример #49
0
        //攻撃範囲と敵キャラとの距離
        float GetDistanceInAttackRange(IntVect2D position)
        {
            //攻撃可能位置の設定
            var attackablePosition = attackParameter.attackRanges.Select(x => IntVect2D.Add(x, position)).ToList();
            //攻撃取得失敗
            if (attackablePosition == null) return -1;

            //攻撃可能位置にいるキャラクターとの距離,不可能=100
            float distance = 100;
            foreach (var pos in attackablePosition)
            {
                //攻撃位置と敵キャラとの距離比較
                //最小を設定
                var dis=BCharacterManager.Instance.GetOpponentCharacters(character.isEnemy)
                    .Min(x => IntVect2D.Distance(x.positionArray, pos));
                distance = Mathf.Min(distance, dis);
            }
            //一番近い位置がターゲット
            return distance;
        }
Пример #50
0
        //実際に移動
        protected void UpdatePosition(IntVect2D newPosition)
        {
            //移動方向
            var direction = IntVect2D.GetDirection(character.positionArray, newPosition);
            //移動先のタイル位置
            var toTilePostion = BBattleStage.Instance.GetTileXAndZPosition(newPosition);
            var table = GetMoveTable(toTilePostion);

            //現在のタイルの実座標
            var oldTilePosition = BBattleStage.Instance.GetTileXAndZPosition(character.positionArray);
            //カメラをアップデート
            BCameraMove.Instance.FollowCharacter(toTilePostion - oldTilePosition, animator.moveTime);

            //座標変更
            iTween.MoveTo(gameObject, table);

            isDone = true;
            isNowAction = true;

            //配列値変更
            character.positionArray = newPosition;

            StartRotateAnimation(direction);
            StartAnimation();

            UpdateInManualState();
            //UI
            UIBottomCommandParent.UICommandState = EUICommandState.Action;
            UIBottomAllParent.Instance.UpdateUI();
        }