Esempio n. 1
0
    public void Charge(AAnimal myself)
    {
        if (Charged) { }
        else
        {
            if (IsCharging) { }
            else
            {
                SetParamsNeedAnimal(myself);
                chargeCount++;
                myself.GetAnimator().SetInteger("ActionCode", actioncode);
                if (ChargeCount >= ChargeLimit)
                {
                    charged = true;
                    GameObject ef = (GameObject)Instantiate(Resources.Load("Prefabs/Effects/Utilities/Charged"), myself.nextPOS + Vector3.up, Quaternion.identity);
                    ef.GetComponent<EffectManager>().Go();
                    Debug.Log("Charged!");
                }
                else if (ChargeCount % ChargeSpan == 0) { ChargingAction(myself); }
                if (ChargeCount == 1) { }
                else { myself.UseHPSP(HPCost, SPCost, HPPercentCost, SPPercentCost); }

                StartCoroutine(chargedCD(CastTime));
            }
        }
    }
Esempio n. 2
0
    public override void Action(AAnimal myself)
    {
        float speed = 1.0f;
        if (myself.MovementSpeed * myself.MovementBurst == 0) { }
        else { speed = myself.MovementSpeed * myself.MovementBurst; }

        Vector3[] jumpRoute = new Vector3[jumpRouteList.Count];
        for (int c = 0; c <= jumpRouteList.Count - 1; c++) { jumpRoute[c] = jumpRouteList[c]; }
        for (int c = 0; c <= jumpRoute.Length - 1; c++) { Debug.Log(jumpRoute[c]); }

        if (jumpRouteList.Count <= 2)
        { duration = 0.0f; }
        else
        {
            duration = ((currentJump + 7) / 8) * (jumpRoute.Length / (1 + (currentJump * 2)));
            if (duration < 1.0f) { duration = 1.0f; }

            myself.POS = myself.nextPOS;
            myself.nextPOS = jumpRoute[jumpRoute.Length - 1];
            iTween.MoveTo(myself.gameObject,
                iTween.Hash("path", jumpRoute, "movetopath", false, "time", duration, "easetype", "linear"));

            myself.GetAnimator().SetFloat("Speed", speed);
        }
        SetMotionAndDurationAndUseHPSP(myself);
    }
Esempio n. 3
0
 protected void SetMotionAndDurationAndUseHPSP(AAnimal myself)
 {
     myself.UseHPSP(HPCost, SPCost, HPPercentCost, SPPercentCost);
     myself.GetAnimator().SetInteger("ActionCode", actioncode);
     myself.StartCoroutine(myself.DoingAction(duration));
 }
Esempio n. 4
0
    public override void Action(AAnimal myself)
    {
        duration = 0.0f;
        runRouteForReal = new Vector3[runStep];
        spCost = 1 * runStep;
        float speed = 1.0f;
        if (myself.MovementSpeed * myself.MovementBurst == 0) { }
        else { speed = myself.MovementSpeed * myself.MovementBurst; }

        for (int i = 1; i <= runRouteForReal.Length; i++)
        {
            duration += runLength[i] / speed;
            runRouteForReal[i - 1] = runRouteForCalc[i];
        }

        myself.POS = myself.nextPOS;
        myself.nextPOS = runRouteForReal[runStep - 1];
        if (runRouteForReal.Length == 1)
        {
            iTween.MoveTo(myself.gameObject,
                iTween.Hash("position", runRouteForReal[0], "time", duration, "easetype", "linear"));
        }
        else
        {
            iTween.MoveTo(myself.gameObject,
                iTween.Hash("path", runRouteForReal, "time", duration, "easetype", "linear"));
        }
        myself.GetAnimator().SetFloat("Speed", speed);
        myself.GetAnimator().SetInteger("ActionCode", actioncode);
        myself.UseHPSP(HPCost, SPCost, HPPercentCost, SPPercentCost);
        myself.StartCoroutine(myself.DoingAction(duration));
    }