コード例 #1
0
 //WIP for another attack
 IEnumerator BloodBolts(int number, Transform playerLoc, Vector3 centerPoint, float radius, int speedIncrease)
 {
     Debug.Log("BloodBolts");
     for (int i = 0; i < number; i++)
     {
         float angleTar = Mathf.Atan2((playerLoc.position.y - transform.position.y), (playerLoc.position.x - transform.position.x));
         target = radius * new Vector3(Mathf.Cos(angleTar - (Mathf.PI / 2) + (Mathf.PI * i)), Mathf.Sin(angleTar - (Mathf.PI / 2) + (Mathf.PI * i))) + transform.position;
         GameObject bloodBullet = bloodPooler.GetDanmaku(bloodBulletIndex);
         if (bloodBullet != null)
         {
             BloodBullet bloodBulletScript = bloodBullet.GetComponent <BloodBullet>();
             bloodBullet.transform.position = target;
             bloodBulletScript.calcTarget(playerLoc.position);
             bloodBulletScript.setAttackTwo();
             bloodBulletScript.setATK2Speed(15 + speedIncrease);
             bloodBulletScript.setTimer(.5f);
             bloodBullet.SetActive(true);
         }
         yield return(new WaitForSeconds(1f));
     }
 }
コード例 #2
0
 //WIP for another attack
 IEnumerator BloodBolts(int number, Transform playerLoc, Vector3 centerPoint, float radius, int speedIncrease)
 {
     for (int i = 0; i < number; i++)
     {
         timer = timer + .1f;
         float      angleTar     = Mathf.Atan2((playerLoc.position.y - transform.position.y), (playerLoc.position.x - transform.position.x));
         Vector3    bulletTarget = radius * new Vector3(Mathf.Cos(angleTar - (Mathf.PI / 2) + (Mathf.PI * i)), Mathf.Sin(angleTar - (Mathf.PI / 2) + (Mathf.PI * i))) + transform.position;
         GameObject bloodBullet  = bloodPooler.GetDanmaku(bloodBulletIndex);
         if (bloodBullet != null)
         {
             BloodBullet bloodBulletScript = bloodBullet.GetComponent <BloodBullet>();
             bloodBullet.transform.position = bulletTarget;
             bloodBulletScript.SetOwner(gameObject);
             bloodBulletScript.calcTarget(playerLoc.position);
             bloodBulletScript.setAttackTwo();
             bloodBulletScript.setATK2Speed(15 + speedIncrease);
             bloodBulletScript.setTimer(.5f);
             bloodBullet.SetActive(true);
         }
         AudioManager.GetInstance().PlaySound(Sound.VampireBullet);
         yield return(new WaitForSeconds(1f));
     }
 }