Ejemplo n.º 1
0
    //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    //敵ジン獅子の移動------------------------------------------------------------------------------------------------------------------------------------------------------
    public void EnemySwiftCpuMove(int arrayNumber)
    {
        float Length = 0;                                                              //敵と味方の距離

        for (int i = 0; i < 5; i++)                                                    //表示されているPlayerの配列番号
        {
            if (_characterManeger.GetCharacterWalk(arrayNumber).gameObject.activeSelf) //死んでいないとき処理をする
            {
                //      Debug.Log("新出ないよ"+i);
                Length = (_characterManeger.CharacterPos(arrayNumber) - _characterManeger.CharacterPos(i)).magnitude;
                if (_mini > Length)
                {
                    _mini = Length;
                    _num  = i;
                    //	Debug.Log ("番号:"+_num);
                    _battleManger.PlayerInputisEnemyAttack(_num);
                    Attackset = true;
                }
            }
        }
        Vector2 centerToMouseVec = _characterManeger.CharacterPos(_num) - _characterManeger.CharacterPos(arrayNumber);                                                            //プレイヤーから敵までの距離
        Vector2 pointWhichIsOnTheCharacterCircle = _characterManeger.CharacterPos(arrayNumber) + centerToMouseVec.normalized * _characterManeger.CharacterPosRadius(arrayNumber); //移動範囲の円周上の点

        _characterManeger.CharacterPosMove(arrayNumber, pointWhichIsOnTheCharacterCircle);
        //Debug.Log (pointWhichIsOnTheCharacterCircle);
        _moveCheck = true;
    }