示例#1
0
    // Use this for initialization
    void Start()
    {
        EventHandler.AddListener(EEventID.EVENT_DESTROY_ENEMY, OnEventDestroy);

        rate  = 0;
        index = 0;
        if (pathPoints.Length > 1)
        {
            time = Vector2.Distance(pathPoints[0], pathPoints[1]);
        }
        speed      = 0;
        m_subState = EnemySubState.FORWARD;
        if (b_stationary)
        {
            m_state = EnemyState.STOP;
        }
        else
        {
            m_state = EnemyState.MOVE;
        }
        startPos           = transform.position;
        endPos             = transform.position;
        OriginalPathPoints = pathPoints;
        m_ptrBlockersList  = new List <GameObject>();
    }
示例#2
0
 void ReverseEnemySubState()
 {
     if (m_subState == EnemySubState.FORWARD)
     {
         m_subState           = EnemySubState.REVERSE;
         transform.localScale = new Vector3(-1 * this.transform.localScale.x, this.transform.localScale.y, this.transform.localScale.z);
     }
     else if (m_subState == EnemySubState.REVERSE)
     {
         m_subState           = EnemySubState.FORWARD;
         transform.localScale = new Vector3(-1 * this.transform.localScale.x, this.transform.localScale.y, this.transform.localScale.z);
     }
 }