Example #1
0
    protected override void Ability(
        Vector2 position, Vector2 facingDir,
        Animator animator = null, Rigidbody2D rigidbody = null
        )
    {
        Debug.Log(facingDir);
        float facingRotation = Mathf.Atan2(facingDir.y, facingDir.x) * Mathf.Rad2Deg;

        Debug.Log(facingRotation);
        float startRotation = facingRotation + spread / 2f;
        float angleIncrease = spread / ((float)count - 1f);

        for (int i = 0; i < count; i++)
        {
            float      tempRot         = startRotation - angleIncrease * i;
            GameObject projectileClone = Instantiate(
                projectile, position, Quaternion.Euler(0f, 0f, tempRot)
                );
            GenericProjectile temp = projectileClone.GetComponent <GenericProjectile>();

            if (temp)
            {
                temp.Setup(new Vector2(
                               Mathf.Cos(tempRot * Mathf.Deg2Rad), Mathf.Sin(tempRot * Mathf.Deg2Rad))
                           );
            }
        }
    }
Example #2
0
    public override void Ability(Vector2 playerPos, Vector2 playerFacingDirection, Rigidbody2D playerRigidBody = null)
    {
        float      facingRotation = Mathf.Atan2(playerFacingDirection.y, playerFacingDirection.x) * Mathf.Rad2Deg;
        GameObject newProjectile  = Instantiate(projectile, playerPos, Quaternion.Euler(0f, facingRotation, 0f));

        GenericProjectile temp = projectile.GetComponent <GenericProjectile>();

        if (temp)
        {
            temp.Setup(playerFacingDirection);
        }
    }
Example #3
0
    public override void Ability(Vector2 monsterPosition, Vector2 monsterFacingDirection,
                                 Vector3 mousePosition, Vector3 attackDirection,
                                 Animator monsterAnimator = null, Rigidbody2D monsterRigidBody = null)
    {
        float      projectileRotation = Mathf.Atan2(attackDirection.y, attackDirection.x) * Mathf.Rad2Deg;
        GameObject newProjectile      = Instantiate(thisProjectile, monsterPosition,
                                                    Quaternion.Euler(0f, 0f, projectileRotation));

        GenericProjectile temp = newProjectile.GetComponent <GenericProjectile>();

        if (temp)
        {
            temp.Setup(attackDirection);
        }
    }
Example #4
0
    protected override void Ability(
        Vector2 position, Vector2 facingDir,
        Animator animator = null, Rigidbody2D rigidbody = null
        )
    {
        // Debug.Log("HERE");
        float      facingRot       = Mathf.Atan2(facingDir.y, facingDir.x) * Mathf.Rad2Deg;
        GameObject projectileClone = Instantiate(
            projectile, position, Quaternion.Euler(0f, 0f, facingRot)
            );

        GenericProjectile temp = projectileClone.GetComponent <GenericProjectile>();

        if (temp)
        {
            temp.Setup(facingDir);
        }
    }
Example #5
0
    public override void Tech(GameObject thisMonster, string otherTag, Vector2 monsterPosition, Vector2 monsterFacingDirection,
                              Vector3 mousePosition, Vector3 attackDirection,
                              Animator monsterAnimator = null, Rigidbody2D monsterRigidBody = null)
    {
        float      projectileRotation = Mathf.Atan2(attackDirection.y, attackDirection.x) * Mathf.Rad2Deg;
        GameObject newProjectile      = Instantiate(thisProjectile, monsterPosition,
                                                    Quaternion.Euler(0f, 0f, projectileRotation));

        GenericProjectile temp = newProjectile.GetComponent <GenericProjectile>();

        newProjectile.GetComponent <TechDamage>().tech        = this;
        newProjectile.GetComponent <TechDamage>().otherTag    = otherTag;
        newProjectile.GetComponent <TechDamage>().thisMonster = thisMonster;

        if (temp)
        {
            temp.Setup(attackDirection);
        }
    }