コード例 #1
0
        public static BuffBase GetBuff(BuffInfo buffInfo, LevelAgent attacker, LevelAgent target)
        {
            //if (buffType == null)
            //    return null;
            //if (buffInfo.nnc != null)
            //{
            //}
            switch (buffInfo.buffType)
            {
            case eBuffType.heal:
            {
                return(new  HealBuff(buffInfo, attacker, target));
            }

            case eBuffType.damage:
            {
                return(new DamgeBuff(buffInfo, attacker, target));
            }

            default:
            {
                return(null);
            }
            }
        }
コード例 #2
0
        public static EffectDelayPlay LoadSkill(GameObject skillPrefab, LevelAgent attachActor, eSkillDirection skillDirection = eSkillDirection.orignal, bool blContainToPlayerControl = false, bool blInSkillLay = true)//,float durationTime=0
        {
            if (attachActor == null)
            {
                Debug.LogErrorFormat(" load skill null:" + skillPrefab.name);
            }
            EffectDelayPlay edp = LoadEffect(skillPrefab);

            if (edp != null)
            {
                if (blContainToPlayerControl)
                {
                    edp.gameObject.transform.SetParent(attachActor.transform);
                    TransformIdentity(edp.gameObject.transform);
                }
                else
                {
                    edp.transform.position = attachActor.transform.position;
                    if (skillDirection == eSkillDirection.self)
                    {
                        edp.transform.rotation = attachActor.transform.rotation;
                    }
                }
                if (blInSkillLay)
                {
                    GameObjectUtils.setChildLayer(edp.gameObject, skillLayer);
                }
            }

            return(edp);
        }
コード例 #3
0
ファイル: AIBehaviors.cs プロジェクト: moto2002/DefenseGame
        void Init()
        {
                        #if USE_ASTAR
            Debug.Log("Use Astar!");
                        #endif

            aiTransform     = GetTransform();
            animationStates = aiTransform.GetComponent <AIAnimationStates>();
            navMeshAgent    = aiTransform.GetComponent <NavMeshAgent>();
            levelAgent      = aiTransform.GetComponent <LevelAgent>();

            InitializeFinder(this);

            InitGlobalTriggers();

            if (!useSightTransform || sightTransform == null)
            {
                sightTransform               = new GameObject("Sight Transform").transform;
                sightTransform.parent        = aiTransform;
                sightTransform.localRotation = Quaternion.identity;
                sightTransform.localPosition = eyePosition;
                useSightTransform            = false;
            }

            currentDestination = aiTransform.position;

            SetActive(true);
        }
コード例 #4
0
    public void DamageEnemy()
    {
        for (int j = 0; j < targets.Count; j++)
        {
            LevelAgent pc = targets[j];
            if (pc != null)
            {
                int damage = skillDamages[j].damage;
                int heal   = skillDamages[j].heal;
                IAlignmentProvider alignment = skillDamages[j].alignment;
                if (heal > 0)
                {
                    pc.Cure(heal, pc.position, alignment);
                }
                else
                {
                    if (isAOE)
                    {
                        IsAOE(pc, damage, alignment);
                    }
                    else
                    {
                        pc.OnSkillDamageTaken(damage, pc.position, alignment, true, null, "");
                    }
                }
            }
        }

        if (isOver != null)
        {
            isOver(this);
        }
    }
コード例 #5
0
ファイル: SkillBase.cs プロジェクト: moto2002/DefenseGame
 public virtual int AttachActor(LevelAgent attacker, List <LevelAgent> targets, List <DamageInfo> skillDamages)
 {
     effects           = new List <EffectDelayPlay>();
     this.attacker     = attacker;
     this.targets      = targets;
     this.skillDamages = skillDamages;
     _currentTime      = 0;
     return(0);
 }
コード例 #6
0
 public override int AttachActor(LevelAgent attacker, List <LevelAgent> targets, List <DamageInfo> skillDamages)
 {
     base.AttachActor(attacker, targets, skillDamages);
     if (isUseDelay)
     {
         StartCoroutine(DelayUpdateEffect());
         StartCoroutine(DelayPlay());
     }
     return(1);
 }
コード例 #7
0
    public override int AttachActor(LevelAgent attacker, List <LevelAgent> targets, List <DamageInfo> skillDamages)
    {
        base.AttachActor(attacker, targets, skillDamages);
        targetable = targets[0].transform.position;

        if (skill_Effect != null)
        {
            UpdateEffect();
        }

        return(1);
    }
コード例 #8
0
        public void Construct(LevelAgent attacker, LevelAgent target, DamageInfo damageInfo)
        {
            this.attacker   = attacker;
            this.target     = target;
            this.damageInfo = damageInfo;

            attack_phase = new StateMachine <AttackPhase>();
            attack_phase.AddState(AttackPhase.Attack, null, Attack);
            attack_phase.AddState(AttackPhase.Before, null, UpdateBefore); //前摇
            attack_phase.AddState(AttackPhase.After, null, UpdateAfter);   //后摇
            attack_phase.AddState(AttackPhase.Done);
            attack_phase.SetState(AttackPhase.Attack);
        }
コード例 #9
0
        public void Construct(LevelAgent attacker, List <LevelAgent> targets, List <DamageInfo> skillDamages, long skillUniqueID, bool blSkillEdit = false)
        {
            this.attacker           = attacker;
            this.targets            = targets;
            this.skillDamages       = skillDamages;
            skillManage             = GameObject.Instantiate(Resources.Load <SkillManage>("Prefab/Skill/" + skillUniqueID));
            skillManage.OnComplete += OnComplete;

            attack_phase = new StateMachine <AttackPhase>();
            attack_phase.AddState(AttackPhase.Intro, null, SkillIntro);
            attack_phase.AddState(AttackPhase.Attack, null, SkillAttack);
            attack_phase.AddState(AttackPhase.Done);
            attack_phase.SetState(AttackPhase.Intro);
        }
コード例 #10
0
        public DamgeBuff(BuffInfo buffInfo, LevelAgent attacker, LevelAgent target)
        {
            this.buffInfo = buffInfo;
            this.attacker = attacker;
            this.target   = target;

            this.buffType = buffInfo.buffType;

            InitData();
            //根据玩家数值运算
            int allValue = this.buffInfo.AllValue;

            stepBlood = allValue / (int)(durationTime / healStepTime);
        }
コード例 #11
0
ファイル: BattleSystem.cs プロジェクト: moto2002/DefenseGame
        public void AddNormalAttackToBattleOrder(AttackData attackData)
        {
            LevelAgent attacker = attackData.fsm.levelAgent;
            LevelAgent target   = attackData.target.GetComponent <LevelAgent>();

            IAlignmentProvider alignment = attacker.configuration.alignmentProvider;

            List <BuffInfo> buffInfos = new List <BuffInfo>();
            //buffInfos.Add(new BuffInfo(eBuffType.damage, 10, 10f, "PoisonFX"));
            DamageInfo damageInfo = new DamageInfo(10, 0, buffInfos, alignment);

            BattleOrder bo = new BattleOrder();

            bo.Construct(attacker, target, damageInfo);
            battle_order.Add(bo);
        }
コード例 #12
0
    void IsAOE(LevelAgent target, int damage, IAlignmentProvider alignment)
    {
        Collider[] cols = Physics.OverlapSphere(target.position, radius);
        foreach (Collider col in cols)
        {
            // If target can receive damage
            LevelAgent pc = col.gameObject.GetComponent <LevelAgent>();
            if (pc != null && target.configuration.alignmentProvider.IsFriend(pc.configuration.alignmentProvider))
            {
                Vector3 targetDir = pc.transform.position - target.transform.position;

                float proportion  = 1 - targetDir.sqrMagnitude / (radius * radius);
                int   finalDamage = (int)(damage * proportion);

                pc.OnSkillDamageTaken(finalDamage, pc.position, alignment, true, null, "");
            }
        }
    }
コード例 #13
0
    public void Init(LevelAgent attacker, List <LevelAgent> targets, List <DamageInfo> skillDamages)//, List<int> damages, bool blClearSkill = false, bool blJingHua = false
    {
        skillTargets = targets;
        sbs          = new List <SkillBase>();
        int nCount = gameObject.transform.childCount;

        for (int i = 0; i < nCount; i++)
        {
            SkillBase skill = gameObject.transform.GetChild(i).gameObject.GetComponent <SkillBase>();
            if (skill != null)
            {
                skill.AttachActor(attacker, targets, skillDamages);
                sbs.Add(skill);
                //totalTime += skill.totalTime;

                skill.isOver += OnItemSkillOver;
            }
        }

        //StartCoroutine(UpdateSelf());
    }
コード例 #14
0
ファイル: BattleSystem.cs プロジェクト: moto2002/DefenseGame
        public void AddSkillAttackToBattleOrder(AttackData attackData)
        {
            LevelAgent attacker = attackData.fsm.levelAgent;
            LevelAgent target   = attackData.target.GetComponent <LevelAgent>();

            List <LevelAgent> targets = new List <LevelAgent>();

            targets.Add(target);


            int             damage;
            List <BuffInfo> buffInfos = new List <BuffInfo>();

            if (attackData.skillId == 2002)
            {
                damage = 0;
                buffInfos.Add(new BuffInfo(eBuffType.damage, 5, 3f, "PoisonFX"));
            }
            else if (attackData.skillId == 2003)
            {
                damage = 10;
            }
            else
            {
                damage = 1;
            }

            DamageInfo damageInfo = new DamageInfo(damage, 0, buffInfos, attacker.configuration.alignmentProvider);

            List <DamageInfo> skillDamages = new List <DamageInfo>();

            skillDamages.Add(damageInfo);

            BattleOrder bo = new BattleOrder();

            bo.Construct(attacker, targets, skillDamages, attackData.skillId);
            battle_order.Add(bo);
        }
コード例 #15
0
        private void OnComplete()
        {
            for (int i = 0; i < this.targets.Count; i++)
            {
                LevelAgent pc = this.targets[i];
                if (pc != null)
                {
                    DamageInfo skillDamageInfo = this.skillDamages[i];
                    if (pc.GetHealthValue() > 0 && skillDamageInfo.buffInfos.Count > 0)
                    {
                        for (int j = 0; j < skillDamageInfo.buffInfos.Count; j++)
                        {
                            pc.AddBuff(BuffBase.GetBuff(skillDamageInfo.buffInfos[j], this.attacker, pc));
                        }
                    }
                }
            }
            attacker.AttackDone();

            XEventBus.Instance.Post(EventId.BattleSkillEnd, new XEventArgs(this));

            attack_phase.SetState(AttackPhase.Done);
        }
コード例 #16
0
 public void Init(LevelAgent attacker, List <LevelAgent> targets, SkillCfg skillInfo)
 {
 }