示例#1
0
 public override int CanDoAction(AAnimal target)
 {
     if (Number <= 0)
     {
         return (int)ErrorTypeList.Number;
     }
     return (int)ErrorTypeList.Nothing;
 }
示例#2
0
 public virtual void Action(AAnimal myself)
 {
     if (IsChargeSkill)
     {
         chargeCount = 0;
         charged = false;
     }
 }
示例#3
0
 protected int CanDoActionAboutHPSP(AAnimal myself)
 {
     float hp = myself.HP; float sp = myself.SP;
     float[] subs = myself.GetSubStatus();
     hp = hp - hpCost; sp = sp - spCost;
     hp = hp - Mathf.RoundToInt(myself.MaxHP * ((float)hppercentCost / 100));
     sp = sp - Mathf.RoundToInt(myself.MaxSP * ((float)sppercentCost / 100));
     if (hp >= 0 && sp >= 0) { return (int)ErrorTypeList.Nothing; }// Break_The_Limit
     return (int)ErrorTypeList.HPSP;
 }
示例#4
0
 public override int CanDoAction(AAnimal myself)
 {
     if (myself.BattleReady) { }
     else { return (int)ErrorTypeList.BattleReady; }
     if (catalyst != null)
     {
         if (catalyst.Number >= 1) { }
         else { return (int)ErrorTypeList.Number; }
     }
     else { return (int)ErrorTypeList.Catalyst; }
     return CanDoActionAboutHPSP(myself);
 }
示例#5
0
 public void SetMainParam(AAnimal creator, string mindname, int profpoint,
     int attackdamage, int magicdamage, Vector3 centerposition, 
     GameObject damageeffect, Vector3 skillscalevector, 
     string buffname, 
     float damageduration, float casttime)
 {
     Creator = creator; mindName = mindname; profPoint = profpoint;
     attackDamage = attackdamage; magicDamage = magicdamage; center = centerposition;
     damageEffect = damageeffect; skillScaleVector = skillscalevector;
     BuffName = buffname;
     damageDuration = damageduration; castTime = casttime;
 }
示例#6
0
    public override int CanDoAction(AAnimal myself)
    {
        RaycastHit hitFront; RaycastHit hitDown;
        Ray rayDown = new Ray(myself.nextnextPOS + new Vector3(0, myself.ObjectScale.y - 0.5f, 0), Vector3.down);

        if (Physics.Raycast(rayDown, out hitDown, 2 * (myself.ObjectScale.y - 0.5f)))
        {
            if (hitDown.collider.gameObject.layer == LayerMask.NameToLayer("Environment") ||
                hitDown.collider.gameObject.layer == LayerMask.NameToLayer("Animal"))
            {
                myself.nextnextPOS += new Vector3(0, myself.ObjectScale.y - 0.5f - hitDown.distance, 0);
            }
            else if (hitDown.collider.gameObject.layer == LayerMask.NameToLayer("Terrain"))
            {
                myself.nextnextPOS += new Vector3(0, Terrain.activeTerrain.SampleHeight(myself.nextnextPOS) - myself.nextnextPOS.y, 0);
            }
        }
        else
        {
            return (int)ErrorTypeList.Move;
        }

        Vector3 dir = new Vector3(myself.nextnextPOS.x - myself.nextPOS.x, myself.nextnextPOS.y - myself.nextPOS.y, myself.nextnextPOS.z - myself.nextPOS.z);
        dir = myself.RoundToIntVector3XZ(dir);
        float maxd = 1.0f;
        if (dir.x != 0 && dir.y != 0 && dir.z != 0) { maxd = 2.25f; }
        else if (dir.x != 0 && dir.y != 0) { maxd = 1.5f; }
        else if (dir.y != 0 && dir.z != 0) { maxd = 1.5f; }
        else if (dir.z != 0 && dir.x != 0) { maxd = 1.5f; }

        Ray rayFront = new Ray(myself.nextPOS + new Vector3(0, myself.ObjectScale.y - 0.5f, 0), dir);
        if (Physics.Raycast(rayFront, out hitFront, maxd))
        {
            if (hitFront.collider.gameObject.layer == LayerMask.NameToLayer("Animal"))
            {
                if (myself.name == hitFront.collider.gameObject.name) { }
                else
                {
                    return (int)ErrorTypeList.Move;
                }
            }
            else if (hitFront.collider.gameObject.layer == LayerMask.NameToLayer("Terrain") ||
                hitFront.collider.gameObject.layer == LayerMask.NameToLayer("Environment"))
            {
                return (int)ErrorTypeList.Move;
            }
        }
        return (int)ErrorTypeList.Nothing;
    }
示例#7
0
 public override void SetParamsNeedAnimal(AAnimal myself)
 {
     profPoint = 1;
     castTime = 2.0f / myself.MovementSpeed;
     duration = CastTime;
     skillScale = (float)Math.Sqrt(SkillScaleVector.x * SkillScaleVector.y * SkillScaleVector.z);
     spCost = Mathf.RoundToInt(3 * skillScale);
     profPoint += Mathf.FloorToInt(SkillScale / 10);
     if (catalyst != null) { }
     else
     {
         if (myself.ItemBag.FindChild("AirShard"))
         {
             catalyst = myself.ItemBag.FindChild("AirShard").GetComponent<AItem>();
         }
     }
     SkillPOSFix = myself.EyeLevel;
 }
示例#8
0
        public override void Action(AAnimal myself)
        {
            if (myself.Buffs.FindChild("MagicChargeIV")) { profPoint += 4; }
            else if (myself.Buffs.FindChild("MagicChargeIII")) { profPoint += 3; }
            else if (myself.Buffs.FindChild("MagicChargeII")) { profPoint += 2; }
            else if (myself.Buffs.FindChild("MagicCharge")) { profPoint += 1; }

            if (catalyst.Number <= 0) { }
            else
            {
                catalyst.Materialize(myself.targetPOS);
                if (Charged) { profPoint++; CreateCubeDamageField(myself, 0, Mathf.RoundToInt(myself.MD * 2.0f), myself.targetPOS + SkillPOSFix); }
                else { CreateCubeDamageField(myself, 0, myself.MD, myself.targetPOS + SkillPOSFix); }
                profPoint = 1;
                if (myself.Buffs.FindChild("MagicCharge")) { Destroy(myself.Buffs.FindChild("MagicCharge").gameObject); }
                if (myself.Buffs.FindChild("MagicChargeII")) { Destroy(myself.Buffs.FindChild("MagicChargeII").gameObject); }
                if (myself.Buffs.FindChild("MagicChargeIII")) { Destroy(myself.Buffs.FindChild("MagicChargeIII").gameObject); }
                if (myself.Buffs.FindChild("MagicChargeIV")) { Destroy(myself.Buffs.FindChild("MagicChargeIV").gameObject); }
            }
            base.Action(myself);
            SetMotionAndDurationAndUseHPSP(myself);
        }
示例#9
0
 public override void SetParamsNeedAnimal(AAnimal myself)
 {
 }
示例#10
0
 public override int CanDoAction(AAnimal myself)
 {
     return CanDoActionAboutHPSP(myself);
 }
示例#11
0
    public override void SetParamsNeedAnimal(AAnimal myself)
    {
        float diag = 1.0f;
        if (Mathf.Abs(myself.nextPOS.x - myself.nextnextPOS.x) != 0 &&
             Mathf.Abs(myself.nextPOS.z - myself.nextnextPOS.z) != 0) { diag = 1.5f; }
        else { diag = 1.0f; }
        if (myself.MovementSpeed <= 0) { }
        else if (myself.MovementSpeed <= 1.0f) { duration = (diag) / (myself.MovementSpeed * 2); }
		else { duration = (diag) / (myself.MovementSpeed); }
    }
示例#12
0
 public override void Action(AAnimal myself)
 {
     myself.TakeBuff("MagicChargeIV");
     SetMotionAndDurationAndUseHPSP(myself);
 }
示例#13
0
 public override void SetParamsNeedAnimal(AAnimal myself)
 {
     profPoint = 5;
     castTime = 2.0f / myself.MovementSpeed;
     duration = CastTime;
     skillScale = (float)Math.Sqrt(SkillScaleVector.x * SkillScaleVector.y * SkillScaleVector.z);
     if (SkillScale >= 50) { skillScale = 50; }
     sppercentCost = 50 + Mathf.RoundToInt(skillScale);
     profPoint += Mathf.FloorToInt(SkillScale / 10);
     if (myself.ItemBag.FindChild("EnergyShard"))
     {
         catalyst = myself.ItemBag.FindChild("EnergyShard").GetComponent<AItem>();
     }
     SkillPOSFix = myself.EyeLevel;
 }
示例#14
0
 protected override void ChargingAction(AAnimal myself)
 {
     base.ChargingAction(myself);
 }
示例#15
0
 protected void GiveProficiency(AAnimal myself)
 {
     if (myself.Mind.FindChild(mindName))
     {
         if (myself.tag == "Player")
         { myself.Mind.FindChild(mindName).GetComponent<AMind>().GainProficiency(profPoint, true); }
         else { myself.Mind.FindChild(mindName).GetComponent<AMind>().GainProficiency(profPoint, false); }
     }
 }
示例#16
0
 public override void Action(AAnimal myself)
 {
     myself.POS = myself.nextPOS;
     myself.nextPOS = myself.nextnextPOS;
     iTween.MoveTo(myself.gameObject,
         iTween.Hash("position", myself.nextPOS,
         "time", duration,
         "easetype", "linear"
         ));
     SetMotionAndDurationAndUseHPSP(myself);
 }
示例#17
0
 public override void Action(AAnimal myself)
 {
     string buffnum = "";
     if (myself.Mind.FindChild("Mage"))
     {
         AMind mage = myself.Mind.FindChild("Mage").GetComponent<AMind>();
         if (mage.MindLevel >= 4 && myself.Buffs.FindChild("MagicCharge")) { buffnum = "II"; }
         if (mage.MindLevel >= 6 && myself.Buffs.FindChild("MagicChargeII")) { buffnum = "III"; }
         if (mage.MindLevel >= 8 && myself.Buffs.FindChild("MagicChargeIII")) { buffnum = "IV"; }
     }
     else { }
     myself.TakeBuff("MagicCharge" + buffnum);
     GiveProficiency(myself);
     SetMotionAndDurationAndUseHPSP(myself);
 }
示例#18
0
 /// <summary>
 /// kowai
 /// </summary>
 /// <param name="colliderInfo"></param>
 protected void OnTriggerEnter(Collider colliderInfo)
 {
     if (colliderInfo.gameObject.layer == LayerMask.NameToLayer("Item"))
     {
         mainComponentPool.GetComponent<PickUp>().TargetItem = colliderInfo.gameObject.GetComponent<AItem>();
         SubmitAction = mainComponentPool.GetComponent<PickUp>();
     }
     else if (colliderInfo.gameObject.layer == LayerMask.NameToLayer("DamageField"))
     {
         focusedAnimal = colliderInfo.gameObject.GetComponent<ADamageField>().Creator;
     }
 }
示例#19
0
 public override void SetParamsNeedAnimal(AAnimal myself)
 {
     duration = 0.5f / myself.MovementSpeed;
 }
示例#20
0
 protected virtual void ChargingAction(AAnimal myself)
 {
     GameObject ef = (GameObject)Instantiate(Resources.Load("Prefabs/Effects/Utilities/Charging"), myself.nextPOS + myself.EyeLevel, Quaternion.identity);
     ef.GetComponent<EffectManager>().Go();
 }
示例#21
0
 public abstract void SetParamsNeedAnimal(AAnimal myself);
示例#22
0
 // have to definite ACTIONCODE, DURATION and NAME at inheriting constracter
 /// <summary>
 /// 0: I can do it.
 /// others: ErrorNumber
 /// </summary>
 /// <param name="myself"></param>
 /// <returns></returns>
 public virtual int CanDoAction(AAnimal myself)
 {
     return (int)ErrorTypeList.Nothing;
 }
示例#23
0
 public override void Action(AAnimal myself)
 {
     myself.TakeBuff("Break_The_Limit");
     SetMotionAndDurationAndUseHPSP(myself);
 }
示例#24
0
        public override void Action(AAnimal myself)
        {
            fieldBuffName = "Tender";
            if (myself.Buffs.FindChild("MagicChargeIV")) { fieldBuffName += "IV"; profPoint += 4; }
            else if (myself.Buffs.FindChild("MagicChargeIII")) { fieldBuffName += "III"; profPoint += 3; }
            else if (myself.Buffs.FindChild("MagicChargeII")) { fieldBuffName += "II"; profPoint += 2; }
            else if (myself.Buffs.FindChild("MagicCharge")) { profPoint += 1; }

            if (catalyst.Number <= 0) { }
            else
            {
                catalyst.Materialize(myself.targetPOS);
                CreateCubeDamageField(myself, 0, myself.MD, myself.targetPOS + SkillPOSFix);
                if (myself.Buffs.FindChild("MagicCharge")) { Destroy(myself.Buffs.FindChild("MagicCharge").gameObject); }
                if (myself.Buffs.FindChild("MagicChargeII")) { Destroy(myself.Buffs.FindChild("MagicChargeII").gameObject); }
                if (myself.Buffs.FindChild("MagicChargeIII")) { Destroy(myself.Buffs.FindChild("MagicChargeIII").gameObject); }
                if (myself.Buffs.FindChild("MagicChargeIV")) { Destroy(myself.Buffs.FindChild("MagicChargeIV").gameObject); }
            }
            base.Action(myself);
            SetMotionAndDurationAndUseHPSP(myself);
        }
示例#25
0
 public override void Action(AAnimal myself)
 {
     SetMotionAndDurationAndUseHPSP(myself);
     myself.Interrupting = false;
 }
示例#26
0
 public override int CanDoAction(AAnimal myself)
 {
     return (int)ErrorTypeList.IsPassive;
 }
示例#27
0
 protected void SetMotionAndDurationAndUseHPSP(AAnimal myself)
 {
     myself.UseHPSP(HPCost, SPCost, HPPercentCost, SPPercentCost);
     myself.GetAnimator().SetInteger("ActionCode", actioncode);
     myself.StartCoroutine(myself.DoingAction(duration));
 }
示例#28
0
 protected void CreateCubeDamageField(AAnimal myself, int ad, int md, Vector3 pos)
 {
     GameObject cubedamagefield = (GameObject)Instantiate(Resources.Load("Prefabs/Utilities/CubeDamageField"), Vector3.zero, Quaternion.identity);
     cubedamagefield.GetComponent<ADamageField>().SetMainParam(
         myself, mindName, profPoint, 
         ad, md, pos,
         DamageEffect,
         SkillScaleVector,
         FieldBuffName,
         DamageDuration,
         CastTime);
     cubedamagefield.GetComponent<CubeDamageField>().SetAndAwake();
 }
示例#29
0
 public override void Action(AAnimal myself)
 {
     Materialize(myself.nextPOS + myself.DIR);
     SetMotionAndDurationAndUseHPSP(myself);
 }
示例#30
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));
            }
        }
    }