コード例 #1
0
        public static bool TryToActivate(BloodSpell bloodSpell, Vector3 velocity, SaveData saveData)
        {
            if (Vector3.Dot(Vector3.up, bloodSpell.spellCaster.magic.up) > saveData.gesturePrescision)                                        //If fingers pointing up
            {
                if (Vector3.Dot(Player.currentCreature.transform.forward, bloodSpell.spellCaster.magic.forward) > saveData.gesturePrescision) //Palm is facing forwards
                {
                    if (SpellAbilityManager.SpendHealth(2))
                    {
                        //Spawn bullet
                        Catalog.GetData <ItemData>("BloodBullet").SpawnAsync(delegate(Item bullet)
                        {
                            bullet.IgnoreRagdollCollision(bloodSpell.spellCaster.mana.creature.ragdoll);


                            Vector3 aimDir = BloodSpell.AimAssist(bullet.transform.position, velocity.normalized, 0.7f, 0.01f).aimDir;

                            bullet.rb.AddForce(aimDir * velocity.magnitude * saveData.bulletSpeed, ForceMode.Impulse);
                            bullet.transform.rotation = Quaternion.LookRotation(aimDir);

                            bullet.Throw(1f, Item.FlyDetection.Forced);

                            BloodBullet b = bullet.gameObject.AddComponent <BloodBullet>();
                            b.Initialize(bullet);
                        }, bloodSpell.spellCaster.magic.position, Quaternion.Euler(bloodSpell.spellCaster.magic.forward), null, false, null);
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #2
0
    IEnumerator CircleHell(Vector3 centerPoint, int number, float radius, int numOfCircles, Vector3 playerLoc)
    {
        for (int j = 0; j < numOfCircles; j++)
        {
            float   angleTar     = Mathf.Atan2((playerLoc.y - transform.position.y), (playerLoc.x - transform.position.x));
            Vector3 bulletTarget = new Vector3(Mathf.Cos(angleTar - (Mathf.PI / 2) + (Mathf.PI * j / numOfCircles)), Mathf.Sin(angleTar - (Mathf.PI / 2) + (Mathf.PI * j / numOfCircles)));
            for (int i = 0; i < number; i++)
            {
                float      angle       = (-i / (float)number) * 2 * Mathf.PI + Mathf.PI / 2;
                float      xPos        = centerPoint.x + radius * Mathf.Cos(angle);
                float      yPos        = centerPoint.y + radius * Mathf.Sin(angle);
                GameObject bloodBullet = bloodPooler.GetDanmaku(bloodBulletIndex);
                if (bloodBullet != null)
                {
                    BloodBullet bloodBulletScript = bloodBullet.GetComponent <BloodBullet>();
                    bloodBullet.transform.position = new Vector3(xPos, yPos, 0f);
                    bloodBulletScript.SetOwner(gameObject);
                    bloodBulletScript.setTarget(bulletTarget);
                    bloodBulletScript.setAttackOne();
                    bloodBulletScript.setSpeed(j + 3);
                    bloodBulletScript.setTimer(2);
                    bloodBullet.SetActive(true);
                }
                //yield return new WaitForSeconds(2f / number);
            }
            AudioManager.GetInstance().PlaySound(Sound.VampireBullet);
            yield return(new WaitForSeconds(0.5f));

            animator.SetTrigger("EnterChargeUp");
            yield return(new WaitForSeconds(0.5f));

            if (j > 0)
            {
                animator.SetTrigger("EnterAttack");
            }
        }
        yield return(new WaitForSeconds(0.5f));

        animator.SetTrigger("EnterChargeUp");
        yield return(new WaitForSeconds(0.5f));

        animator.SetTrigger("EnterAttack");
        yield return(new WaitForSeconds(1f));

        animator.SetTrigger("EnterIdle");
    }
コード例 #3
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));
     }
 }
コード例 #4
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));
     }
 }