Exemple #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);
                }
            }
        }
    }
Exemple #2
0
 public void MoveChip(bool aMove, Vector3 aTargetPos, float aSpeed, string aPlayerName,
                      ActionFinishDelegate onActionComplete = null, int aIdSender = -1, int aIndex = -1)
 {
     this.m_isMove    = aMove;
     this.m_targetPos = aTargetPos;
     //this.m_speed = aSpeed;
     this.m_speed        = 700.0f;
     this.m_actionFinish = onActionComplete;
     this.m_idSender     = aIdSender;
     this.m_index        = aIndex;
     this.m_playerName   = aPlayerName;
 }