Beispiel #1
0
    /// <summary>
    /// 多方向弾
    /// </summary>
    /// <param name="bc">弾の色</param>
    /// <param name="target">ターゲット</param>
    /// <param name="wayNum">発射数</param>
    /// <param name="changeAngle">隣の弾との角度差</param>
    public void WayShot(BulletColor bc, Vector3 target, int wayNum = 3, int changeAngle = 10)
    {
        var direction  = target - transform.position;
        var baseAngle  = Mathf.Atan2(direction.y, direction.x) * 180 / Mathf.PI;
        var startAngle = 0.0f;

        // 偶数の時
        if (wayNum % 2 == 0)
        {
            startAngle = baseAngle + wayNum / 2 * changeAngle - changeAngle / 2;
        }
        // 奇数の時
        else
        {
            startAngle = baseAngle + wayNum / 2 * changeAngle;
        }

        // changeAngle度ずつwayNum数発射
        for (int i = 0; i < wayNum; ++i, startAngle -= changeAngle)
        {
            float x   = Mathf.Cos(startAngle * Mathf.PI / 180.0f);
            float y   = Mathf.Sin(startAngle * Mathf.PI / 180.0f);
            var   obj = createBullet(bc);
            obj.GetComponent <EnemyBullet>().initBullet(new Vector2(x, y).normalized);
        }
    }
Beispiel #2
0
    /// <summary>
    /// ばらまき弾
    /// </summary>
    /// <param name="bc">弾の色</param>
    /// <param name="target">ターゲット</param>
    /// <param name="shotNum">発射数</param>
    public void scatterShot(BulletColor bc, Vector3 target, int shotNum)
    {
        var direction = target - transform.position;
        var baseAngle = Mathf.Atan2(direction.y, direction.x);

        StartCoroutine(scatterCoroutine(bc, shotNum, baseAngle));
    }
Beispiel #3
0
    void Start()
    {
        BulletColor bcollor = GetComponent <BulletColor>();

        bcollor.SetColor(RhythmMovement.PlayerColor(photonView.owner.ID));
        rigidbody.velocity = transform.forward * bulletSpeed;
    }
Beispiel #4
0
    void Changecolor()
    {
        EnemyColor  e = new EnemyColor();
        BulletColor b = new BulletColor();

        e.sp.color = b.sp.color;
    }
Beispiel #5
0
    // ----------------------------------------------------------------------------------------------------------
    // public関数
    // ----------------------------------------------------------------------------------------------------------

    /// <summary>
    /// targetに向けて弾を発射
    /// </summary>
    /// <param name="bc">発射したい弾の色</param>
    /// <param name="target">ターゲット</param>
    public void aimShot(BulletColor bc, Vector3 target)
    {
        var direction = target - transform.position;
        var obj       = createBullet(bc);

        // 弾の方向を渡す
        obj.GetComponent <EnemyBullet>().initBullet(direction.normalized);
    }
Beispiel #6
0
    void Start()
    {
        BulletColor bcollor = GetComponent <BulletColor>();

        bcollor.SetColor(RhythmMovement.PlayerColor(photonView.owner.ID));
        rigidbody.velocity = transform.forward * bulletSpeed;
        initialBeatTime    = MusicBeat.BeatTime;
        lastBeat           = MusicBeat.BeatTime;
    }
Beispiel #7
0
 private void Awake()
 {
     FirePoints     = GetComponentsInChildren <Muzzle>();
     FindTimer      = 0;
     FireTimer      = 0;
     ReloadTimer    = 0;
     state          = State.FIRE;
     angleDirection = 1;
     targetSearcher = GetComponentInChildren <TargetSearcher>();
     bulletColor    = BulletColor.RED;
 }
Beispiel #8
0
 void ChangeBulletColor()
 {
     if (bulletColor == BulletColor.RED)
     {
         bulletColor = BulletColor.BLUE;
     }
     else
     {
         bulletColor = BulletColor.RED;
     }
 }
Beispiel #9
0
 /// <summary>
 /// 円形に弾を発射
 /// </summary>
 /// <param name="bc">弾の色</param>
 /// <param name="partitions">分割数</param>
 public void circleShot(BulletColor bc, int partitions = 18)
 {
     for (int i = 0; i < partitions; ++i)
     {
         float rot = 360.0f / partitions * i;
         float x   = Mathf.Cos(rot * Mathf.PI / 180.0f);
         float y   = Mathf.Sin(rot * Mathf.PI / 180.0f);
         var   obj = createBullet(bc);
         obj.GetComponent <EnemyBullet>().initBullet(new Vector2(x, y).normalized);
     }
 }
Beispiel #10
0
 /// <summary>
 /// ばらまき弾
 /// </summary>
 /// <param name="bc"></param>
 /// <param name="shotNum"></param>
 /// <param name="baseAngle"></param>
 /// <returns></returns>
 IEnumerator scatterCoroutine(BulletColor bc, int shotNum, float baseAngle)
 {
     for (int i = 0; i < shotNum; ++i)
     {
         var angle = Random.Range(0.0f, 1500.0f) / 1000.0f - 0.75f;
         var x     = Mathf.Cos(angle);
         var y     = Mathf.Sin(angle);
         var obj   = createBullet(bc);
         obj.GetComponent <EnemyBullet>().initBullet(new Vector2(x, y).normalized);
         yield return(new WaitForSeconds(0.1f));
     }
 }
Beispiel #11
0
    // ----------------------------------------------------------------------------------------------------------
    // private関数
    // ----------------------------------------------------------------------------------------------------------

    /// <summary>
    /// 引数で指定された色の弾を生成
    /// </summary>
    /// <param name="bc">弾の色</param>
    /// <returns>生成された弾</returns>
    GameObject createBullet(BulletColor bc)
    {
        switch (bc)
        {
        case BulletColor.Red:
            return(Instantiate(redBulletPref));

        case BulletColor.Blue:
            return(Instantiate(blueBulletPref));

        default:
            return(null);
        }
    }
 void OnMouseDownE()
 {
     if (timerDelay > delayTime)
     {
         chargingBallAudio.Stop();
         chargingBallAudio.Play();
         timerCharge = 0;
         timerDelay  = 0;
         isPrefabing = true;
         energy     -= loseFill;
         timerEnergy = 0;
         //imageFill.fillAmount = energy / maxFill;
         Vector3 aux = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         aux       = new Vector3(aux.x, this.transform.position.y + 1f, 0);
         prefabing = ((GameObject)Instantiate(circlePrefab, aux, circlePrefab.transform.rotation)).GetComponent <BulletColor> ();
         prefabing.ChangeColor(controller.GetNextBallColor());
     }
 }
Beispiel #13
0
        private void ReadBulletColor(TextParagraphPropertiesType baseProperties, PPTRunProperties bulletProp)
        {
            BulletColor buCol = baseProperties.GetFirstChild <BulletColor>();

            if (buCol != null)
            {
                if (buCol.RgbColorModelHex != null)
                {
                    bulletProp.FontColor = "#" + buCol.RgbColorModelHex.Val.Value;
                }
                else
                {
                    if (buCol.GetFirstChild <SchemeColor>() != null)
                    {
                        bulletProp.ReadThemeSchemeColor(buCol.GetFirstChild <SchemeColor>());
                    }
                }
            }
        }
Beispiel #14
0
    public void Spawn(Vector3 _pos, Quaternion _rot, BulletColor _bulletColor = BulletColor.DEFAULT)
    {
        // 사용 가능한지 체크
        if (bullets[Counter].gameObject.activeSelf)
        {
            return;
        }

        // 생성
        bullets[Counter].gameObject.SetActive(true);
        bullets[Counter].transform.position = _pos;
        bullets[Counter].transform.rotation = _rot;
        switch (_bulletColor)
        {
        case BulletColor.DEFAULT:
            break;

        case BulletColor.RED:
            bullets[Counter].transform.GetChild(0).
            GetComponent <MeshRenderer>().material = RedMaterial;
            break;

        case BulletColor.BLUE:
            bullets[Counter].transform.GetChild(0).
            GetComponent <MeshRenderer>().material = BlueMaterial;
            break;
        }


        // 카운터 상승
        Counter++;
        if (Counter == bullets.Length)
        {
            Counter = 0;
        }
    }
Beispiel #15
0
 void SetPlayerType(BulletColor bulletColor)
 {
     m_bulletColor = bulletColor;
 }