예제 #1
0
    public void Skill_2_Action()
    {
        //Skill 2
        GetComponent <Animation>().CrossFade(skill_2.name);
        _timerAnim += Time.deltaTime;
        if (_timerAnim >= CalculatorTimeAnim(skill_2) * 0.9f)// if (animation[skill_2.name].normalizedTime > 0.9f)
        {
            _timerAnim          = 0;
            countAction         = 0;
            oldSkillIndexSend   = -1;
            curSkillIndexSelect = -1;

            SkillHandle  = null;
            ActionHandle = Action_1;

            if (target != null)
            {
                OnAction(target);
            }
            else
            {
                OnIdle();
            }
        }
    }
예제 #2
0
    void Start()
    {
        if (tag == GameManager.PlayerTagName)
        {
            autoSkill = false;
        }
        else
        {
            autoSkill = true;
        }

        _timerAnim          = 0;
        curSkillIndexSelect = -1;
        ActionHandle        = Action_2;
        sendingSkill        = false;
        InitHealthBar();
        hp = maxhp;
        ConfigAnimation();

        if (isConnectedServer())
        {
            if (role.RoleSkills.Count > 0)
            {
                //set current skill = deafult skill
                GameSkill curSkill = role.RoleSkills[0].GameSkill;

                distanceAction = curSkill.CastRange;
            }
        }

        audio = gameObject.AddComponent <AudioSource>();
    }
예제 #3
0
    public void Skill_1_Action()
    {
        //Skill 1
        GetComponent <Animation>().CrossFade(skill_1.name);
        _timerAnim += Time.deltaTime;

        //attack is completed
        if (_timerAnim >= CalculatorTimeAnim(skill_1) * 0.9f)// if (animation[skill_1.name].normalizedTime > 0.9f)
        {
            _timerAnim          = 0;
            countAction         = 0;
            oldSkillIndexSend   = -1;
            curSkillIndexSelect = -1;

            SkillHandle = null;

            ActionHandle = Action_1;//skills completed, wait for default skill

            if (target != null)
            {
                // OnAction(target);
            }
            else
            {
                OnIdle();
            }
        }
    }
예제 #4
0
    //check time for next attack
    private void Action_1()
    {
        //when  this time, Wait for next attack
        GetComponent <Animation>().CrossFade(idle.name);

        //countAction (time start idle to now) , when time of the next attack came
        if (countAction >= actionSpeed - CalculatorTimeAnim(action))
        {
            if (action2 != null)//is mobs
            {
                //set clip of default skill to play is random clip (default 1  or default 2)
                if (Random.Range(0, 2) == 1)
                {
                    action = action2;
                }
                else
                {
                    action = action1;
                }
            }

            countAction  = 0;
            ActionHandle = Action_2;//attack by default skill
        }
    }
예제 #5
0
        }//*/

        /// <summary>
        /// 获取所有子窗口句柄
        /// </summary>
        /// <param name="Father"></param>
        /// <returns></returns>
        private bool GetChildrenHandles(ref TreeNode Father)
        {
            Father.Nodes.Clear();
            string F = Father.Text;
            string C = FunctionHandle.FindChildHandle(Father.Text, "0");//查找第一个子句柄

            if (C == "0")
            {
                return(false);         //当前句柄下没有子句柄
            }
            Father.Nodes.Add(C);

            while (C != "0")
            {
                C = FunctionHandle.FindChildHandle(F, C); //查找下一个子句柄
                if (C != "0")                             //找到了子句柄
                {
                    Father.Nodes.Add(C);
                    continue;
                }
                else
                {
                    return(true);//已遍历所有子句柄
                }
            }

            return(false);//error
        }
예제 #6
0
 private void Attack_2()
 {
     //attack
     GetComponent <Animation>().Play(attack.name);
     if (GetComponent <Animation>()[attack.name].normalizedTime > 0.9f)
     {
         AttackHandle = Attack_1;
     }
 }
예제 #7
0
 private void Attack_1()
 {
     //wait delay & prepare attack
     GetComponent <Animation>().CrossFade(idle.name);
     countAttack += attackSpeed * Time.deltaTime;// Time.smoothDeltaTime;
     if (countAttack >= 100)
     {
         countAttack  = 0;
         AttackHandle = Attack_2;
     }
 }
예제 #8
0
 public void Skill_2_Cast()
 {
     //Cast Skill 2
     //animation.CrossFade(cast_2.name);
     // countCastSkill_2 += 1 * Time.deltaTime;//Time.smoothDeltaTime;
     // if (countCastSkill_2 >= deley_Cast_Skill_2)
     // {
     SoundManager.Instance.PlaySkillCast(this, 2);
     SkillHandle      = Skill_2_Action;
     countCastSkill_2 = 0;
     StartCoroutine("CalCoolDownSkill_2");
     // }
 }
예제 #9
0
        /// <summary>
        /// 刷新游戏句柄树状图
        /// </summary>
        /// <param name="str">句柄</param>
        private void RefreshGameWindow_treeView(IntPtr str)
        {
            TreeNode FatherGameHandle = new TreeNode(FunctionHandle.GetTopFatherHandle(str).ToString());

            //fHandle.GetTopFatherHandle(GameHandle.Handle).ToString()
            GetAllChildrenHandles(ref FatherGameHandle);
            this.GameWindow_HandleList_treeView.Nodes.Clear();
            this.GameWindow_HandleList_treeView.Nodes.Add(FatherGameHandle);
            //选中节点
            foreach (TreeNode item in GameWindow_HandleList_treeView.Nodes)
            {
                ErgodicTreeView(item, str.ToString());
            }
        }
예제 #10
0
 //network event active skill
 private void HandleSkillCast(int curSkillIndex)
 {
     curSkillIndexSelect = curSkillIndex;
     if (curSkillIndexSelect == 0)
     {
         countAction = 0;
         actionStat  = ActionStat.Action;
     }
     else if (curSkillIndexSelect == 1)
     {
         _timerAnim  = 0;
         actionStat  = ActionStat.Skill;
         SkillHandle = Skill_1_Cast;
     }
     else if (curSkillIndexSelect == 2)
     {
         _timerAnim  = 0;
         actionStat  = ActionStat.Skill;
         SkillHandle = Skill_2_Cast;
     }
 }
예제 #11
0
        //窗口句柄相关成员
        /// <summary>
        /// 自动后台模式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameWindow_AutoHandle_button_Click(object sender, EventArgs e)
        {
            //自动查找游戏句柄
            int SH = Screen.PrimaryScreen.Bounds.Height; //屏幕分辨率高度
            int SW = Screen.PrimaryScreen.Bounds.Width;  //屏幕分辨率宽度

            using (GameHandleClass SeekHandle = new GameHandleClass())
            {
                SeekHandle.Mode = FunctionHandle.MODE.Handle;
                Point XY = new Point(0, 0);
                do
                {
                    SeekHandle.Handle = FunctionHandle.WindowFromPoint(XY);
                    if (XY.X > SW)
                    {
                        XY.X  = 0;
                        XY.Y += 100;
                    }
                    else
                    {
                        XY.X += 100;
                    }
                    if ((XY.X > SW) && (XY.Y > SH))
                    {
                        this.GameWindow_Message_textBox.Text      = "自动后台模式抓取失败╭இɷஇ╮";
                        this.GameWindow_Message_textBox.BackColor = Color.Red;
                        GlobalObject.GameHandle = new GameHandleClass();
                        RefreshGameWindow_pictureBox();
                        return;
                    }
                } while (!SeekHandle.IsWin_800x480());

                GlobalObject.GameHandle      = new GameHandleClass(SeekHandle);
                GlobalObject.GameHandle.Mode = FunctionHandle.MODE.Handle;  // 更改模式
                RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle); // 刷新树状图
                this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 句柄:" + GlobalObject.GameHandle.Handle.ToString();
                this.GameWindow_Message_textBox.BackColor = Color.Lime;
                RefreshGameWindow_pictureBox();
            }
        }
예제 #12
0
    private void Action_2()
    {
        //play animation default skill
        GetComponent <Animation>().CrossFade(action.name);

        _timerAnim += Time.deltaTime;
        //attack is completed
        if (_timerAnim >= CalculatorTimeAnim(action) * 0.9f)// if (animation[action.name].normalizedTime > 0.9f)
        {
            //reset
            _timerAnim = 0;

            //back to Action_1, handle to action_1 (check time for next attack)
            ActionHandle = Action_1;
            countAction  = 0;

            oldSkillIndexSend   = -1;
            curSkillIndexSelect = -1;


            //send message to server , this role wants to impact target
            // OnAction(target);
        }
    }
 public UDBinaryOperator(string symbol, FunctionHandle handle)
     : base(symbol)
 {
     mComputer = handle;
 }
예제 #14
0
        /// <summary>
        /// Chorme后台模式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameWindow_Handle_button_MouseCaptureChanged(object sender, EventArgs e)
        {
            if (GameWindow_IsHandleClick)
            {
                GameWindow_IsHandleClick = false;
                return;
            }
            //手动查找游戏句柄
            using (GameHandleClass SeekHandle = new GameHandleClass())
            {
                SeekHandle.Handle = FunctionHandle.GetMouseHandle();
                SeekHandle.Mode   = FunctionHandle.MODE.Handle;

                if (SeekHandle.IsWin_800x480())
                {
                    GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                    {
                        Mode = FunctionHandle.MODE.Handle
                    };
                    RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                    this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 句柄:" + GlobalObject.GameHandle.Handle.ToString();
                    this.GameWindow_Message_textBox.BackColor = Color.Lime;
                    RefreshGameWindow_pictureBox();
                    return;
                }
                else//chorme模式
                {
                    SeekHandle.Mode = FunctionHandle.MODE.Handle;
                    Point xy = new Point();
                    if (FunctionJudge.IsGameInWin(SeekHandle.GetGameBitmap(), out xy))
                    {
                        GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                        {
                            Mode = FunctionHandle.MODE.Chorme,
                            XY   = xy
                        };
                        RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                        this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 chorme句柄:" + GlobalObject.GameHandle.Handle.ToString();
                        this.GameWindow_Message_textBox.BackColor = Color.Lime;
                        RefreshGameWindow_pictureBox();
                    }
                    else
                    {
                        // 尝试根父句柄的抓取
                        SeekHandle.Handle = FunctionHandle.GetTopFatherHandle(SeekHandle.Handle);
                        SeekHandle.Mode   = FunctionHandle.MODE.Handle;

                        if (FunctionJudge.IsGameInWin(SeekHandle.GetGameBitmap(), out xy))
                        {
                            GlobalObject.GameHandle = new GameHandleClass(SeekHandle)
                            {
                                Mode = FunctionHandle.MODE.Chorme,
                                XY   = xy
                            };
                            RefreshGameWindow_treeView(GlobalObject.GameHandle.Handle);
                            this.GameWindow_Message_textBox.Text      = "后台模式抓取成功 chorme句柄:" + GlobalObject.GameHandle.Handle.ToString();
                            this.GameWindow_Message_textBox.BackColor = Color.Lime;
                            RefreshGameWindow_pictureBox();
                        }
                        else
                        {
                            RefreshGameWindow_treeView(SeekHandle.Handle);
                            this.GameWindow_Message_textBox.Text      = "后台模式抓取失败 句柄:" + SeekHandle.Handle.ToString();
                            this.GameWindow_Message_textBox.BackColor = Color.Red;
                            GlobalObject.GameHandle = new GameHandleClass();
                            RefreshGameWindow_pictureBox();
                        }
                    }
                }
            }
        }
예제 #15
0
    //update animation , move
    private void UpdateActionStat()
    {
        //Hero State animation
        switch (actionStat)
        {
        case ActionStat.Idle:
        {
            /*if (tag == "Player" && !isAuto && typeCharacter != TypeChatacter.Healer)
             * {
             *  Controller enemy;
             *  float maxRange = distanceAction;
             *
             *  maxRange = Mathf.Max(maxRange, 3);
             *
             *  enemy = stateManager.FindEnemyNearest(true, maxRange);
             *
             *  if (enemy != null && actionStat == ActionStat.Idle)
             *  {
             *      HandleAction(enemy.gameObject);
             *  }
             *
             * }*/

            oldSkillIndexSend   = -1;
            curSkillIndexSelect = -1;
            GetComponent <Animation>().CrossFade(idle.name);
        }
        break;

        //this role move to point
        case ActionStat.Move:    //receiver from server
        {
            oldSkillIndexSend   = -1;
            curSkillIndexSelect = -1;
            countAction         = float.MaxValue;
            checkDistance       = Vector3.Distance(transform.position, LookAtTo(positionWay));
            //Debug.Log(name + " move");
            if (checkDistance >= 0.5f)
            {
                GetComponent <Animation>().CrossFade(walk.name);
                transform.Translate(Vector3.forward * speedMove * Time.deltaTime);
            }
            else
            {
                //positionWay = Vector3.zero;
                OnIdle();

                //completed how to move tutorial
                UIBattleManager.Instance.OnHeroFinishedMove(this);

                //hanlde =default attack 1 (only mobs)
                ActionHandle = Action_1;
            }
        }
        break;

        //this role move to target , and attack
        case ActionStat.Action:    //receiver from server
        {
            if (target != null)
            {
                checkDistance = (transform.position - LookAtTo(target.transform.position)).magnitude;        // *0.8f;

                if (checkDistance >= distanceAction)
                {
                    GetComponent <Animation>().CrossFade(walk.name);
                    transform.Translate(Vector3.forward * speedMove * Time.deltaTime);

                    //hanlde save =default Action_1 , prepare for this action
                    ActionHandle = Action_1;
                }
                else
                {
                    if (isConnectedServer() && oldSkillIndexSend != 0)
                    {
                        //in range attack of default skill, send active skill
                        if (target.GetComponent <Controller>().actionStat != ActionStat.Dead)
                        {
                            GameplayManager.Instance.SendSkillCast(role.Id, role.RoleSkills[0].SkillId);
                        }

                        oldSkillIndexSend = 0;
                    }
                    else
                    {
                        //call function of hanlde
                        ActionHandle();
                    }


                    if (target.GetComponent <Controller>() != null && target.GetComponent <Controller>().hp <= 0)
                    {
                        target = null;
                    }
                }
            }
            else        //target not exist
            {
                OnIdle();
            }
        }
        break;

        case ActionStat.Skill:    //receiver from server
        {
            if (SkillHandle != null)
            {
                if (isConnectedServer())
                {
                    GameSkill curSkill = role.RoleSkills[curSkillIndexSelect].GameSkill;
                    if (isSkillNeedTarget(curSkill))
                    {
                        if (target == null)
                        {
                            OnIdle();
                            return;
                        }


                        checkDistance = (transform.position - LookAtTo(target.transform.position)).magnitude;        // *0.8f;

                        if (checkDistance >= curSkill.CastRange)
                        {
                            //Debug.Log("Ok CastRange " + curSkill.CastRange);
                            if (GetComponent <Animation>()[action.name].normalizedTime <= 0)
                            {
                                GetComponent <Animation>().CrossFade(walk.name);
                                transform.Translate(Vector3.forward * speedMove * Time.deltaTime);
                                break;
                            }
                        }
                        else
                        {
                            //Debug.Log("CastRange < " + curSkill.CastRange);
                        }
                    }
                }
                SkillHandle();
            }
            else
            {
                actionStat = ActionStat.Idle;
            }
        }
        break;

        case ActionStat.Dead:
        {
            if (GetComponent <Animation>().IsPlaying(dead.name))
            {
                return;
            }
            if (!GetComponent <Animation>().enabled)
            {
                GetComponent <Animation>().enabled = true;
            }
            GetComponent <Animation>().CrossFade(dead.name);
            this.enabled = false;
        }
        break;

        case ActionStat.hit:
            if (hit != null)
            {
                GetComponent <Animation>().CrossFade(hit.name);
            }
            break;
        }
    }
예제 #16
0
 public static extern IntPtr wasm_func_as_extern(FunctionHandle function);
예제 #17
0
 void Start()
 {
     hp           = maxhp;
     actionStat   = ActionStat.Move;
     AttackHandle = Attack_1;
 }