Пример #1
0
    public override void UseWeaponBasic(Animator anim)
    {
        Transform leftKnife   = transform.Find("LeftKnife");
        OnTrigger leftTrigger = leftKnife.GetComponent <OnTrigger>();

        leftTrigger.SetPlayerDmg(mPlayer, dmgBasic);

        Transform rightKnife   = transform.Find("RightKnife");
        OnTrigger rightTrigger = rightKnife.GetComponent <OnTrigger>();

        rightTrigger.SetPlayerDmg(mPlayer, dmgBasic);

        animations.SetTrigger("BasicAttack");
    }
Пример #2
0
    public void ShootingArrow(Vector3 end, PlayerManager mPlayer, int dmg)
    {
        Transform collider = transform.Find("ArrowPointCollider");

        if (collider != null)
        {
            OnTrigger trigger = collider.GetComponent <OnTrigger>();
            trigger.SetPlayerDmg(mPlayer, dmg);
        }

        endMarker = end;

        transform.LookAt(endMarker);

        shoot = true;
    }
Пример #3
0
    public override void UseWeaponBasic(Animator anim)
    {
        anim.SetTrigger("BasicSlash");
        int slashnr = anim.GetInteger("SlashNr") + 1;

        if (slashnr >= 3)
        {
            slashnr = 0;
        }
        anim.SetInteger("SlashNr", slashnr);

        //hit Audio
        audioManager.Play("Berserker_Hit");

        slashing = true;

        trigger.SetPlayerDmg(pManager, dmgBasic);
        StartCoroutine(Slash());
    }
Пример #4
0
    void Update()
    {
        if (fire)
        {
            // Distance moved = time * speed.
            float distCovered = (Time.time - startTime) * speed;

            // Fraction of journey completed = current distance divided by total distance.
            float fracJourney = distCovered / journeyLength;

            // Set our position as a fraction of the distance between the markers.
            transform.position = Vector3.Lerp(startMarker, endMarker, fracJourney);

            if (transform.position == endMarker)
            {   // At the end of the road
                GameObject explosion = Instantiate(magicExplosionPrefab, transform.position, Quaternion.identity);

                OnTrigger trigger = explosion.GetComponent <OnTrigger>();
                trigger.SetPlayerDmg(mPlayer, dmg);

                Destroy(gameObject);
            }
        }
    }