Ejemplo n.º 1
0
        public void SetTarget(Target target)
        {
            Target = target;

            if (Target == null)
            {
                CurrentAttack = null;
                NextAttack    = null;
                AttackList    = null;
                return;
            }
            else
            {
                if (AttacksFromResult == true)
                {
                    AttackList = Target.Best?.ToList() ?? null;
                }
                else
                {
                    AttackList = Target.Attacks?.ToList() ?? null;
                }
                if (AttackList != null && AttackList.Count > 1)
                {
                    AttackList.Sort();
                    AttackList.Reverse();
                    NextAttack = AttackList[0];
                }
            }
            INotifyPropertyChanged("HasAttacks");
            INotifyPropertyChanged("AttackList");
        }
Ejemplo n.º 2
0
 private void Awake()
 {
     attackList = GetComponent <AttackList>();
     patrol     = GetComponent <Patrol>();
     hold       = GetComponent <Hold>();
     chase      = GetComponent <Chase>();
 }
Ejemplo n.º 3
0
 public Unit(GameObject target, RSchmit.AI member)
 {
     this.target = target;
     members     = new List <RSchmit.AI>();
     members.Add(member);
     attackList = new AttackList();
 }
    private void WriteTestAttacks()
    {
        attackList         = new AttackList();
        attackList.attacks = new List <Attack>();

        Attack attack1 = new Attack();

        attack1.name = "attack 1";
        //attack1.base_damage = 0.5f;
        attack1.animation_id    = "x";
        attack1.startDamageTime = 0f;
        attack1.endDamageTime   = 1f;
        attackList.attacks.Add(attack1);

        Attack attack2 = new Attack();

        attack2.name = "attack 2";
        //  attack2.base_damage = 0.5f;
        attack2.animation_id    = "xx";
        attack2.startDamageTime = 0f;
        attack2.endDamageTime   = 1f;
        attackList.attacks.Add(attack2);

        string json = JsonUtility.ToJson(attackList, true);

        File.WriteAllText(Application.dataPath + "/" + jsonName + ".json", json);
    }
Ejemplo n.º 5
0
        void Update()
        {
            if (AttackList.Count > 0 && (MeController.StatuController.CurrentStatu == Status.IDLE || MeController.StatuController.CurrentStatu == Status.RUN))
            {
                CurVo = AttackList[0];
                AttackList.RemoveAt(0);
                switch (CurVo.ActionType)
                {
                case Actions.RUN:
                    MeController.MoveTo(CurVo.RunDestination.x, CurVo.RunDestination.y);
                    break;

                case Actions.DEATH:
                    MeController.StatuController.SetStatu(Status.DEATH);
                    break;

                case Actions.ATTACK:
                    if (Math.Abs(CurVo.TargetPoint.x) > 0)
                    {
                        int dir = CurVo.TargetPoint.x < MeController.Me.GoBase.transform.position.x ? Directions.Left : Directions.Right;
                        MeController.Me.ChangeDire(dir);
                    }
                    MeController.SkillController.RequestUseSkill(SkillController.Attack1);
                    //宠物暂时只做一次攻击

                    /*if (MeController.StatuController.CurrentCombStatu == Status.COMB_0 || MeController.StatuController.CurrentCombStatu == Status.COMB_2)
                     * {
                     *  MeController.SkillController.RequestUseSkill(SkillController.Attack1);
                     * }
                     * else if (MeController.StatuController.CurrentCombStatu == Status.COMB_1)
                     * {
                     *  MeController.SkillController.RequestUseSkill(SkillController.Attack2);
                     * }*/
                    break;
                }
            }
            if (AttackList.Count > 0 && (MeController.StatuController.CurrentStatu == Status.HURT1 || MeController.StatuController.CurrentStatu == Status.HURT2 ||
                                         MeController.StatuController.CurrentStatu == Status.HURT3))
            {
                CurVo = AttackList[0];
                if (CurVo.ActionType == Actions.DEATH)
                {
                    AttackList.Clear();
                    MeController.StatuController.SetStatu(Status.DEATH);
                }
            }
            if (AttackList.Count > 0 && MeController.StatuController.CurrentStatu == Status.HURTDOWN)
            {
                CurVo = AttackList[0];
                if (CurVo.ActionType == Actions.DEATH)
                {
                    AttackList.Clear();
                    Invoke("Death", 0.3f);
                }
            }
        }
        private void Update()
        {
            if (MapMode.StartAutoMove || MeController.StatuController.CurrentStatu == Status.DEATH)
            {
                AttackList.Clear(); //切图的过程中情况攻击列表
            }

            if ((MeController.StatuController.CurrentCombStatu >= MeController.StatuController.MaxComb &&
                 MeController.StatuController.MaxComb > 1) || MeController.StatuController.CurrentStatu == Status.Win)
            {
                if (NeedClear())
                {
                    AttackList.Clear();
                }
            }
            if (AttackList.Count > 0 &&
                (MeController.StatuController.CurrentStatu == Status.IDLE ||
                 MeController.StatuController.CurrentStatu == Status.RUN) &&
                MeController.SkillController.SkillList.Count == 0)
            {
                CurVo = AttackList[0];
                AttackList.RemoveAt(0);
                switch (CurVo.ActionType)
                {
                case Actions.RUN:
                    MeController.MoveTo(CurVo.RunDestination.x, CurVo.RunDestination.y);
                    break;

                case Actions.DEATH:
                    MeController.StatuController.SetStatu(Status.DEATH);
                    break;

                case Actions.ATTACK:
                    if (MeController.StatuController.CurrentCombStatu == Status.COMB_0 ||
                        (MeController.StatuController.CurrentCombStatu == MeController.StatuController.MaxComb))
                    {
                        MeController.SkillController.RequestUseSkill(SkillController.Attack1);
                    }
                    else if (MeController.StatuController.CurrentCombStatu == Status.COMB_1)
                    {
                        MeController.SkillController.RequestUseSkill(SkillController.Attack2);
                    }
                    else if (MeController.StatuController.CurrentCombStatu == Status.COMB_2)
                    {
                        MeController.SkillController.RequestUseSkill(SkillController.Attack3);
                    }
                    else if (MeController.StatuController.CurrentCombStatu == Status.COMB_3)
                    {
                        MeController.SkillController.RequestUseSkill(SkillController.Attack4);
                    }
                    break;
                }
            }
        }
Ejemplo n.º 7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Debug.Log("Warning, there is more than one AttackList class in the scene!");
     }
 }
        protected void UpdateFilterList(string filterTerm)
        {
            FilteredList = AttackList.Where(i =>
                                            i.Name.ToLower().Contains(filterTerm.ToLower()) ||
                                            i.Causing.ToLower().Contains(filterTerm.ToLower()) ||
                                            i.Description.ToLower().Contains(filterTerm.ToLower()) ||
                                            i.Effects.ToLower().Contains(filterTerm.ToLower())
                                            ).ToList();

            filterAttacks.RefreshTable();
        }
        /// <summary>
        ///     执行动作添加到队列
        /// </summary>
        /// <param name="vo">动作信息</param>
        /// <param name="isPush">强插入,技能强制插入,普通攻击加入队列</param>
        public override void AddAttackList(ActionVo vo, bool isPush = false)
        {
            var playerVo = MeController.Me.GetVo() as PlayerVo;

            playerVo.CurHp = DangJiTester.playerVoCurHp;             // grsyh
            if (playerVo != null && (playerVo.CurHp <= 0 && vo.ActionType != Actions.DEATH))
            {
                return;
            }

            if (AttackList == null)
            {
                AttackList = new List <ActionVo>();
            }

            //死亡立即播放,死亡控制可放在单独的死亡控制类里面
            if (vo.ActionType == Actions.DEATH)
            {
                AttackList.Clear();
                AttackList.Add(vo);
                return;
            }
            //强制插入
            if (isPush)
            {
                if (IsInBattle())
                {
                    return;
                }
                CurVo = null;
                AttackList.Clear();
                AttackList.Add(vo);
                return;
            }
            if (MeController.StatuController.CurrentStatu == Status.IDLE ||
                MeController.StatuController.CurrentStatu == Status.RUN ||
                MeController.StatuController.CurrentStatu == Status.ATTACK1 ||
                MeController.StatuController.CurrentStatu == Status.ATTACK2 ||
                MeController.StatuController.CurrentStatu == Status.ATTACK3)
            {
                if (AttackList.Count >= MeController.StatuController.MaxComb && MeController.StatuController.MaxComb > 1)
                {
                    return;
                }
                AttackList.Add(vo);
            }
        }
Ejemplo n.º 10
0
    public void attack(Entity attacker, Entity defender, Attack attack)
    {
        if (attack.usesLeft <= 0)
        {
            attack = AttackList.getDefaultAttack();
        }
        else
        {
            attack.usesLeft--;
        }

        audioSystem.requestSound(attack.sound);
        AttackResult res = attacker.attackOther(defender, attack);

        foreach (string current in res.log)
        {
            Debug.Log(current);
        }
    }
Ejemplo n.º 11
0
        /// <summary>
        /// 执行动作添加到队列
        /// </summary>
        /// <param name = "vo">动作信息</param>
        /// <param name = "isPush">强插入</param>
        override public void AddAttackList(ActionVo vo, bool isPush = false)
        {
            var petVo = MeController.Me.GetVo() as PetVo;

            if (petVo != null && (petVo.CurHp <= 0 && vo.ActionType != Actions.DEATH))
            {
                return;
            }

            if (AttackList == null)
            {
                AttackList = new List <ActionVo>();
            }

            //死亡立即播放,死亡控制可放在单独的死亡控制类里面
            if (vo.ActionType == Actions.DEATH)
            {
                AttackList.Clear();
                AttackList.Add(vo);
                return;
            }
            //如果在翻滚状态,则不会受到伤害
            if (MeController.StatuController.CurrentStatu == Status.ROLL && vo.ActionType == Actions.INJURED)
            {
                return;
            }
            //强制插入
            if (isPush)
            {
                CurVo = null;
                AttackList.Clear();
                AttackList.Add(vo);
                return;
            }
            if (MeController.StatuController.CurrentStatu == Status.IDLE || MeController.StatuController.CurrentStatu == Status.RUN)
            {
                //attackList.Clear();
                AttackList.Add(vo);
            }
        }
Ejemplo n.º 12
0
    // Use this for initialization
    void Awake()
    {
        strong   = new List <PokemonType>();
        weak     = new List <PokemonType>();
        noDamage = new List <PokemonType>();

        animator   = GetComponent <Animator>();
        attacks    = new AttackInfo[4];
        attackList = AttackList.Instance;
        SetInfo();
        SetBaseStats();
        SetAttacks();
        SetIVs();
        SetEffectiveStats();
        currentHP = effectiveStats.hp;
        SetTypeStrength(pokemonType);
        if (secondaryType != PokemonType.none)
        {
            SetTypeStrength(secondaryType);
        }
        SetAttackAnimations();
        AssignAnimations();
    }
    private void ReadAttacks(string path)
    {
        if (File.Exists(path))
        {
            // Open the stream and read it back.
            using (FileStream fs = File.OpenRead(path))
            {
                byte[]       b    = new byte[1024];
                UTF8Encoding temp = new UTF8Encoding(true);

                while (fs.Read(b, 0, b.Length) > 0)
                {
                    string json = temp.GetString(b);
                    attackList = JsonUtility.FromJson <AttackList>(json);
                    Debug.Log(attackList.attacks[1].name);
                }
            }
        }
        else
        {
            Debug.Log("File does not exist");
        }
    }
Ejemplo n.º 14
0
 private void InitializeProperties()
 {
     Classes = new Dictionary<ClassType, IClass>();
     Attacks = new AttackList(this);
     Saves = new SavesList(this);
     Hitpoints = new Hitpoints();
     Equipment = new Equipment(this);
     Features = new FeatureList();
     Skills = new SkillList(this);
     Experience = new Experience(this);
 }
Ejemplo n.º 15
0
 public Arm(bool isRight)
 {
     this.isRight = isRight;
     attack = AttackList.getRandomAttack();
     stats = new Stats(30);
 }
Ejemplo n.º 16
0
        private void Update()
        {
            if (AttackList.Count > 0 &&
                ((MeController.StatuController.CurrentStatu == Status.IDLE &&
                  MeController.StatuController.CurStatuNameHash == Status.NAME_HASH_IDLE) ||
                 (MeController.StatuController.CurrentStatu == Status.RUN ||
                  MeController.StatuController.CurStatuNameHash == Status.NAME_HASH_RUN)))
            {
                CurVo = AttackList[0];
                AttackList.RemoveAt(0);
                switch (CurVo.ActionType)
                {
                case Actions.RUN:

                    MeController.MoveTo(CurVo.RunDestination.x, CurVo.RunDestination.y);
                    break;

                case Actions.DEATH:
                    MeController.StatuController.SetStatu(Status.DEATH);
                    break;

                case Actions.ATTACK:
                    if (Math.Abs(CurVo.TargetPoint.x) > 0)
                    {
                        int dir = CurVo.TargetPoint.x < MeController.Me.GoBase.transform.position.x
                                ? Directions.Left
                                : Directions.Right;
                        MeController.Me.ChangeDire(dir);
                    }
                    //怪物只有两连击
                    if (MeController.StatuController.CurrentCombStatu == Status.COMB_0 ||
                        MeController.StatuController.CurrentCombStatu == Status.COMB_2)
                    {
                        print("****SkillController.Attack1");
                        MeController.SkillController.RequestUseSkill(SkillController.Attack1);
                    }
                    else if (MeController.StatuController.CurrentCombStatu == Status.COMB_1)
                    {
                        print("****SkillController.Attack2");
                        MeController.SkillController.RequestUseSkill(SkillController.Attack2);
                    }
                    break;
                }
            }
            if (AttackList.Count > 0 &&
                (MeController.StatuController.CurrentStatu == Status.HURT1 ||
                 MeController.StatuController.CurrentStatu == Status.HURT2 ||
                 MeController.StatuController.CurrentStatu == Status.HURT3))
            {
                CurVo = AttackList[0];
                if (CurVo.ActionType == Actions.DEATH)
                {
                    AttackList.Clear();
                    MeController.StatuController.SetStatu(Status.DEATH);
                }
            }
            if (AttackList.Count > 0 && MeController.StatuController.CurrentStatu == Status.HURTDOWN)
            {
                CurVo = AttackList[0];
                if (CurVo.ActionType == Actions.DEATH)
                {
                    AttackList.Clear();
                    Invoke("Death", 0.3f);
                }
            }
        }