Exemple #1
0
    protected override void Throw()
    {
        //adding Rigidbody2D
        body              = gameObject.AddComponent <Rigidbody2D>();
        body.bodyType     = RigidbodyType2D.Dynamic;
        body.gravityScale = gravity;
        body.drag         = drag;
        body.mass         = mass;
        body.angularDrag  = angularDrag;

        //get Params
        foreach (Herrow h in GameRules.Instance.herrows)
        {
            if (h.controller == ani.runtimeAnimatorController)
            {
                forceIncrement  = h.force;
                effectIncrement = h.agility;
                intIncrement    = h.intelligence;//not implemented yet
                //Ciao alberto, se stai leggendo queste righe...beh so che si poteva implementare in un altro modo
                //ma non c' ho tempo
                switch (h.ability)
                {
                case Ability.HerrowAbility.None:
                {
                    audioSource.clip = PopupQuiver.Instance.GetHerrow("Filosofo").thisHerrow.herrowThrowed;
                    break;
                }

                case Ability.HerrowAbility.Freeze:
                {
                    HerrowClicked hc = PopupQuiver.Instance.DisableHerrow("Medusa");
                    audioSource.clip = hc.thisHerrow.herrowThrowed;
                    break;
                }

                case Ability.HerrowAbility.Incorporeal:
                {
                    HerrowClicked hc = PopupQuiver.Instance.DisableHerrow("Ade");
                    audioSource.clip = hc.thisHerrow.herrowThrowed;
                    break;
                }
                }
                audioSource.Play();
            }
        }


        //throw Arrow
        transform.parent = null;
        ani.SetTrigger("Fly");
        result.y     = Mathf.Clamp(result.y, 0, 1);
        forceToApply = result.y * force;
        if (Mathf.Abs(forceToApply) > force)
        {
            forceToApply = force;
        }
        body.AddRelativeForce(new Vector2(0, forceToApply + forceIncrement), ForceMode2D.Force);

        //disable herrow
    }
Exemple #2
0
    public HerrowClicked DisableHerrow(string name)
    {
        HerrowClicked hc = GetHerrow(name);

        Debug.Assert(hc != null);
        hc.used[GameRules.Instance.currentPlayer] = true;
        return(null);
    }