예제 #1
0
    // f:弾生成時にパラメータを渡すことができるInstantiate関数
    public static Bullet Instantiate(Bullet _bullet, BulletParam _param, Transform _transform)
    {
        Bullet bullet = Instantiate(_bullet, _transform.position + _param.initialPosition, _transform.rotation) as Bullet;

        SetupBullet(bullet, _param, _transform);
        return(bullet);
    }
예제 #2
0
        public void ShotStraightBullet(BulletParam param, ICharacterUnit owner, Vector3 pos)
        {
            var bullet = GetStraightBullet(pos);

            bullet.SetBulletInfo(param);
            bullet.Owner = owner;
        }
예제 #3
0
 protected override void OnInvoke()
 {
     base.OnInvoke();
     Targets = GameManager.instance.EnemyManager.GetInRangeEnemys(Owner.Trans.position, 10);
     foreach (var target in Targets)
     {
         var param = new BulletParam()
         {
             Power     = 10000,
             Speed     = 50f,
             Range     = 50f,
             Direction = (target.Trans.position - Owner.Trans.position).normalized
         };
         GameManager.instance.BulletManager.ShotStraightBullet(param, Owner, Owner.Trans.position);
     }
 }
예제 #4
0
 protected override void OnInvoke()
 {
     base.OnInvoke();
     CreateTargetList();
     if (Target != null)
     {
         var param = new BulletParam()
         {
             Power     = 10000,
             Speed     = 100f,
             Range     = 50f,
             Direction = (Target.Trans.position - Owner.Trans.position).normalized
         };
         GameManager.instance.BulletManager.ShotStraightBullet(param, Owner, Owner.Trans.position);
     }
 }
예제 #5
0
    protected static void SetupBullet(Bullet _bullet, BulletParam _param, Transform _transform)
    {
        // f:パラメータとPlayerクラスの取得
        _bullet.param  = _param;
        _bullet.player = _transform.GetComponent <Player>();

        // f:レイヤー設定
        _bullet.gameObject.layer = LayerName.Default;
        foreach (Transform c_transform in _bullet.transform)
        {
            c_transform.gameObject.layer = LayerName.BulletPlayer;
        }

        // f:タグ設定

        // f:エリア設定
        GameManager.SetArea(_bullet.gameObject, _bullet.player.playerSlot);
    }
예제 #6
0
 protected override void OnUpdate()
 {
     base.OnUpdate();
     _elapsedTime += Time.deltaTime;
     if (_elapsedTime > 2f)
     {
         for (int i = 0; i < 8; i++)
         {
             var param = new BulletParam()
             {
                 Power     = 50,
                 Speed     = 5f,
                 Range     = 20f,
                 Direction = Quaternion.AngleAxis(i * 45, Vector3.up) * Vector3.forward
             };
             GameManager.instance.BulletManager.ShotStraightBullet(param, this, transform.position);
         }
         _elapsedTime = 0f;
     }
 }
예제 #7
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        ShotManager shotManager = target as ShotManager;
        BulletParam param       = shotManager.param;

        switch (param.shotMode)
        {
        case ShotMode.SimpleShot:
            //EditorGUILayout.HelpBox("", MessageType.Info, true);
            break;

        case ShotMode.ChargeShot:
            //EditorGUILayout.HelpBox("", MessageType.Info, true);
            break;

        case ShotMode.LimitShot:
            //EditorGUILayout.HelpBox("", MessageType.Info, true);
            break;
        }

        EditorGUILayout.LabelField("共通パラメータ");
        EditorGUI.indentLevel++;
        param.name = EditorGUILayout.TextField("ショット名", param.name);

        EditorGUILayout.Space();

        shotManager.buttonCode = (ButtonCode)EditorGUILayout.EnumPopup("入力キー", shotManager.buttonCode);
        shotManager.bullet     = EditorGUILayout.ObjectField("Bulletクラス", shotManager.bullet, typeof(Bullet), true) as Bullet;
        param.shotSound        = EditorGUILayout.ObjectField("ショット音", param.shotSound, typeof(AudioClip), true) as AudioClip;

        EditorGUILayout.Space();

        var speed = serializedObject.FindProperty("param.speed");

        param.shotDelay       = EditorGUILayout.FloatField("ショット間隔", param.shotDelay);
        param.lifeTime        = EditorGUILayout.FloatField("弾丸の生存時間", param.lifeTime);
        speed.floatValue      = EditorGUILayout.FloatField("弾丸の速度", speed.floatValue);
        param.power           = EditorGUILayout.FloatField("攻撃力", param.power);
        param.isPenetrate     = EditorGUILayout.Toggle("貫通性", param.isPenetrate);
        param.initialPosition = EditorGUILayout.Vector3Field("ローカル初期位置", param.initialPosition);
        param.initialRotation = Quaternion.Euler(EditorGUILayout.Vector3Field("ローカル初期角度", param.initialRotation.eulerAngles));

        EditorGUI.indentLevel--;
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("分岐パラメータ");
        EditorGUI.indentLevel++;
        param.shotMode = (ShotMode)EditorGUILayout.EnumPopup("ショットの種類", param.shotMode);

        switch (param.shotMode)
        {
        case ShotMode.SimpleShot:
            break;

        case ShotMode.ChargeShot:
            param.chargeTime   = EditorGUILayout.FloatField("チャージ時間", param.chargeTime);
            param.rechargeTime = EditorGUILayout.FloatField("リチャージ時間", param.rechargeTime);

            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("ゲージ");
            EditorGUI.indentLevel++;

            param.gage.barType    = (GageBarType)EditorGUILayout.EnumPopup("ゲージバー", param.gage.barType);
            param.gage.effectType = (GageEffectType)EditorGUILayout.EnumPopup("ゲージ描画方法", param.gage.effectType);
            param.gage.countType  = (GageCountType)EditorGUILayout.EnumPopup("カウント方法", param.gage.countType);
            break;

        case ShotMode.LimitShot:
            param.bulletMaxNum = EditorGUILayout.IntField("最大弾丸数", param.bulletMaxNum);
            param.reloadTime   = EditorGUILayout.FloatField("リロード時間", param.reloadTime);

            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("ゲージ");
            EditorGUI.indentLevel++;

            param.gage.barType    = (GageBarType)EditorGUILayout.EnumPopup("ゲージバー", param.gage.barType);
            param.gage.effectType = (GageEffectType)EditorGUILayout.EnumPopup("ゲージ描画方法", param.gage.effectType);
            param.gage.countType  = (GageCountType)EditorGUILayout.EnumPopup("カウント方法", param.gage.countType);
            break;
        }

        EditorUtility.SetDirty(target);
        serializedObject.ApplyModifiedProperties();
    }