Пример #1
0
    //void OnDisable () {
    //    gameObject.SetActive (false);
    //}

    private void Update()
    {
        if (this.m_isMove)
        {
            float step = m_speed * Time.deltaTime;
            transform.localPosition = Vector3.SmoothDamp(transform.localPosition, this.m_targetPos, ref velocity, 0.3f, 600, Time.deltaTime);
            if (onChipMove != null)
            {
                onChipMove(this.m_playerName);
            }
            if (Vector3.Distance(transform.localPosition, this.m_targetPos) <= closeDistance)
            {
                this.m_isMove = false;
                if (this.m_actionFinish != null)
                {
                    this.m_actionFinish(this.m_idSender, this.m_index, gameObject);
                    this.m_actionFinish = null;
                }
                if (this.m_sequenceMoveFinish != null)
                {
                    this.m_sequenceMoveFinish(m_cua);
                    this.m_sequenceMoveFinish = null;
                }
                if (onChipMoveFinish != null)
                {
                    onChipMoveFinish(this.m_playerName);
                }
            }
        }
    }
Пример #2
0
 public void SequenceMove(bool aMove, Vector3 aTargetPos, float aSpeed, string aPlayerName,
                          SequenceMoveFinishDelegate onSequenceMoveComplete = null, int cua = -1)
 {
     this.m_isMove    = aMove;
     this.m_targetPos = aTargetPos;
     //this.m_speed = aSpeed;
     this.m_speed = 700.0f;
     this.m_sequenceMoveFinish = onSequenceMoveComplete;
     this.m_cua        = cua;
     this.m_playerName = aPlayerName;
 }