private void SetData(ModelAttackLevel level, string[] prefabPaths, int[] positionPrefab, Transform parent, float startDelay, float attackDelay)
 {
     this.level    = level;
     listAnimators = new List <Animator>();
     if (positionPrefab != null && positionPrefab.Length > 0)
     {
         dicPostitionNode = new Dictionary <int, bool>();
     }
     for (int i = 0; i < prefabPaths.Length; i++)
     {
         string     prefabPath = prefabPaths[i];
         GameObject obj        = Resources.Load <GameObject>(prefabPath);
         GameObject initObj    = GameObject.Instantiate <GameObject>(obj);
         initObj.transform.SetParent(parent, false);
         initObj.SetActive(false);
         Animator animator = initObj.GetComponent <Animator>();
         listAnimators.Add(animator);
         if (positionPrefab != null && i < positionPrefab.Length && positionPrefab[i] != 0)
         {
             dicPostitionNode.Add(i, true);
         }
     }
     this.startDelay  = startDelay;
     this.attackDelay = attackDelay;
 }
 public ModelSkill(ModelAttackLevel level, string[] prefabPaths, int[] positionPrefab, Transform parent, float startDelay, float attackDelay)
 {
     m_prefabPaths    = prefabPaths;
     m_positionPrefab = positionPrefab;
     m_parent         = parent;
     SetData(level, prefabPaths, positionPrefab, parent, startDelay, attackDelay);
 }
    private void Attack(object arg)
    {
        ModelAttackLevel level = (ModelAttackLevel)arg;

        m_player.AttackLevel = level;
        m_player.State       = SRoleState.Type.SRoleAttack;
    }
Esempio n. 4
0
 /// <summary>
 /// </summary>
 /// <param name="roleType">攻击发出者角色类型</param>
 /// <param name="roleLevel">攻击发出者角色类型等级, 对应类型枚举</param>
 /// <param name="attackLevel">攻击发出者攻击等级</param>
 /// <param name="sender">攻击发出者</param>
 /// <param name="receiver">攻击接收者</param>
 public ModelAttackData(RoleType roleType, int roleLevel, ModelAttackLevel attackLevel, string sender, string receiver)
 {
     this.roleType    = roleType;
     this.roleLevel   = roleLevel;
     this.attackLevel = attackLevel;
     this.sender      = sender;
     this.receiver    = receiver;
 }
Esempio n. 5
0
    protected void AddSkillData(ModelAttackLevel level, string[] prefabPaths, int[] positionPrefab, Transform parent, float startDelay, float attackDelay)
    {
        if (m_dicSkill == null)
        {
            m_dicSkill = new Dictionary <ModelAttackLevel, ModelSkill>();
        }
        if (m_dicSkill.ContainsKey(level))
        {
            m_dicSkill.Remove(level);
        }
        ModelSkill skillData = new ModelSkill(level, prefabPaths, positionPrefab, parent, startDelay, attackDelay);

        m_dicSkill.Add(level, skillData);
    }
Esempio n. 6
0
 protected void AddAttackAnimation(ModelAttackLevel level, string animationName)
 {
     if (m_AttackAnimation == null)
     {
         m_AttackAnimation = new Dictionary <ModelAttackLevel, string>();
     }
     if (m_AttackAnimation.ContainsKey(level))
     {
         m_AttackAnimation[level] = animationName;
     }
     else
     {
         m_AttackAnimation.Add(level, animationName);
     }
 }
 private void OnClick(ModelAttackLevel level)
 {
     EventManager.Dispatch(GameMoudle.Player, GameEvent.Type.Attack, level);
 }