//Update Area Colliders
    void UpdateAreaColliders()
    {
        //switch current area collider to a trigger
        if (currentWave > 0)
        {
            BoxCollider areaCollider = EnemyWaves [currentWave - 1].AreaCollider;
            if (areaCollider != null)
            {
                areaCollider.enabled   = true;
                areaCollider.isTrigger = true;
                AreaColliderTrigger act = areaCollider.gameObject.AddComponent <AreaColliderTrigger> ();
                act.EnemyWaveSystem = this;
            }
        }

        //set next collider as camera area restrictor
        if (EnemyWaves[currentWave].AreaCollider != null)
        {
            EnemyWaves[currentWave].AreaCollider.gameObject.SetActive(true);
        }
        //LETHAL FORCES - set back collider as area restrictor
        if (EnemyWaves[currentWave].BackAreaCollider != null)
        {
            EnemyWaves[currentWave].BackAreaCollider.gameObject.SetActive(true);
        }

        CameraFollow cf = GameObject.FindObjectOfType <CameraFollow>();

        if (cf != null)
        {
            cf.CurrentAreaCollider = EnemyWaves [currentWave].AreaCollider;
        }
        if (cf != null)
        {
            cf.CurrentBackCollider = EnemyWaves [currentWave].BackAreaCollider;             //LETHAL FORCES - add backcollider to camera
        }
        //show UI hand pointer
        HandPointer hp = GameObject.FindObjectOfType <HandPointer>();

        if (hp != null)
        {
            hp.ActivateHandPointer();
        }
    }
예제 #2
0
    /// <summary>
    /// 更新区域碰撞器
    /// </summary>
    void UpdateAreaColliders()
    {
        //将当前区域碰撞器切换到触发器
        if (currentWave > 0)
        {
            BoxCollider areaCollider = EnemyWaves[currentWave - 1].AreaCollider;
            if (areaCollider != null)
            {
                areaCollider.enabled   = true;
                areaCollider.isTrigger = true;
                AreaColliderTrigger act = areaCollider.gameObject.AddComponent <AreaColliderTrigger>();
                act.EnemyWaveSystem = this;
            }
        }

        //将下一个碰撞器设置为相机区域触发器
        if (EnemyWaves[currentWave].AreaCollider != null)
        {
            EnemyWaves[currentWave].AreaCollider.gameObject.SetActive(true);
        }

        CameraFollow cf = GameObject.FindObjectOfType <CameraFollow>();

        if (cf != null)
        {
            cf.CurrentAreaCollider = EnemyWaves[currentWave].AreaCollider;
        }

        //显示UI
        HandPointer hp = GameObject.FindObjectOfType <HandPointer>();

        if (hp != null)
        {
            hp.ActivateHandPointer();
        }
    }