Example #1
0
    void DoAttack(Human human)
    {
        float dx = x - human.x;
        float dy = y - human.y;

        float attackBeamAngle = Mathf.Atan2(dy, dx) * RXMath.RTOD;

        pushSpeed -= new Vector2(dx, dy).normalized;        //move towards human

        var attackBeam = new VillAttackBeam(this, attackBeamAngle);

        float   beamDist = 5;
        float   rads     = -attackBeamAngle * RXMath.DTOR + Mathf.PI;
        Vector2 offset   = new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * beamDist;

        attackBeam.x = x + offset.x;
        attackBeam.y = y + 6 + offset.y;

        attackBeam.AddToArea();
        attackBeam.Update();

        FXPlayer.VillAttack();
    }
Example #2
0
    void DoAttack(Human human)
    {
        float dx = x - human.x;
        float dy = y - human.y;

        float attackBeamAngle = Mathf.Atan2(dy,dx) * RXMath.RTOD;

        pushSpeed -= new Vector2(dx,dy).normalized; //move towards human

        var attackBeam = new VillAttackBeam(this,attackBeamAngle);

        float beamDist = 5;
        float rads = -attackBeamAngle * RXMath.DTOR + Mathf.PI;
        Vector2 offset = new Vector2(Mathf.Cos(rads),Mathf.Sin(rads))*beamDist;
        attackBeam.x = x+offset.x;
        attackBeam.y = y+6+offset.y;

        attackBeam.AddToArea();
        attackBeam.Update();

        FXPlayer.VillAttack();
    }